• Resolved satnapar

    (@satnapar)


    Hik there, is there any possibility to chose default template for a certain custom post type?

Viewing 1 replies (of 1 total)
  • Plugin Author Nikhil Chavan

    (@nikschavan)

    Hello @satnapar,

    
    add_filter( 'template_include', 'default_templatte_post_type', 999 );
    
    function default_templatte_post_type( $original ) {
    	$file = FPT_DIR . 'templates/default/template-page-builder-no-header-footer.php';
    
    	// Just to be safe, we check if the file exist first
    	if ( file_exists( $file ) && 'property' == get_post_type() ) {
    		return $file;
    	}
    
    	return $original;
    }
    

    Change property to slug of your post type from above snippet.
    Here is a doc which explains how you can add custom PHP code your site – https://wpastra.com/docs/add-custom-php-code/

    • This reply was modified 6 years, 6 months ago by Nikhil Chavan.
Viewing 1 replies (of 1 total)
  • The topic ‘Default setting for custom post type’ is closed to new replies.