If you want to display single post page using different single post template, then wordpress in_category() function will help to create different single post template.
First thing you have to create different single post template like
single_portfolio.php single_news.php single_wordpress.php single_default.php //For default single post template for post other than above categories.
Above three files i create because i want to use different single post page template for my portfolio,news and wordpress category respectively.
You can simply create copy of your single.php file and rename it with new template and do the changes that you want for each category.
After that open your single.php file remove all code and add following code
<?php
$post = $wp_query->post;
if (in_category('portfolio')) {
include(TEMPLATEPATH.'/single_portfolio.php');
} elseif (in_category('news')) {
include(TEMPLATEPATH.'/single_news.php');
} elseif(in_category('wordpress')) {
include(TEMPLATEPATH.'/single_wordpress.php');
}
else{
include(TEMPLATEPATH.'/single_default.php');
}
?>








January 14th, 2009













Leave a Comment