Title: Posts in multiple Categories different single.php
Last modified: August 20, 2016

---

# Posts in multiple Categories different single.php

 *  [_OMEGA_](https://wordpress.org/support/users/_omega_/)
 * (@_omega_)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/posts-in-multiple-categories-different-singlephp/)
 * Hi all, I am smashing my head against some code.
    Here is the situation: I have
   one post in 3 different categories, this post has to be visible in “category 
   1” with the single1.php, in “category 2” with single2.php and in “category 3”
   with single3.php.
 * Obviously the 3 single.php page have a different template inside.
    For example
   the single1.php shows pictures and the_content(); single2.php shows pictures 
   and comments; single3.php shows the reviews.
 * I know that in single.php I can use the if/else but I cannot figure out if the
   same post is in 3 different categories.
 * Any help please?

Viewing 1 replies (of 1 total)

 *  [Chris](https://wordpress.org/support/users/dobeweb/)
 * (@dobeweb)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/posts-in-multiple-categories-different-singlephp/#post-3131861)
 *     ```
       <?php
       if ( in_category( array ('1', '2' ) ) ) {
       	include 'single-1.php';
       } elseif ( in_category( array ('3','4','5') ) ) {
       	include 'single-2.php';
       } else {
       	include 'single-3.php';
       }
       ?>
       ```
   
 * Copy this to the single.php and replace all the code in the single.php

Viewing 1 replies (of 1 total)

The topic ‘Posts in multiple Categories different single.php’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)

 * 1 reply
 * 2 participants
 * Last reply from: [Chris](https://wordpress.org/support/users/dobeweb/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/posts-in-multiple-categories-different-singlephp/#post-3131861)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
