Actually I left out some code in the filter that was preventing Sage from correctly loading templates. Here’s the corrected version:
add_filter('template_include', function ($template) {
global $post;
if(isset($post) && is_a($post, 'WP_Post') && $post->post_type == \MeprProduct::$cpt) {
$default_template = locate_template( array( 'template-custom.blade.php' ) );
if ( '' != $default_template
&& '' == $post->page_template // Only when page_template is not set
){
//return $default_template;
$template = $default_template;
}
}
return $template;
}, 99);