Title: IF boolean: post or page?
Last modified: August 19, 2016

---

# IF boolean: post or page?

 *  [Grapho](https://wordpress.org/support/users/grapho/)
 * (@grapho)
 * [18 years ago](https://wordpress.org/support/topic/if-boolean-post-or-page/)
 * Creating a custom sidebar page for a theme. I want to create an if statement,
   that will return whether an entry that is being displayed is a page or a post.
 * if its a post, it will use the WordPress widgets in the sidebar.
    elseif its 
   a page, it will use a customized sidebar.
 * The question is: how do I correctly state the “IF post/page”?

Viewing 1 replies (of 1 total)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years ago](https://wordpress.org/support/topic/if-boolean-post-or-page/#post-752861)
 * There is solution for that, too… but since in any well done theme there is a 
   page.php (default Page template) and a single.php (default single post view template)–
   you don’t even need a conditional: just call different sidebars in the templates.
   
   Some good resources: [Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
   [Conditional_Tags](http://codex.wordpress.org/Conditional_Tags) Non-standard 
   template files should be used with this: [Include_Tags#Including_Any_Template](http://codex.wordpress.org/Include_Tags#Including_Any_Template)

Viewing 1 replies (of 1 total)

The topic ‘IF boolean: post or page?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [moshu](https://wordpress.org/support/users/moshu/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/if-boolean-post-or-page/#post-752861)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
