• I am using the following code in my custom post type:

    //force use of templates from plugin folder
    function mck_force_template( $template )
    {
        if( is_archive( 'organization' ) ) {
            $template = WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/archive-organizations.php';
    	}
    
    	if( is_singular( 'organization' ) ) {
            $template = WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/single-organizations.php';
    	}
    
        return $template;
    }
    add_filter( 'template_include', 'mck_force_template' );

    Why does it cause a conflict with Docs (create new doc page blank)? How can I change it so it doesn’t cause a conflict?

    https://ww.wp.xz.cn/plugins/buddypress-docs/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Include Templates Code for CPT Causes Conflict’ is closed to new replies.