How to show Specific category post detail with specific template in wordpress.


Open your single.php in a editor and paste the following code.Update the category according to your desire category in in_category() function and include your desire template.

post;
  if (in_category(array('articles-1','articles-2'))) {
      include(TEMPLATEPATH.'/article-detail.php');
  } elseif (in_category(array('blog-1','blog-2'))) {
      include(TEMPLATEPATH.'/blog-detail.php');
  } else{
      include(TEMPLATEPATH.'/single-backup.php');
  }
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s