Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dexit/89e26cb673992d43d3f847624bbed8f9 to your computer and use it in GitHub Desktop.
Save dexit/89e26cb673992d43d3f847624bbed8f9 to your computer and use it in GitHub Desktop.
Used in theme functions.php - set Elementor Library post type to use built-in Canvas template by default
/* ---------------------------------------------------------------------------
* Force Elementor Library to use Canvas Template
* - this gist file name can also be used in your theme to override the template instead of this
* --------------------------------------------------------------------------- */
function get_elementor_library_post_type_template( $single_template ) {
global $post;
if ($post->post_type == 'elementor_library') {
$single_template = WP_PLUGIN_DIR . '/elementor/includes/page-templates/canvas.php';
}
return $single_template;
}
add_filter( 'single_template', 'get_elementor_library_post_type_template' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment