Title: Conditional Statement for a Specific Category post
Last modified: August 18, 2016

---

# Conditional Statement for a Specific Category post

 *  Resolved [Ryan Fitzer](https://wordpress.org/support/users/ryanfitzer/)
 * (@ryanfitzer)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/conditional-statement-for-a-specific-category-post/)
 * I’ve read the conditional statements page in the codex but couldn’t find what
   I’m looking for. I want to display a specific sidebar when viewing a single post
   in a specific category. Something like
 * `if_post(cat=1);
    include(TEMPLATEPATH.'/sidebar-exhibitions.php'); elseif_post(
   cat=2) include(TEMPLATEPATH.'/sidebar-news.php');
 * kinda deal that I can stick into my single.php. Any ideas?

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/conditional-statement-for-a-specific-category-post/#post-408542)
 * Try this:
    [http://codex.wordpress.org/Template_Tags/in_category](http://codex.wordpress.org/Template_Tags/in_category)
 *  Thread Starter [Ryan Fitzer](https://wordpress.org/support/users/ryanfitzer/)
 * (@ryanfitzer)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/conditional-statement-for-a-specific-category-post/#post-408595)
 * Thanks so much! That was what I needed.

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

The topic ‘Conditional Statement for a Specific Category post’ is closed to new 
replies.

 * 2 replies
 * 2 participants
 * Last reply from: [Ryan Fitzer](https://wordpress.org/support/users/ryanfitzer/)
 * Last activity: [19 years, 11 months ago](https://wordpress.org/support/topic/conditional-statement-for-a-specific-category-post/#post-408595)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
