Title: Multiple single-post templates
Last modified: August 18, 2016

---

# Multiple single-post templates

 *  [thinkeric](https://wordpress.org/support/users/thinkeric/)
 * (@thinkeric)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/multiple-single-post-templates/)
 * Spent the better part of the afternoon trying to figure this out, and I surrender!
   Here’s my quandry:
 * What I would like to do is have multiple ways to display a single post, depending
   on what category the post falls into. For example, a blog entry with lots of 
   text would have a different layout than a blog entry with a single photo. Setting
   up two different categories is not the problem… it’s the fact that they appear
   to use the same single.php file.
 * I’m just not finding what I’m looking for in any of the documentation, so if 
   someone can point me in the right direction, I would be most appreciative.

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/multiple-single-post-templates/#post-164600)
 * [http://codex.wordpress.org/Category_Templates](http://codex.wordpress.org/Category_Templates)
 *  [Michael Adams (mdawaffe)](https://wordpress.org/support/users/mdawaffe/)
 * (@mdawaffe)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/multiple-single-post-templates/#post-164605)
 * [http://codex.wordpress.org/Template_Tags/in_category](http://codex.wordpress.org/Template_Tags/in_category)
 * The page isn’t complete at the moment, but that’s the tag you’ll want.
 * `if (in_category('2')) {
    // if the post is in category 2, do one thing } elseif(
   in_category('3')) { // if the post is in category 3 (but not 2), do another thing}
   else { // if the post in neither category 2 nor 3, do something else }
 * You could either write out all the code in the one file, or just have a very 
   brief `single.php` where the only things in those if statements are PHP [includes](http://codex.wordpress.org/Include_Tags#Including_Any_Template)
 * It’s also possible to write a plugin that does all of this for you, but I don’t
   know of one yet.

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

The topic ‘Multiple single-post templates’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [Michael Adams (mdawaffe)](https://wordpress.org/support/users/mdawaffe/)
 * Last activity: [21 years, 3 months ago](https://wordpress.org/support/topic/multiple-single-post-templates/#post-164605)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
