PluginProbe ʕ •ᴥ•ʔ
ECS – Ele Custom Skin for Elementor / 4.3.6
ECS – Ele Custom Skin for Elementor v4.3.6
4.3.6 4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.11 4.1.10 4.1.9 4.1.8 4.1.6 4.1.7 4.1.5 4.1.4 4.1.1 4.1.2 trunk 1.0.0 1.0.1 1.0.9 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.4 1.2.5 1.3.10 1.3.11 1.3.3 1.3.4 1.3.6 1.3.7 1.3.9 1.4.0 2.0.2 2.1.0 2.2.0 2.2.1 2.2.2 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 4.1.0
ele-custom-skin / theme-builder / init.php
ele-custom-skin / theme-builder Last commit date
classes 6 years ago conditions 5 years ago documents 2 months ago dynamic-tags 4 years ago init.php 2 months ago
init.php
108 lines
1 <?php
2
3 require_once ELECS_DIR.'theme-builder/conditions/loop.php';
4 require_once ELECS_DIR.'theme-builder/documents/loop.php';
5 require_once ELECS_DIR.'theme-builder/conditions/custom-grid.php';
6 require_once ELECS_DIR.'theme-builder/documents/custom-grid.php';
7 require_once ELECS_DIR.'theme-builder/dynamic-tags/ele-tags.php';
8 //add new tags
9 $newtags=new ElementorPro\Modules\DynamicTags\Eletags();
10 $newtags::instance();
11 //require_once ELECS_DIR.'theme-builder/classes/custom-types-manager.php';
12
13 use Elementor\TemplateLibrary\Source_Local;
14 use ElementorPro\Modules\ThemeBuilder\Documents\Loop;
15 use ElementorPro\Plugin;
16 use ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document;
17 use Elementor\Core\Documents_Manager;
18 use ElementorPro\Modules\ThemeBuilder\Classes\Locations_Manager;
19
20
21 Plugin::elementor()->documents->register_document_type( 'loop', Loop::get_class_full_name() );
22 Source_Local::add_template_type( 'loop' );
23 //fix for EPro 3.6 when woocommerce is active
24 Plugin::elementor()->documents->register_document_type( 'custom_grid', customGrid::get_class_full_name() );
25 Source_Local::add_template_type( 'custom_grid' );
26
27 function elecs_get_document( $post_id ) {
28 $document = null;
29
30 try {
31 $document = Plugin::elementor()->documents->get( $post_id );
32 } catch ( \Exception $e ) {}
33
34 if ( ! empty( $document ) && ! $document instanceof Theme_Document ) {
35 $document = null;
36 }
37
38 return $document;
39 }
40
41 function elecs_add_more_types($settings){
42 $post_id = get_the_ID();
43 $document = elecs_get_document( $post_id );
44
45 if ( ! $document || !array_key_exists('theme_builder', $settings)) {
46 return $settings;
47 }
48
49 $new_types=['loop'=>Loop::get_properties()];
50 $add_settings=['theme_builder' => ['types' =>$new_types]];
51 if (!array_key_exists('loop', $settings['theme_builder']['types'])) $settings = array_merge_recursive($settings, $add_settings);
52 return $settings;
53 }
54
55 add_filter( 'elementor_pro/editor/localize_settings', 'elecs_add_more_types' );
56
57
58 function elecs_register_elementor_locations( $elementor_theme_manager ) {
59
60 $elementor_theme_manager->register_location(
61 'loop',
62 [
63 'label' => __( 'Loop', 'ele-custom-skin' ),
64 'multiple' => true,
65 'edit_in_content' => true,
66 ]
67 );
68
69 }
70 add_action( 'elementor/theme/register_locations', 'elecs_register_elementor_locations' );
71
72 function elecs_enqueue_scripts($post){
73 $document = elecs_get_document( $post->get_post_id() );
74 //print_r($document->get_location());
75 if($document)
76 if('loop' == $document->get_location()){
77 wp_enqueue_script(
78 'ecs-preview',
79 ELECS_URL.'assets/js/ecs_preview.js',
80 array( 'jquery', 'elementor-frontend' ),
81 ELECS_VER,
82 true
83 );
84 }
85 }
86 add_action( 'elementor/preview/init', 'elecs_enqueue_scripts' );
87
88 /* register custom grid document */
89 function elecs_register_documents_grid( Documents_Manager $documents_manager ) {
90 $documents_manager->register_document_type( 'custom_grid', customGrid::get_class_full_name() );
91 }
92
93
94 add_action( 'elementor/documents/register', 'elecs_register_documents_grid' );
95
96 function elecs_register_location_grid( Locations_Manager $location_manager ) {
97 $location_manager->register_location(
98 'custom_grid',
99 [
100 'label' => __( 'Custom Grid', 'ele-custom-skin' ),
101 'multiple' => true,
102 'edit_in_content' => true,
103 ]
104 );
105 }
106
107 //add_action( 'elementor/theme/register_locations', 'elecs_register_location_grid' );//not working from EPro 3.6
108