Hi folks, I'm currently working on my blog design and more specifically on pages. I have a series of pages (like "about me", "contact me" etc.). For the "contact me", instead of writing a post, I'd like to display a jpg image. I don't want this image to be display on the usual light blue post background (see my blog below...). I want it in lieu of the contentmiddle. So I make a graphic in Photoshop, the same size as my contentmiddle (like 540 x 600 px) and I'd like to replace the whole content middle by this graphic. I added the image in the post meanwhile, so you can check it out: Contact Me Page I need the image without the usual post background. But now I'm stuck! Do I have to create a new page template, like contactme.php? Sorry, it's hard to explain, but if you could point me to the right direction, I'd appreciate! Thanks
You can make a new custom page template. You can make as many as you want, copy the current page.php from your themes directory edit it, save it as a different name (aboutpage.php). Upload in the themes directory. Then when you create or edit a page it should appear in the drop down box on the right under page template. More here with a video:How To Create A Custom WordPress Page Template
Thanks for the info. I'm still a bit confused about make a new php page from the scratch, but I guess I need to watch the video a second time ! I must admit I'm fairly new with php (but fine with CSS), so I still can't find the way to link an image...
Hello Zhuli This should be fairly simple. Take the page template your using for the contact page rename it and use the new template for your contact page and change the css thats associated with your post area. Best of luck
As MarRome said just copy the current page.php and rename it. If you want nothing different other than to include an image just above the text of the page, place the code for the image just above this: <?php if(have_posts()): ?><?php
Thanks guys! I'm finishing the graphic and will experiment with my template this week. I'll let you know how it went!
Okay... I'm afraid I'm gonna have a few more questions! This is the beginning of my new contactme.php file I created (copy from page.php) : So far, so good. Now, I need to get rid of my usual post background (= middlecontent I think) to replace it with my image. I tried to replace <div id="contentmiddle"> with <div id="contactmetemplate"> and style the CSS. The image does display but it shifts to the left and messes up my blog (sidebars etc.). I may be doing things wrong... So: 1) How can I override the current post template? 2) How can I link to an image with php? Sorry about the questions, I'm very very new with php and it's still confusing to me, no matter how much I read about it! Thanks
You can just place the image directly into the file like this, take out or leave in what ever else you want. In the example below all that shows on this page is the header, footer sidebar and the image centered where the content would be. There may be a better way but this is pretty easy using plain html to add the image. <?php /* Template Name: Contact Template */ ?> <?php get_header(); ?> <div id="content_box"> <div id="content" class="page"> <p align="center"><img border="0" src="http://correresmidestino.com/wp-content/uploads/2007/11/contactmebg.jpg" ></p> </div> <?php get_sidebar(); ?> </div> <?php get_footer(); ?> PHP: This is an example on a test blog with a different theme than yours, the code may differ than yours and the image is too big in this case. If this doesn't work post your whole regular page.php file for us to look at. Check It out here: http://www.esmartjob.com/new/test
Hi Houdy and thanks you for your patience... which is about to be tested again! I tried a few things, but I always end up with template problems: either I get a syntax error, either I lose both of my sidebars etc. This is the original page.php I use with my them (non modified): The jpg image I'm trying to use as the background is the same width as my current contentmiddle, so it should be a problem... Once you show me once, I'd be able to learn and understand what I do wrong, but so far, I'm still stuck! Thanks!
Well try this: <?php /* Template Name: Contact Template */ ?> <?php get_header(); ?> <div id="content"> <?php include(TEMPLATEPATH."/l_sidebar.php");?> <div id="contentmiddle"> <p align="center"><img border="0" src="http://correresmidestino.com/wp-content/uploads/2007/11/contactmebg.jpg" ></p> </div> <?php comments_template(); // Get wp-comments.php template ?> </div></div> <?php include(TEMPLATEPATH."/r_sidebar.php");?> </div> <?php get_footer(); ?> PHP:
Phew, thank for your patience! I finally got it to work fine, and style it in the CSS: Contact me You've been very patient with me, thanks again ;-)