Skip to content

Instantly share code, notes, and snippets.

@pingram3541
Last active February 21, 2018 18:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pingram3541/f77885bfde845d738d51b5aad0c5c553 to your computer and use it in GitHub Desktop.
Save pingram3541/f77885bfde845d738d51b5aad0c5c553 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' );
@pingram3541
Copy link
Author

Updated to use dynamic plugin path vs hard coded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment