0

Currently I've divided posts into 5 different categories, based on the categories I've created 5 page templates. all of the pages are listed into the home page navigation menu. in my home page I'm showing 5 posts in five different categories. when they clicked a post that post will shown in the single page template(that's what word press normally does) but i want to show that post into my page template. because each page template having different designs. if there is any way to set the permalink to point to the page template and show the post in to full.

0

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' ) )
{
    // ...
}
  • 1
    its working fine. You saved me lot of time. thanks – Aroor Jul 30 '12 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.