So I have created my own template that has a set header for all of my pages home (which is a static front page), about, services, contact, etc....

I have recently created two newer pages products and blog. Products is using CataBlog to list my products and their information so I don't want the same header that I have used on the content pages. This also holds true for the blog page.

I went into my header.php file and did the following:


            if (is_page('blog')) { ?>
                <div id="header">


            if (is_page('product')) { ?>
                <div id="header">


            else {?>
                <div id="header">
                    <div id="slider">
                            <li><img src="<?php bloginfo('stylesheet_directory') ?>/images/01.jpg" alt="Pawtucket Pawnbrokers" /></li>
                            <li><img src="<?php bloginfo('stylesheet_directory') ?>/images/02.jpg" alt="We Buy Gold" /></li>
                            <li><img src="<?php bloginfo('stylesheet_directory') ?>/images/03.jpg" alt="Need Cash?" /></li>
                            <li><img src="<?php bloginfo('stylesheet_directory') ?>/images/04.jpg" alt="Instant Cash Loans" /></li>     



Now, when I go to the blog page the header maintains that of the static pages however the header on the product page is changed to display "hi" as expected. I changed the name blog in the is_page function to another of the static pages and received the desired result. I am assuming this means somewhere in my template files that original header is being called to display on the blog page. If this is true where should I look to make that change? If this is not the case what am I doing wrong?

Any help is always appreciated!

1 Answer 1


If the conditional works when using is_page( 'products' ), but does not work when using is_page( 'blog' ), then that means that WordPress isn't finding a static page with the slug blog. First thing to do: verify your slug name.

A second alternative is that the static page blog is using a custom page template, and that the custom page template is calling a different header file, resulting in the above code never getting executed. Are you using a custom page template for the static page blog? If so, you'll need to look at the custom page template file.


From your comment below:

i forgot to mention that as home is set as my static page in the admin panel the blog page is set as my blog page.

There's your answer. I should have picked up on it, but somehow didn't. Take a look at the Template Hierarchy. You're using the static page blog as your Blog Posts Index, Instead of using is_page( 'blog' ), you need to be using is_home(), which returns true when displaying the Blog Posts Index.

  • i forgot to mention that as home is set as my static page in the admin panel the blog page is set as my blog page. I do not have a blog.php template file only the index.php file /products and /blog both work as pages but the blog doesn't contain the custom header
    – Marques
    Commented Feb 23, 2012 at 19:49
  • There's your problem! See updated answer. Commented Feb 23, 2012 at 19:56
  • wow great thanks! I will definitely look over the template hierarchy and continue learning but im making strides!
    – Marques
    Commented Feb 23, 2012 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.