Skip to content
jQuery PHP WordPress

WordPress: More Then One Post (Single.php) Based on Category

Questo articolo per ora è disponibile solo in inglese. La versione italiana è in preparazione.

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

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x