How to show a post single post in page template

The »Template Hierarchy« doesn’t allow this per default.

Inside your single.php template, you can call load_template().

This will allow you to simply include the template you need, based on the in_category() conditional tag.

// inside single.php
if ( in_category( 'foo' ) )
{
    load_template( get_stylesheet_directory().'foo_template.php' );
} 
elseif ( in_category( 'bar' ) )
{
    load_template( get_stylesheet_directory().'bar_template.php' );
} 
elseif ( in_category( 'whatever' ) )
{
    // ...
}

Leave a Comment