Forked from Tmeister/elementor-custom-templates.php
Created
December 7, 2017 12:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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