Elementor Custom Skin - Version 1.0.9

Version Description

  • Fixed issue with preview template in editor mode
Download this release

Release Info

Developer dudaster
Plugin Icon 128x128 Elementor Custom Skin
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.9

ele-custom-skin.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /*
3
  * Plugin Name: Ele Custom Skin
4
- * Version: 1.0.1
5
- * Description: Elementor Custom Skin for Posts and Posts Archive. You can create a skin as you want.
6
  * Plugin URI: https://www.eletemplator.com
7
  * Author: Liviu Duda
8
  * Author URI: https://www.leadpro.ro
1
  <?php
2
  /*
3
  * Plugin Name: Ele Custom Skin
4
+ * Version: 1.0.9
5
+ * Description: Elementor Custom Skin for Posts and Archive Posts. You can create a skin as you want.
6
  * Plugin URI: https://www.eletemplator.com
7
  * Author: Liviu Duda
8
  * Author URI: https://www.leadpro.ro
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
  === Elementor Custom Skin ===
2
  Contributors: dudaster
3
- Tags: page-builder, elementor
 
4
  Requires at least: 4.6
5
- Tested up to: 4.9.1
6
- Stable tag: 1.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -13,7 +14,15 @@ Create new skins for Elementor PRO 2.x page builder. Design your own skins for P
13
 
14
  This plugin adds new skin to Elementor Page Builder Posts and Posts Archive widget.
15
 
16
- You can design a loop item just like a single template and it would be used as a skin.
 
 
 
 
 
 
 
 
17
 
18
  For more details and demo check our official site https://www.eletemplator.com/
19
 
@@ -27,11 +36,19 @@ Note: This plugin is an addon of Elementor Page Builder (https://wordpress.org/p
27
 
28
  == Frequently Asked Questions ==
29
 
30
- = Where can i find the new Loop Type =
 
 
 
 
 
 
 
 
31
 
32
  The Loop Type would appear in My Templates in Elementor as new type
33
 
34
- = How can I choose the new Custom Skin =
35
 
36
  Add to your template a Post or Post Archive widget and from Skins select Custom Skin
37
 
@@ -42,6 +59,31 @@ Add to your template a Post or Post Archive widget and from Skins select Custom
42
 
43
  == Changelog ==
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  = 1.0.1 =
46
  * Fixed issue with Archive Posts
47
 
1
  === Elementor Custom Skin ===
2
  Contributors: dudaster
3
+ Tags: page-builder, elementor, loop, archive list, post widget, skin, custom
4
+ Donate link: https://www.paypal.me/dudaster
5
  Requires at least: 4.6
6
+ Tested up to: 4.9.8
7
+ Stable tag: 1.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
 
15
  This plugin adds new skin to Elementor Page Builder Posts and Posts Archive widget.
16
 
17
+ You can design a loop item just like a single template and it would be used as a skin.
18
+
19
+ [youtube http://www.youtube.com/watch?v=NPkL7AesG-E]
20
+
21
+ Thanks to Avro for the video!
22
+
23
+ For a quick tutorial see Frequently Asked Questions!
24
+
25
+ Please let me know if a video tutorial is necessary, or if you already made one let me know so I can link to it.
26
 
27
  For more details and demo check our official site https://www.eletemplator.com/
28
 
36
 
37
  == Frequently Asked Questions ==
38
 
39
+ = How can I make and use a custom skin? =
40
+
41
+ 1. Create a new Elementor Template and select the Loop style;
42
+ 2. Drag dynamic widgets inside, like Post Title and Text field with dynamic content as Post Summary (wich comes with the module);
43
+ 3. Save the new Template;
44
+ 4. When you design a page or a Archive template in elementor use Posts Widget inside the page and from Skin (Classic/Cards) you'll see a new sking named Custom, select that!
45
+ 5. Voila!
46
+
47
+ = Where can i find the new Loop Type? =
48
 
49
  The Loop Type would appear in My Templates in Elementor as new type
50
 
51
+ = How can I choose the new Custom Skin? =
52
 
53
  Add to your template a Post or Post Archive widget and from Skins select Custom Skin
54
 
59
 
60
  == Changelog ==
61
 
62
+ = 1.0.9 =
63
+ * Fixed issue with preview template in editor mode
64
+
65
+ = 1.0.8 =
66
+ * Prevent unnecessary loop template loading (Edit with Elementor would look cleaner now)
67
+
68
+ = 1.0.7 =
69
+ * Fixed issue with 100% width
70
+
71
+ = 1.0.6 =
72
+ * Fixed notices issue in Wordpress debug mode
73
+ * Removed some unused skin controls from elementor editor
74
+
75
+ = 1.0.5 =
76
+ * Fixed issue with Elementor Pro 2.1.
77
+
78
+ = 1.0.4 =
79
+ * Added Eletheme support. Now you can use {{vars}}.
80
+
81
+ = 1.0.3 =
82
+ * Fixed skin templates query.
83
+
84
+ = 1.0.2 =
85
+ * Fixed some BUGS.
86
+
87
  = 1.0.1 =
88
  * Fixed issue with Archive Posts
89
 
skins/skin-custom.php CHANGED
@@ -12,7 +12,7 @@ use ElementorPro\Plugin;
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
- class Skin_Custom extends Skin_Base {
16
 
17
  private $template_cache=[];
18
  private $pid;
@@ -51,6 +51,17 @@ class Skin_Custom extends Skin_Base {
51
  'options' => $this->get_skin_template(),
52
  ]
53
  );
 
 
 
 
 
 
 
 
 
 
 
54
  parent::register_controls($widget);
55
 
56
  $this->remove_control( 'img_border_radius' );
@@ -59,6 +70,13 @@ class Skin_Custom extends Skin_Base {
59
  $this->remove_control( 'image_width' );
60
  $this->remove_control( 'show_title' );
61
  $this->remove_control( 'title_tag' );
 
 
 
 
 
 
 
62
 
63
 
64
  }
@@ -69,40 +87,22 @@ class Skin_Custom extends Skin_Base {
69
  private function get_skin_template(){
70
  global $wpdb;
71
  $templates = $wpdb->get_results(
72
- "SELECT $wpdb->term_relationships.object_id as ID, $wpdb->posts.post_title as post_title FROM $wpdb->term_relationships
73
- INNER JOIN $wpdb->terms ON
74
- $wpdb->term_relationships.term_taxonomy_id=$wpdb->terms.term_id AND $wpdb->terms.slug='loop'
75
- INNER JOIN $wpdb->posts ON
76
- $wpdb->term_relationships.object_id=$wpdb->posts.ID"
 
 
77
  );
78
  $options = [ '' => '' ];
79
  foreach ( $templates as $template ) {
80
  $options[ $template->ID ] = $template->post_title;
81
- $this->set_template($template->ID);//this is for termlisting we cache the templates
82
  }
83
  return $options;
84
  }
85
 
86
 
87
- protected function get_skin_template_sterge() {
88
- $this->is_in_templates();
89
- $menus = get_terms( array(
90
- 'taxonomy' => 'nav_menu',
91
- 'hide_empty' => false,
92
- ));
93
-
94
- $options = [ '' => '' ];
95
-
96
- foreach ( $menus as $menu ) {
97
- $options[ $menu->slug ] = $menu->name;
98
-
99
- }
100
-
101
- return $options;
102
- }
103
-
104
-
105
-
106
  public function render_amp() {
107
 
108
  }
@@ -110,7 +110,7 @@ class Skin_Custom extends Skin_Base {
110
  protected function set_template($skin){// this is for terms we don't need passid so we can actually add them in cache
111
 
112
  if (!$skin) return;
113
- if ($this->template_cache[$skin]) return $this->template_cache[$skin];
114
 
115
  $return = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $skin );
116
  $this->template_cache[$skin] = $return;
@@ -121,13 +121,7 @@ class Skin_Custom extends Skin_Base {
121
  $settings = $this->parent->get_settings();
122
  $this->pid=get_the_ID();//set the current id in private var usefull to passid
123
  if (!$this->get_instance_value( 'skin_template' )) return;
124
- //term listing stuff
125
- /*if($settings['eleplug_eloop_term']=="yes" && $settings['taxonomy']){ // not to mess up with the terms fang shui we choose to get the cache template
126
- if ($this->template_cache[$this->get_instance_value( 'skin_template' )]) return $this->template_cache[$this->get_instance_value( 'skin_template' )];
127
- }*/
128
-
129
  $return = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $this->get_instance_value( 'skin_template' ) );
130
- //$this->template_cache[$this->get_instance_value( 'skin_template' )] = $return;
131
  return $return;
132
  }
133
 
@@ -138,7 +132,13 @@ class Skin_Custom extends Skin_Base {
138
  }
139
  protected function render_post() {
140
  $this->render_post_header();
141
- if ($this->get_instance_value( 'skin_template' )) echo $this->get_template();
 
 
 
 
 
 
142
 
143
  else echo "Select a Loop template! If you don't have one go to Elementor &gt; My Templates.";
144
 
@@ -150,11 +150,31 @@ class Skin_Custom extends Skin_Base {
150
 
151
  }
152
 
153
- // Add a custom skin for the POST Archive widget
154
- add_action( 'elementor/widget/archive-posts/skins_init', function( $widget ) {
155
- $widget->add_skin( new Skin_Custom( $widget ) );
156
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  // Add a custom skin for the POSTS widget
158
- add_action( 'elementor/widget/posts/skins_init', function( $widget ) {
159
- $widget->add_skin( new Skin_Custom( $widget ) );
160
- } );
 
 
 
 
 
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
+ class Skin_Posts_ECS extends Skin_Base {
16
 
17
  private $template_cache=[];
18
  private $pid;
51
  'options' => $this->get_skin_template(),
52
  ]
53
  );
54
+
55
+ $this->add_control(//this would make use of 100% if width
56
+ 'view',
57
+ [
58
+ 'label' => __( 'View', 'elecustomskin' ),
59
+ 'type' => \Elementor\Controls_Manager::HIDDEN,
60
+ 'default' => 'top',
61
+ 'prefix_class' => 'elementor-posts--thumbnail-',
62
+ ]
63
+ );
64
+
65
  parent::register_controls($widget);
66
 
67
  $this->remove_control( 'img_border_radius' );
70
  $this->remove_control( 'image_width' );
71
  $this->remove_control( 'show_title' );
72
  $this->remove_control( 'title_tag' );
73
+ $this->remove_control( 'masonry' );
74
+ $this->remove_control( 'thumbnail' );
75
+ $this->remove_control( 'thumbnail_size' );
76
+ $this->remove_control( 'show_read_more' );
77
+ $this->remove_control( 'read_more_text' );
78
+ $this->remove_control( 'show_excerpt' );
79
+ $this->remove_control( 'excerpt_length' );
80
 
81
 
82
  }
87
  private function get_skin_template(){
88
  global $wpdb;
89
  $templates = $wpdb->get_results(
90
+ "SELECT $wpdb->term_relationships.object_id as ID, $wpdb->posts.post_title as post_title FROM $wpdb->term_relationships
91
+ INNER JOIN $wpdb->term_taxonomy ON
92
+ $wpdb->term_relationships.term_taxonomy_id=$wpdb->term_taxonomy.term_taxonomy_id
93
+ INNER JOIN $wpdb->terms ON
94
+ $wpdb->term_taxonomy.term_id=$wpdb->terms.term_id AND $wpdb->terms.slug='loop'
95
+ INNER JOIN $wpdb->posts ON
96
+ $wpdb->term_relationships.object_id=$wpdb->posts.ID"
97
  );
98
  $options = [ '' => '' ];
99
  foreach ( $templates as $template ) {
100
  $options[ $template->ID ] = $template->post_title;
 
101
  }
102
  return $options;
103
  }
104
 
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  public function render_amp() {
107
 
108
  }
110
  protected function set_template($skin){// this is for terms we don't need passid so we can actually add them in cache
111
 
112
  if (!$skin) return;
113
+ if (isset($this->template_cache[$skin])) return $this->template_cache[$skin];
114
 
115
  $return = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $skin );
116
  $this->template_cache[$skin] = $return;
121
  $settings = $this->parent->get_settings();
122
  $this->pid=get_the_ID();//set the current id in private var usefull to passid
123
  if (!$this->get_instance_value( 'skin_template' )) return;
 
 
 
 
 
124
  $return = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $this->get_instance_value( 'skin_template' ) );
 
125
  return $return;
126
  }
127
 
132
  }
133
  protected function render_post() {
134
  $this->render_post_header();
135
+ if ($this->get_instance_value( 'skin_template' )){
136
+ if (function_exists("parse_content")) {
137
+ global $post;
138
+ echo parse_content($this->get_template(),$post);
139
+ }
140
+ else echo $this->get_template();
141
+ }
142
 
143
  else echo "Select a Loop template! If you don't have one go to Elementor &gt; My Templates.";
144
 
150
 
151
  }
152
 
153
+
154
+ // it seems the same skin brakes if set to 2 widgets in the same time
155
+
156
+ class Skin_Archive_ECS extends Skin_Posts_ECS {
157
+
158
+ private $template_cache=[];
159
+ private $pid;
160
+
161
+
162
+
163
+ public function get_id() {
164
+ return 'archive_custom';
165
+ }
166
+
167
+ public function get_title() {
168
+ return __( 'Custom', 'elementor-pro' );
169
+ }
170
+ }
171
+
172
  // Add a custom skin for the POSTS widget
173
+ add_action( 'elementor/widget/posts/skins_init', function( $widget ) {
174
+ $widget->add_skin( new Skin_Posts_ECS( $widget ) );
175
+ } );
176
+ // Add a custom skin for the POST Archive widget
177
+ add_action( 'elementor/widget/archive-posts/skins_init', function( $widget ) {
178
+ $widget->add_skin( new Skin_Archive_ECS( $widget ) );
179
+ } );
180
+
theme-builder/init.php CHANGED
@@ -39,7 +39,7 @@ function elecs_add_more_types($settings){
39
 
40
  $new_types=['loop'=>Loop::get_properties()];
41
  $add_settings=['theme_builder' => ['types' =>$new_types]];
42
- $settings = array_merge_recursive($settings, $add_settings);
43
  return $settings;
44
  }
45
 
39
 
40
  $new_types=['loop'=>Loop::get_properties()];
41
  $add_settings=['theme_builder' => ['types' =>$new_types]];
42
+ if (!array_key_exists('loop', $settings['theme_builder']['types'])) $settings = array_merge_recursive($settings, $add_settings);
43
  return $settings;
44
  }
45