Single Post Template based on Category
-
I want to have a different single post template for two of my categories, and despite trying different plugins and code solutions, I am still not getting it to work. The solution I would like to use is one similar to the following (which I found in multiple places as the a working solution) but it’s not working for me. It always shows what ever template is denoted after the “else” line and seems to completely ignore the first two. Here is the full code I have in my single.php file
<?php $post = $wp_query->post; if (in_category('3')) { include(TEMPLATEPATH.'/single-projects.php'); } elseif (in_category('5')) { include(TEMPLATEPATH.'/single-inspiration.php'); } else { include(TEMPLATEPATH.'/single_default.php'); } ?>I’m hoping someone can help. I feel like it shouldn’t be this difficult, but I am stumped.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Single Post Template based on Category’ is closed to new replies.