Skip to content

Instantly share code, notes, and snippets.

@Frisoni
Created December 16, 2020 15:51
Show Gist options
  • Save Frisoni/507712bb8cb8c575f70b625140be458f to your computer and use it in GitHub Desktop.
Save Frisoni/507712bb8cb8c575f70b625140be458f to your computer and use it in GitHub Desktop.
Change default template from post to page in Flatsome
// Change default template from post to page in Flatsome
add_filter( 'template_include',function ( $template ) {
// CPTs
$cpts = array( 'cpt_name');
if ( is_singular( $cpts ) ) {
// change the default-page-template.php to your template name
$default_template = locate_template( array( 'page.php' ) );
if ( '' != $default_template ) {
return $default_template ;
}
}
return $template;
}, 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment