Hi all. I'm trying to have a unique header graphic on the main blog page of a site. The name of the page is blog and it is not the home page. Using if (is_page( 'blog' )) doesn't work. Can someone point out the correct way to identify this page in a conditional tag?
Thanks
I would make sure you have permalinks enabled. I don't think it will pick up the page unless you've actually enabled permalinks and set the specific page to be "blog". Your code is correct though...
<?php if (is_page('blog')) { ?>
do something
<?php } else { ?>
do something else
<?php } ?>
No - the conditional is incorrect. Try:
<?php if (is_home() ) { ?>
do something
<?php } else { ?>
do something else
<?php } ?>
http://codex.wordpress.org/Conditional_Tags#The_Main_Page
Thanks Esmi. That works. I would have expected that to cause the graphic on the home page to change.
Oh sorry, I thought he was trying to specify a particular page other than the home page. I must have misread the original post.
is_home() tests for the main posts page. If you have a static front page, then this will be the page you selected for Posts in settings/Reading.
is_front_page() test for the front (home) page.
I have it thanks. I read the doc.