WORDPRESS: MORE THEN ONE POST (SINGLE.PHP) BASED ON CATEGORY

Click to rate this post!
[Total: 1 Average: 4]

WordPress is a powerful CMS. It becomes more powerful if php code can be integrate in a way to work with plug-ins and themes. In this post I describe a way to open multiple single.php files based on category

Inside the theme (it is better to create a child before) the file single.php has to be replaced:

$post = $wp_query->post;
if ( in_category('238') ) {include(TEMPLATEPATH . '-child/single_tv_channel.php');}
else {include(TEMPLATEPATH . '-child/single_posts.php');}

238 is the ID of a particular category. This number can be changed.
The file single_posts.php is the old single.php file renamed
and single_tv_channel.php has to be created with the php code (and jQuery). This file can be executed only from the category 238

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x