Our host updated PHP and caused some of our stuff to not work. I understand create_function isnt valid any longer but I am having a hard time converting this. Can someone please help?
add_filter('single_post_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;' )
);
2
Answers
You just need to create an anonymous function instead:
Try the following steps:
In WordPress, replace create_function() with an Anonymous function as below:
For more details about create_function(), go to this link