Use custom css-file with single post template based on category
-
I’m using the code below to to create custom templates for single post categories. Now I want to use a specific css-file, but how do I call that to this.
Thanks//Gets post cat slug and looks for single-[cat slug].php and applies it add_filter('single_template', create_function( '$the_template', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php"; } return $the_template;' ) );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Use custom css-file with single post template based on category’ is closed to new replies.