Skip to main content
added 5 characters in body
Source Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459

You could hook into template_include and return your plugin file if the request is for your post type:

add_filter( 'template_include', 'insert_my_template' );

function insert_my_template( $template )
{
    if ( 'my_post_type' === get_post_type() )
        return dirname( __FILE__ ) . '/template.php';

    return $template;
}

But this will change the look drastically. There is still no clean solution.

You could into template_include and return your plugin file if the request is for your post type:

add_filter( 'template_include', 'insert_my_template' );

function insert_my_template( $template )
{
    if ( 'my_post_type' === get_post_type() )
        return dirname( __FILE__ ) . '/template.php';

    return $template;
}

But this will change the look drastically. There is still no clean solution.

You could hook into template_include and return your plugin file if the request is for your post type:

add_filter( 'template_include', 'insert_my_template' );

function insert_my_template( $template )
{
    if ( 'my_post_type' === get_post_type() )
        return dirname( __FILE__ ) . '/template.php';

    return $template;
}

But this will change the look drastically. There is still no clean solution.

Source Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459

You could into template_include and return your plugin file if the request is for your post type:

add_filter( 'template_include', 'insert_my_template' );

function insert_my_template( $template )
{
    if ( 'my_post_type' === get_post_type() )
        return dirname( __FILE__ ) . '/template.php';

    return $template;
}

But this will change the look drastically. There is still no clean solution.