Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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' ) )
{
    // ...
}
share|improve this answer
1  
its working fine. You saved me lot of time. thanks –  Aroor Jul 30 '12 at 10:48
    
@Aroor You're welcome! :) –  kaiser Jul 30 '12 at 11:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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