I want to display a different layout according to the particular post’s category so I would edit “single.php” as follows:
$post = $wp_query->post;
if ( in_category('2') ) {
include(TEMPLATEPATH . '/single-blog.php'); }
elseif ( in_category('15') ) {
include(TEMPLATEPATH . '/single-photography.php'); }
elseif ( in_category('18') ) {
include(TEMPLATEPATH . '/single-video.php'); }
else {
include(TEMPLATEPATH . '/single-default.php');
}
?>
Comments
Post a Comment