Does anyone know if it is possible to have a different header image display on, say my about page, than the main page? And/or how to do this?
Thank you.
Does anyone know if it is possible to have a different header image display on, say my about page, than the main page? And/or how to do this?
Thank you.
<?php if(is_page('About')) : ?>
do about page specific code
<?php else : ?>
do normal stuff
<?php endif;?>
Would need to see your existing code to be more specific...
header.php more then likely..
If posting code, please do so inside backticks as indicated in the post box or use a pastebin...
http://wordpress.pastebin.ca/
Here's the full header.php
sure you can. first you have to create new page template. to do that copy everything inside your index.php then create a new php file and name it any name you prefer then paste every you just copied. insert this code above your new php file:
<?php /* Template Name: ANY NAME YOU PREFER
*/ ?>
save it.
then go to your dashboard>>pages>>add new>>your page's name in your case it's about
at the right side under the attribute there is a dropdown list label PARENT choose your template name then save it.
going back to your new php file you can now edit your page!
Is this all I need at the top of the newly created page (aside from all the code from the index.php that i copied and pasted)?
<?php about ?>
It's not showing up in the drop down menu under pages.
All that is showing is 'Main Page (no parent)'.
Thanks for helping me out.
<?php /* Template Name: ANY NAME YOU PREFER
*/ ?>
just change 'ANY NAME YOU PREFER' so it will become
<?php /* Template Name: about
*/ ?>
You're a rockstar, thank you so much!
you're welcome
So, now it shows up under the templates drop down, but I get this message when I go to the page:
Parse error: syntax error, unexpected T_STRING in /home/planpla9/public_html/blog/wp-content/themes/atahualpa/about.php on line 1
i thought you're good now hehe, anyway if you're sure you pasted the code above, really above no other code before
<?php /* Template Name: about
*/ ?>
then there might be unnecessary characters there. check...
paste the exactly the same as above same lines you have two lines there if you noticed.
got it.
thank you.
again.
One more question, any idea why the styling in a sidebar text box widget would render fine on the index page and not the about page?
that's impossible since you just duplicated the index file right? try to repeat the process
hrumph...not sure what to do now to override the what's set for the header on the main page
hey don't worry just delete your about php file and do it again maybe you just had a little error editing it.
Well, I have the new 'about' template working and what not. I'm just not sure how to go about changing the header image since it's rendered through the theme options php. I'm pretty clueless with PHP, if you haven't noticed...
thanks.
i understand here is what you should do, go to your about.php then find this code <?php bloginfo(template_directory);?>your image url(where your image is located). then upload your new header image(should be .png .jpg or .gif format) to the same directory.replace your old header image with your new one to you php file
That code is located in the header.php file.
Should I make a new header.php file (named aboutHeader.php or something like that) and make the change in that file then?
If so, where/how do I change which header file the about.php file links to?
oh my gosh! i'm sorry i was thinking your header image is located in your index.php i realized its in the header.php. Bear with me ok its gonna be more complicated.
this is what you are gonna do:
note: <?php bloginfo('template_directory');?>old image directory becomes <?php bloginfo('template_directory');?>new image directory. Just upload your new image file to the same directory as your old image file so you can just edit the file name not the whole directory or subdirectory ok?
good luck!
Seems alot of hard work for something so basic...
Why not just simply do this to your header element in the header.php...
<?php if(is_page('About')) : ?>class="aboutpageclass"<?php else : ?>class="normalclass"<?php endif;?>
Which simply switches a class on a element, usage would be like so..
Example element..
<div id="header">
With code added..
<div id="header" <?php if(is_page('About')) : ?>class="aboutpageclass"<?php else : ?>class="normalclass"<?php endif;?>>
Then in your CSS apply style to the necessary classes, following the example above, something like....
Example..
.aboutpageclass { background-image:someimage.jpg; }
.normalclass { background-image:anotherimage.jpg }
Why go through the work of creating a template/page and fiddling with function calls when it's such a simple and straight-forward task. Not saying the above is 'wrong' per say, but i don't think it need be that much work...
yeah, i like that idea.
thanks.
lhoylhoy,
I tried using your idea of designing a custom page template himalayas.php and a custom header which I called himalayaheader.php. I tried directing this to a new directory himalaya_images.
Now I get this error:
Fatal error: Call to undefined function: get_himalayaheader() in /home/armst5/public_html/MyBlog/wp-content/themes/atahualpa.3.2/atahualpa/himalayas.php on line 14
What am I doing wrong? The header needs to be directed to a folder that contains several rotating images.
i have done this and it works but i want to add it to more pages how to i add another piece of php code for other pages from this code
<div id="header" <?php if(is_page('About')) : ?>class="aboutpageclass"<?php else : ?>class="normalclass"<?php endif;?>>
Then in your CSS apply style to the necessary classes, following the example above, something like....
Example..
.aboutpageclass { background-image:someimage.jpg; }
.normalclass { background-image:anotherimage.jpg }
This topic has been closed to new replies.