Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bainternet/149bfc5d5b4d4ffd7f3fe7829c0db3db to your computer and use it in GitHub Desktop.
Save bainternet/149bfc5d5b4d4ffd7f3fe7829c0db3db to your computer and use it in GitHub Desktop.
You can show *your* page templates in the predesigned templates area with screenshots
<?php
/**
* Elementor get the local templates via a CPT query and use a filter to let us change the template data
* https://github.com/pojome/elementor/blob/master/includes/template-library/sources/local.php#L202
* In ouy theme or plugin we can hook that filter as follow
*
* This filter change the source only for the *page* template type to show it in the main tab
* @see https://cl.ly/1z2Y1n2x0K0F
**/
function custom_elementor_template_list( $template ) {
if ( 'page' === $template['type'] ) {
$template['source'] = 'remote';
$template['isPro'] = false;
}
return $template;
}
add_filter( 'elementor/template-library/get_template', 'custom_elementor_template_list' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment