Title: Adding Custom Header &#8211; index.php not recognizing is_page()
Last modified: August 19, 2016

---

# Adding Custom Header – index.php not recognizing is_page()

 *  [wyndom](https://wordpress.org/support/users/wyndom/)
 * (@wyndom)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/)
 * 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)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/#post-1953400)
 * [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 *  Thread Starter [wyndom](https://wordpress.org/support/users/wyndom/)
 * (@wyndom)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/#post-1953406)
 * I was able to get is_home() to work, but still that doesn’t explain why my index.
   php page / ‘blog’ ignores is_page(#).
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/#post-1953407)
 * Try using `is_front_page()`.
 *  Thread Starter [wyndom](https://wordpress.org/support/users/wyndom/)
 * (@wyndom)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/#post-1953408)
 * I tested is_front_page and is_home at the same time, only is_home worked. Like
   I said though that still doesn’t explain why is_page is getting ignored.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/#post-1953415)
 * Are you using a static front page? Did you read the documentation on is_home()
   and is_front_page()?

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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/adding-custom-header-indexphp-not-recognizing-is_page/#post-1953415)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
