I have implemented inside my plugin this hook to change the single template for custom post type (I do not want it to be in child theme just in my plugin) - It works just fine. Now I want to implement content-single.php inside my plugin. How can it be done? this is the code that implement the custom template inside the plugin:
//Template fallback
function get_custom_post_type_template($single_template) {
global $post;
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' );
Aucun commentaire:
Enregistrer un commentaire