Home › Forums › Support › Making custom post type looking as normal single post (first) › Reply To: Making custom post type looking as normal single post (first)
May 29, 2016 at 7:54 am
#197642
Georg
Hi,
with this code in my child them folder’s function.php now i’ve got the solution for me:
//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(STYLESHEETPATH . "/single-{$cat->slug}.php") )
return STYLESHEETPATH . "/single-{$cat->slug}.php"; }
return $the_template;' )
);
Thanks
Georg
- This reply was modified 7 years, 10 months ago by Georg.