code for single post templates
-
I am looking for a way to have ‘templates’ for my single.php based on the category. I went here:
and got this code:
<?php $post = $wp_query- >post; if ( in_category('1') ) { include(TEMPLATEPATH . '/single1.php'); } elseif ( in_category('2') ) { include(TEMPLATEPATH . '/single2.php'); } else { include(TEMPLATEPATH . '/single_other.php'); } ?>
Now, it says to put the code into single.php and create the new single1.php and single2.php. I tried replacing all of the code in single.php with the code above (i guess thats what I am supposed to do with it?) and then I try and view a single post nothing works…I get a blank white screen.
Does anyone know how I am supposed to implement this so that it will work?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘code for single post templates’ is closed to new replies.