Site icon Hip-Hop Website Design and Development

Content material-single.php inside my plugin

I’ve carried out inside my plugin this hook to alter the only template for {custom} submit kind (I are not looking for it to be within the baby theme, simply in my plugin) and it really works simply effective.

Now I need to implement content-single.php inside my plugin. How can it’s performed? That is the code that implements the {custom} template contained in the plugin:

//Template fallback
operate get_custom_post_type_template($single_template) {
    world $submit;
    if ($post->post_type == 'my-custom-post-type') {
        $single_template = dirname( __FILE__ ) . '/single-my-custom-post-type.php';
    }
    return $single_template;
}
add_filter( 'single_template', 'my-custom-post-type' );