
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





Welcome to the page on “WordPress: More Then One Post (Single.php) Based on Category”. I wrote it for engineering students: if a step does not add up, an exercise gives you a different result or you would like more material on the topic, just ask in the comments and I will reply. A star rating above helps me understand which pages to improve.