Version Description
- Fixing padding issues with 1.4.6 update.
- Fixing no results issue.
- Added some hooks. Documentation will come later.
- Fixing dependecies issues on some instalations.
Download this release
Release Info
Developer | dudaster |
Plugin | Elementor Custom Skin |
Version | 1.3.7 |
Comparing to | |
See all releases |
Code changes from version 1.3.6 to 1.3.7
- ele-custom-skin.php +5 -3
- includes/ecs-dependencies.php +30 -6
- includes/ecs-notices.php +72 -0
- includes/enqueue-styles.php +4 -3
- readme.txt +11 -2
- skins/skin-custom.php +59 -4
ele-custom-skin.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Ele Custom Skin
|
4 |
-
* Version: 1.3.
|
5 |
* Description: Elementor Custom Skin for Posts and Archive Posts. You can create a skin as you want.
|
6 |
* Plugin URI: https://dudaster.com
|
7 |
* Author: Dudaster.com
|
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
18 |
define( 'ELECS_DIR', plugin_dir_path( __FILE__ ));
|
19 |
define( 'ELECS_NAME', plugin_basename( __FILE__ ));
|
20 |
define( 'ELECS_URL', plugin_dir_url( __FILE__ ));
|
21 |
-
define ('ELECS_VER','1.3.
|
22 |
|
23 |
include_once ELECS_DIR.'includes/ecs-notices.php';
|
24 |
include_once ELECS_DIR.'includes/ecs-dependencies.php';
|
@@ -47,8 +47,10 @@ if (ecs_dependencies()) {
|
|
47 |
// dynamic background fix
|
48 |
require_once ELECS_DIR.'includes/background-fix.php';
|
49 |
|
|
|
|
|
50 |
} else {
|
51 |
$notification = new Ecs_Notice(__( '<b>Ele Custom Skin</b> needs <b>Elementor</b> and <b>Elementor Pro</b> to work. Make sure you have them <b>both</b> installed.', 'ele-custom-skin' ));
|
52 |
$notification->set_type('error');
|
53 |
$notification->show();
|
54 |
-
}
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Ele Custom Skin
|
4 |
+
* Version: 1.3.7
|
5 |
* Description: Elementor Custom Skin for Posts and Archive Posts. You can create a skin as you want.
|
6 |
* Plugin URI: https://dudaster.com
|
7 |
* Author: Dudaster.com
|
18 |
define( 'ELECS_DIR', plugin_dir_path( __FILE__ ));
|
19 |
define( 'ELECS_NAME', plugin_basename( __FILE__ ));
|
20 |
define( 'ELECS_URL', plugin_dir_url( __FILE__ ));
|
21 |
+
define ('ELECS_VER','1.3.7');
|
22 |
|
23 |
include_once ELECS_DIR.'includes/ecs-notices.php';
|
24 |
include_once ELECS_DIR.'includes/ecs-dependencies.php';
|
47 |
// dynamic background fix
|
48 |
require_once ELECS_DIR.'includes/background-fix.php';
|
49 |
|
50 |
+
add_action('init', 'ecs_check_for_notification');
|
51 |
+
|
52 |
} else {
|
53 |
$notification = new Ecs_Notice(__( '<b>Ele Custom Skin</b> needs <b>Elementor</b> and <b>Elementor Pro</b> to work. Make sure you have them <b>both</b> installed.', 'ele-custom-skin' ));
|
54 |
$notification->set_type('error');
|
55 |
$notification->show();
|
56 |
+
}
|
includes/ecs-dependencies.php
CHANGED
@@ -4,7 +4,28 @@
|
|
4 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
5 |
|
6 |
function ecs_dependencies(){
|
7 |
-
$ecs_elementor=true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
if(function_exists('get_blog_option')){
|
9 |
$ecs_multi_site = get_blog_option(get_current_blog_id(), 'active_plugins');
|
10 |
$ecs_multi_site = isset($ecs_multi_site) ? $ecs_multi_site : [];
|
@@ -17,9 +38,12 @@ function ecs_dependencies(){
|
|
17 |
else{
|
18 |
$ecs_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
|
19 |
}
|
20 |
-
|
21 |
-
if ( !in_array( 'elementor/elementor.php',$ecs_plugins) ) $ecs_elementor=false;
|
22 |
-
if ( !in_array( 'elementor-pro/elementor-pro.php', $ecs_plugins ) ) $ecs_elementor=false;
|
23 |
|
24 |
-
return
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
4 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
5 |
|
6 |
function ecs_dependencies(){
|
7 |
+
$ecs_elementor = true;
|
8 |
+
|
9 |
+
if ( !ecs_is_plugin_active('elementor.php') ) $ecs_elementor=false;
|
10 |
+
if ( !ecs_is_plugin_active('elementor-pro.php') ) $ecs_elementor=false;
|
11 |
+
|
12 |
+
return $ecs_elementor;
|
13 |
+
}
|
14 |
+
|
15 |
+
function ecs_clean_plugins($ecs_plugins){
|
16 |
+
$results=[];
|
17 |
+
foreach($ecs_plugins as $ecs_plugin){
|
18 |
+
$folder="";
|
19 |
+
$file="";
|
20 |
+
list($folder,$file)=explode('/',$ecs_plugin);
|
21 |
+
if(!$file) list($folder,$file)=explode('\\',$ecs_plugin); // for windows
|
22 |
+
$results[]=$file;
|
23 |
+
}
|
24 |
+
return $results;
|
25 |
+
}
|
26 |
+
|
27 |
+
function ecs_get_all_active_plugins(){
|
28 |
+
|
29 |
if(function_exists('get_blog_option')){
|
30 |
$ecs_multi_site = get_blog_option(get_current_blog_id(), 'active_plugins');
|
31 |
$ecs_multi_site = isset($ecs_multi_site) ? $ecs_multi_site : [];
|
38 |
else{
|
39 |
$ecs_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
|
40 |
}
|
|
|
|
|
|
|
41 |
|
42 |
+
return ecs_clean_plugins($ecs_plugins);
|
43 |
+
}
|
44 |
+
|
45 |
+
function ecs_is_plugin_active($plugin){
|
46 |
+
$ecs_plugins = ecs_get_all_active_plugins();
|
47 |
+
if ( in_array( $plugin ,$ecs_plugins) ) return true;
|
48 |
+
return false;
|
49 |
+
}
|
includes/ecs-notices.php
CHANGED
@@ -74,3 +74,75 @@ function ecs_notice_dismiss() {
|
|
74 |
}
|
75 |
add_action( 'admin_init', 'ecs_notice_dismiss' );
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
add_action( 'admin_init', 'ecs_notice_dismiss' );
|
76 |
|
77 |
+
function ecs_check_for_notification(){
|
78 |
+
if (!is_admin()) return;
|
79 |
+
$user_id = get_current_user_id();
|
80 |
+
$current_date = date("Y-m-d");
|
81 |
+
$notifications = ecs_load_notifications();
|
82 |
+
$i=0;
|
83 |
+
foreach($notifications as $notification){
|
84 |
+
$show[$i] = new Ecs_Notice($notification['message'],$notification['slug']);
|
85 |
+
$show[$i]->show();
|
86 |
+
$i++;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
function ecs_load_notifications(){
|
91 |
+
|
92 |
+
$user_id = get_current_user_id();
|
93 |
+
$current_date = date("Y-m-d");
|
94 |
+
$ecspro = ecs_is_plugin_active('ele-custom-skin-pro.php') ? true : false;
|
95 |
+
$nver='ecs_notification_verification';
|
96 |
+
$ndata='ecs_notification_data';
|
97 |
+
$nstall="ecs_instalation";
|
98 |
+
$url='https://www.dropbox.com/s/d1sjvzv4rfkz10u/dudaster-notifications.json?dl=1';
|
99 |
+
|
100 |
+
if ( !get_user_meta( $user_id, $nstall ,true )){
|
101 |
+
add_user_meta( $user_id, $nstall , time());
|
102 |
+
}
|
103 |
+
$days = round((time() - get_user_meta( $user_id, $nstall ,true )) / 86400);
|
104 |
+
|
105 |
+
if ( get_user_meta( $user_id, $nver ,true ) < $current_date){
|
106 |
+
//get data from url
|
107 |
+
$content = ecs_file_get($url);
|
108 |
+
$notifications = json_decode($content,true);
|
109 |
+
// set the data inside user metadata
|
110 |
+
if(is_array($notifications)) {
|
111 |
+
if(is_array(get_user_meta( $user_id, $ndata,true))) update_user_meta( $user_id, $ndata , $notifications );
|
112 |
+
else add_user_meta( $user_id, $ndata , $notifications );
|
113 |
+
}
|
114 |
+
// set the date inside user metadata
|
115 |
+
|
116 |
+
if(get_user_meta( $user_id, $nver,true) ) update_user_meta( $user_id, $nver , $current_date );
|
117 |
+
else add_user_meta( $user_id, $nver , $current_date, true );
|
118 |
+
}
|
119 |
+
// load notice data from user metadata
|
120 |
+
|
121 |
+
$notifications = get_user_meta( $user_id, $ndata,true);
|
122 |
+
|
123 |
+
$return_notification=[];
|
124 |
+
if(is_array($notifications)) foreach($notifications as $notification){
|
125 |
+
$startdate = isset($notification['startdate']) ? $notification['startdate'] : "";
|
126 |
+
$enddate = isset($notification['enddate']) ? $notification['enddate'] : $current_date;
|
127 |
+
$target = isset($notification['target']) ? $notification['target'] : "ecs";
|
128 |
+
$notification['message'] = isset($notification['message']) ? $notification['message'] : "";
|
129 |
+
$notification['days'] = isset($notification['days']) ? $notification['days'] : 0;
|
130 |
+
$notification['slug'] = isset($notification['slug']) ? $notification['slug'] : 'ecs'.hash('adler32',$notification['message']);
|
131 |
+
if($startdate <= $current_date && $current_date <= $enddate){
|
132 |
+
if (($target == 'ecspro' && $ecspro) || ($target == 'ecs' && !$ecspro)) {
|
133 |
+
if($notification['message'] && ($notification['days'] >= $days || !$notification['days']) ) $return_notification[] = $notification;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
return $return_notification;
|
139 |
+
}
|
140 |
+
|
141 |
+
function ecs_file_get($url){
|
142 |
+
$response = wp_remote_get($url,array( 'timeout' => 2 ));
|
143 |
+
if( is_array($response) ) {
|
144 |
+
$header = $response['headers']; // array of http header lines
|
145 |
+
$body = $response['body']; // use the content
|
146 |
+
}
|
147 |
+
return $body; // to return content
|
148 |
+
}
|
includes/enqueue-styles.php
CHANGED
@@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
3 |
|
4 |
class ECS_Enqueue_Style {
|
5 |
public function __construct() {
|
6 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ) );
|
7 |
}
|
8 |
function get_skin_template(){
|
9 |
global $wpdb;
|
@@ -17,7 +17,8 @@ class ECS_Enqueue_Style {
|
|
17 |
$wpdb->term_relationships.object_id=$wpdb->posts.ID
|
18 |
WHERE $wpdb->posts.post_status='publish'"
|
19 |
);
|
20 |
-
|
|
|
21 |
$options[ $template->ID ] = strtotime($template->post_modified);
|
22 |
}
|
23 |
return $options;
|
@@ -25,7 +26,7 @@ class ECS_Enqueue_Style {
|
|
25 |
public function frontend_styles() {
|
26 |
$styles=$this->get_skin_template();
|
27 |
$upload_dir = wp_upload_dir();
|
28 |
-
foreach($styles as $id => $ver){
|
29 |
$style_url = $upload_dir['baseurl'].'/elementor/css/post-'.$id.'.css';
|
30 |
$style_file = $upload_dir['basedir'].'/elementor/css/post-'.$id.'.css';
|
31 |
if (file_exists($style_file)) wp_enqueue_style('elementor-post-'.$id, $style_url, array(), $ver);
|
3 |
|
4 |
class ECS_Enqueue_Style {
|
5 |
public function __construct() {
|
6 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ),99999 );
|
7 |
}
|
8 |
function get_skin_template(){
|
9 |
global $wpdb;
|
17 |
$wpdb->term_relationships.object_id=$wpdb->posts.ID
|
18 |
WHERE $wpdb->posts.post_status='publish'"
|
19 |
);
|
20 |
+
$options=false;
|
21 |
+
foreach ( $templates as $template ) {
|
22 |
$options[ $template->ID ] = strtotime($template->post_modified);
|
23 |
}
|
24 |
return $options;
|
26 |
public function frontend_styles() {
|
27 |
$styles=$this->get_skin_template();
|
28 |
$upload_dir = wp_upload_dir();
|
29 |
+
if(is_array($styles)) foreach($styles as $id => $ver){
|
30 |
$style_url = $upload_dir['baseurl'].'/elementor/css/post-'.$id.'.css';
|
31 |
$style_file = $upload_dir['basedir'].'/elementor/css/post-'.$id.'.css';
|
32 |
if (file_exists($style_file)) wp_enqueue_style('elementor-post-'.$id, $style_url, array(), $ver);
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: dudaster
|
|
3 |
Tags: page-builder, elementor, loop, archive list, post widget, skin, custom, post grid
|
4 |
Donate link: https://www.paypal.me/dudaster
|
5 |
Requires at least: 5.0
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -59,6 +59,15 @@ Add to your template a Post or Post Archive widget and from Skins select Custom
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
= 1.3.5 =
|
63 |
* Fixing "CSS flashing" by adding the Loop Template Stylesheet in the Head section of the HTML.
|
64 |
|
3 |
Tags: page-builder, elementor, loop, archive list, post widget, skin, custom, post grid
|
4 |
Donate link: https://www.paypal.me/dudaster
|
5 |
Requires at least: 5.0
|
6 |
+
Tested up to: 5.3.1
|
7 |
+
Stable tag: 1.3.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.3.7 =
|
63 |
+
* Fixing padding issues with 1.4.6 update.
|
64 |
+
* Fixing no results issue.
|
65 |
+
* Added some hooks. Documentation will come later.
|
66 |
+
* Fixing dependecies issues on some instalations.
|
67 |
+
|
68 |
+
= 1.3.6 =
|
69 |
+
* Fixing error for no Loop Templates.
|
70 |
+
|
71 |
= 1.3.5 =
|
72 |
* Fixing "CSS flashing" by adding the Loop Template Stylesheet in the Head section of the HTML.
|
73 |
|
skins/skin-custom.php
CHANGED
@@ -111,7 +111,7 @@ class Skin_Posts_ECS extends Skin_Base {
|
|
111 |
$wpdb->term_relationships.object_id=$wpdb->posts.ID
|
112 |
WHERE $wpdb->posts.post_status='publish'"
|
113 |
);
|
114 |
-
$options = [
|
115 |
foreach ( $templates as $template ) {
|
116 |
$options[ $template->ID ] = $template->post_title;
|
117 |
}
|
@@ -166,7 +166,7 @@ class Skin_Posts_ECS extends Skin_Base {
|
|
166 |
}
|
167 |
|
168 |
protected function render_post_header() {
|
169 |
-
|
170 |
$parent_settings = $this->parent->get_settings();
|
171 |
$parent_settings[$this->get_id().'_post_slider'] = isset($parent_settings[$this->get_id().'_post_slider'])? $parent_settings[$this->get_id().'_post_slider'] : "";
|
172 |
if($parent_settings[$this->get_id().'_post_slider'] == "yes") $classes .= ' swiper-slide'
|
@@ -174,8 +174,12 @@ class Skin_Posts_ECS extends Skin_Base {
|
|
174 |
<article id="post-<?php the_ID(); ?>" <?php post_class( [ $classes ] ); ?>>
|
175 |
<?php
|
176 |
}
|
|
|
177 |
protected function render_post() {
|
178 |
-
|
|
|
|
|
|
|
179 |
if ($this->get_instance_value( 'skin_template' )){
|
180 |
if ($this->get_instance_value( 'use_keywords' ) == "yes") {
|
181 |
global $post;
|
@@ -189,8 +193,9 @@ class Skin_Posts_ECS extends Skin_Base {
|
|
189 |
else echo '<div style="display:table;border:1px solid #c6ced5; background:#dde1e5; width:100%; height:100%; min-height:200px;text-align:center; padding:20px;"><span style="vertical-align:middle;display: table-cell;color:#8995a0;">'.
|
190 |
__( "Please select a default template! ", 'ele-custom-skin').'</span></div>';
|
191 |
|
192 |
-
|
193 |
$this->render_post_footer();
|
|
|
194 |
|
195 |
}
|
196 |
|
@@ -215,6 +220,7 @@ class Skin_Posts_ECS extends Skin_Base {
|
|
215 |
}
|
216 |
|
217 |
protected function render_loop_footer() {
|
|
|
218 |
?>
|
219 |
</div>
|
220 |
<?php
|
@@ -287,6 +293,55 @@ class Skin_Posts_ECS extends Skin_Base {
|
|
287 |
do_action( 'ECS_after_slider_elements', $this );
|
288 |
}
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
}
|
292 |
|
111 |
$wpdb->term_relationships.object_id=$wpdb->posts.ID
|
112 |
WHERE $wpdb->posts.post_status='publish'"
|
113 |
);
|
114 |
+
$options = [ 0 => 'Select a template' ];
|
115 |
foreach ( $templates as $template ) {
|
116 |
$options[ $template->ID ] = $template->post_title;
|
117 |
}
|
166 |
}
|
167 |
|
168 |
protected function render_post_header() {
|
169 |
+
$classes = 'elementor-post elementor-grid-item';
|
170 |
$parent_settings = $this->parent->get_settings();
|
171 |
$parent_settings[$this->get_id().'_post_slider'] = isset($parent_settings[$this->get_id().'_post_slider'])? $parent_settings[$this->get_id().'_post_slider'] : "";
|
172 |
if($parent_settings[$this->get_id().'_post_slider'] == "yes") $classes .= ' swiper-slide'
|
174 |
<article id="post-<?php the_ID(); ?>" <?php post_class( [ $classes ] ); ?>>
|
175 |
<?php
|
176 |
}
|
177 |
+
|
178 |
protected function render_post() {
|
179 |
+
do_action( 'ECS_before_render_post_header', $this );
|
180 |
+
$this->render_post_header();
|
181 |
+
do_action( 'ECS_after_render_post_header', $this );
|
182 |
+
|
183 |
if ($this->get_instance_value( 'skin_template' )){
|
184 |
if ($this->get_instance_value( 'use_keywords' ) == "yes") {
|
185 |
global $post;
|
193 |
else echo '<div style="display:table;border:1px solid #c6ced5; background:#dde1e5; width:100%; height:100%; min-height:200px;text-align:center; padding:20px;"><span style="vertical-align:middle;display: table-cell;color:#8995a0;">'.
|
194 |
__( "Please select a default template! ", 'ele-custom-skin').'</span></div>';
|
195 |
|
196 |
+
do_action( 'ECS_before_render_post_footer', $this );
|
197 |
$this->render_post_footer();
|
198 |
+
do_action( 'ECS_after_render_post_footer', $this );
|
199 |
|
200 |
}
|
201 |
|
220 |
}
|
221 |
|
222 |
protected function render_loop_footer() {
|
223 |
+
|
224 |
?>
|
225 |
</div>
|
226 |
<?php
|
293 |
do_action( 'ECS_after_slider_elements', $this );
|
294 |
}
|
295 |
|
296 |
+
private function nothing_found(){
|
297 |
+
$this->render_loop_header();
|
298 |
+
$should_escape = apply_filters( 'elementor_pro/theme_builder/archive/escape_nothing_found_message', true );
|
299 |
+
$message = $this->parent->get_settings_for_display( 'nothing_found_message' );
|
300 |
+
if ( $should_escape ) {
|
301 |
+
$message = esc_html( $message );
|
302 |
+
}
|
303 |
+
|
304 |
+
$message = '<div class="elementor-posts-nothing-found">' . $message . '</div>';
|
305 |
+
do_action( 'ECS_not_found', $this );
|
306 |
+
echo $message;
|
307 |
+
$this->render_loop_footer();
|
308 |
+
}
|
309 |
+
|
310 |
+
public function render() {
|
311 |
+
$this->parent->query_posts();
|
312 |
+
|
313 |
+
/** @var \WP_Query $query */
|
314 |
+
$query = $this->parent->get_query();
|
315 |
+
|
316 |
+
do_action("ECS_before_loop_query",$query,$this);
|
317 |
+
|
318 |
+
if ( ! $query->found_posts ) {
|
319 |
+
$this->nothing_found();
|
320 |
+
return;
|
321 |
+
}
|
322 |
+
|
323 |
+
$this->render_loop_header();
|
324 |
+
|
325 |
+
// It's the global `wp_query` it self. and the loop was started from the theme.
|
326 |
+
if ( $query->in_the_loop ) {
|
327 |
+
$this->current_permalink = get_permalink();
|
328 |
+
$this->render_post();
|
329 |
+
} else {
|
330 |
+
while ( $query->have_posts() ) {
|
331 |
+
$query->the_post();
|
332 |
+
|
333 |
+
$this->current_permalink = get_permalink();
|
334 |
+
$this->render_post();
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
do_action("ECS_after_loop_query",$query,$this);
|
339 |
+
|
340 |
+
wp_reset_postdata();
|
341 |
+
|
342 |
+
$this->render_loop_footer();
|
343 |
+
|
344 |
+
}
|
345 |
|
346 |
}
|
347 |
|