Set a template on a custom post in the plugin

I looked at some answers and didn’t help

I’m trying the next section (right away) but it returns the template if errors in WordPress’s built-in function lines. Like get_header ()

add_filter(‘template_include’, ‘my_custom_template’);

function my_custom_template($single) {

global $post;

/* Checks for single template by post type */
if ( $post->post_type == ‘simulators’ ) {
return SIMULATOR_URI . ‘inc/themes/admin/single-simulators.php’;
}

return $single;

}

Basically, the template is already listed in WordPress templates, is there an easy way to set it as a custom post template?

Read more here:: Set a template on a custom post in the plugin

Leave a Reply

Your email address will not be published. Required fields are marked *