Mostrar diferente template single.php por slug
Añadir a funcitions:
function get_category_post_template($single_template) {
global $post;
$categories = get_the_category($post->ID) ;
foreach ( $categories as $cat) {
if (file_exists( dirname( __FILE__ ) . "/single-{$cat->slug}.php" ) )
$single_template = dirname( __FILE__ ) . "/single-{$cat->slug}.php" ;
}
return $single_template;
}
add_filter( "single_template", "get_category_post_template" ) ;
function get_category_post_template($single_template) {
global $post;
$categories = get_the_category($post->ID) ;
foreach ( $categories as $cat) {
if (file_exists( dirname( __FILE__ ) . "/single-{$cat->slug}.php" ) )
$single_template = dirname( __FILE__ ) . "/single-{$cat->slug}.php" ;
}
return $single_template;
}
add_filter( "single_template", "get_category_post_template" ) ;