/ Published in: PHP

This will let you define individual templates for posts within specific categories. Simply name your post file like: single-SLUG.php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
add_filter('single_template', create_function('$t', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php"; } return $t;' ));
URL: http://www.nathanrice.net/blog/wordpress-single-post-templates/
Comments
