• Here is a small bit of code I am using to add custom header to my pages.

    if (is_page(2)) { // about us
            ?><img src="http://mysite.com/site/wp-content/themes/twentyten/images/headers/AboutUs.jpg" /><?php
        } else if (is_page(79) || is_page(226) || is_page(222)) { // generic pages
            ?><img src="http://mysite.com/site/wp-content/themes/twentyten/images/headers/Generic.jpg" /><?php
        } else if (is_page(323) || is_page(7)) { // blog
            ?><img src="http://mysite.com/site/wp-content/themes/twentyten/images/headers/Blog.jpg" /><?php
    	}

    I am able to have all of the pages load the image I am trying except index.php or the blog page. If I use
    print the_ID();
    on index it prints 323. 7 is the page id that I got from the dashboard.
    I know its not the image, that will load on other pages.
    I know its not the id, because I am using the_ID() successfully on other pages.
    And when I added a catch all ‘else’ to the above code, it would display the image on the blog page.

    So I’m very confused as to why print the_ID works on every page, but using is_page does not work on index.php/my blog

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding Custom Header – index.php not recognizing is_page()’ is closed to new replies.