Title: Custom template for specific posts
Last modified: August 19, 2016

---

# Custom template for specific posts

 *  [paradigm13](https://wordpress.org/support/users/paradigm13/)
 * (@paradigm13)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/custom-template-for-specific-posts/)
 * Hello,
 * I’m using this code in single.php so so i can have custom templates under each
   category:
 * <?php
    $post = $wp_query->post; if ( in_category(‘3’) ) { include(TEMPLATEPATH.‘/
   single3.php’); } elseif ( in_category(‘227’) ) { include(TEMPLATEPATH . ‘/single227.
   php’); } else { include(TEMPLATEPATH . ‘/single1.php’); } ?>
 * Now, i would like that all the posts wich have the word “green” in their post
   title under a specific category ( category 227 ) have single227green.php as custom
   template.
 * I think i should use the strpos php code but i don’t know how to.
 * Thanks for your help

Viewing 1 replies (of 1 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/custom-template-for-specific-posts/#post-1371381)
 * Not exactly what you want but useful for an example:
 * [http://wordpress.org/support/topic/358778?replies=1](http://wordpress.org/support/topic/358778?replies=1)
 * Related plugins:
    [http://wordpress.org/extend/plugins/single-post-template/](http://wordpress.org/extend/plugins/single-post-template/)
   [http://wordpress.org/extend/plugins/custom-post-template/](http://wordpress.org/extend/plugins/custom-post-template/)

Viewing 1 replies (of 1 total)

The topic ‘Custom template for specific posts’ is closed to new replies.

## Tags

 * [custom-template](https://wordpress.org/support/topic-tag/custom-template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/custom-template-for-specific-posts/#post-1371381)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
