bainternet
12/7/2017 - 12:29 PM

You can show *your* page templates in the predesigned templates area with screenshots

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' );