Post your trick

Wordpress – different single.php for different categories

if you have a category called photos and another category called videos , you need to format the single.php differently for each category . this is easy and you can just write the following code in single.php :
if ( in_category(’2′) ) {
include(TEMPLATEPATH . ‘/single-kodetricks.php’);
}
else
include(TEMPLATEPATH . ‘/single-blog.php’);


Leave a Reply

     

     

     

Post A Trick !

How does "Kodetricks" work?

We at kodeplay like to share knowledge. With Kodetricks, even you can join us. All you need to do is post a programming related trick if you have one or rate a trick if you like someone else's.



Find us on

Technology

Contact Us