Title: is_page function
Last modified: August 22, 2016

---

# is_page function

 *  [elitut](https://wordpress.org/support/users/elitut/)
 * (@elitut)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/)
 * i have few sub pages under the main page.
    i want a function like “is_page”, 
   but even if its a sub page of the main page, it will return true.
 * for example, the main page id is 1, and there are 2 sub pages – 2 and 3.
 * function(1);
    that should return true cuz its a sub page of 1, even if its page
   2 or 3.
 * is there a function like that?
 * thanks for helping.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [janet4now](https://wordpress.org/support/users/janet4now/)
 * (@janet4now)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168486)
 * [http://codex.wordpress.org/Function_Reference/is_page](http://codex.wordpress.org/Function_Reference/is_page)
 * There are examples of calling in child pages.
 * What is it specifically you are trying to do? Create a submenu or something else?
 *  Thread Starter [elitut](https://wordpress.org/support/users/elitut/)
 * (@elitut)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168651)
 * hi janet,
    ive tired to use the Snippet 3 options there, and it doesnt work.
 * i use it like that:
 *     ```
       if ( is_page( 12 ) == $post->post_parent ) {
       ```
   
 *  [janet4now](https://wordpress.org/support/users/janet4now/)
 * (@janet4now)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168652)
 * Can you tell me what you’re trying to do specifically? Not in code, but the results
   you’re wanting to achieve. Maybe a link to your site would help with your description.
 *  Thread Starter [elitut](https://wordpress.org/support/users/elitut/)
 * (@elitut)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168653)
 * i want to display something on the sidebar in page id 12 and all of his sub pages.
 * thanks for helping.
 *  [janet4now](https://wordpress.org/support/users/janet4now/)
 * (@janet4now)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168655)
 * there is a plugin that does this real easy.
 * [http://wordpress.org/plugins/jetpack-widget-visibility/](http://wordpress.org/plugins/jetpack-widget-visibility/)
 * or you can try this. you’ll have to modify the functions.php file and your sidebar.
   php files.
 * [http://bavotasan.com/2009/check-if-a-page-is-a-child-of-another-page-in-wordpress/](http://bavotasan.com/2009/check-if-a-page-is-a-child-of-another-page-in-wordpress/)
 *  Thread Starter [elitut](https://wordpress.org/support/users/elitut/)
 * (@elitut)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168656)
 * it works! thank you so much.
    i used the second option that u gave me.
 * thanks.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘is_page function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [elitut](https://wordpress.org/support/users/elitut/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/is_page-function/#post-5168656)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
