Reply To: Making custom post type looking as normal single post (first)

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)

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)

#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 5 years ago by Georg.