Alternate WordPres Single.php

Webmaster WordPress Leave a Comment

Alternate single post template for posts in specific categories.

Here’s the simplest way to use alternative single post templates for all post in specific categories.

Add this code to the top of the single.php template. Edit the category number and template path to match your alternative template location and the category it’s intended for.

$post = $wp_query->post;
if (in_category(4)) {
include (TEMPLATEPATH.'/example.php');
} if (in_category(73)) {
include (TEMPLATEPATH.'/example1.php');
} if (in_category(12)) {
include (TEMPLATEPATH.'/example2.php');
}  if (in_category(5)) {
include (TEMPLATEPATH.'/example3.php');

Leave a Reply

Your email address will not be published. Required fields are marked *