admin-bar-menu.php
3 years ago
ajax-pagination.php
2 years ago
class-ecs-core.php
2 months ago
class-ecs-module-base.php
1 month ago
class-ecs-modules-manager.php
2 months ago
dynamic-style.php
3 years ago
ecs-dependencies.php
6 years ago
ecs-notices.php
6 years ago
enqueue-styles.php
2 years ago
pro-features.php
2 months ago
pro-preview.php
6 years ago
enqueue-styles.php
46 lines
| 1 | <?php |
| 2 | 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' ),99999 ); |
| 7 | } |
| 8 | function get_skin_template(){ |
| 9 | global $wpdb; |
| 10 | $templates = $wpdb->get_results( |
| 11 | "SELECT $wpdb->term_relationships.object_id as ID, $wpdb->posts.post_modified as post_modified FROM $wpdb->term_relationships |
| 12 | INNER JOIN $wpdb->term_taxonomy ON |
| 13 | $wpdb->term_relationships.term_taxonomy_id=$wpdb->term_taxonomy.term_taxonomy_id |
| 14 | INNER JOIN $wpdb->terms ON |
| 15 | $wpdb->term_taxonomy.term_id=$wpdb->terms.term_id AND $wpdb->terms.slug='loop' |
| 16 | INNER JOIN $wpdb->posts ON |
| 17 | $wpdb->term_relationships.object_id=$wpdb->posts.ID |
| 18 | WHERE $wpdb->posts.post_status='publish'" |
| 19 | ); |
| 20 | $options=array(); |
| 21 | foreach ( $templates as $template ) { |
| 22 | $options[ $template->ID ] = strtotime($template->post_modified); |
| 23 | } |
| 24 | if(empty($options)) return false; return $options; |
| 25 | } |
| 26 | public function frontend_styles() { |
| 27 | //adding some css fixes |
| 28 | |
| 29 | wp_enqueue_style('ecs-styles', plugin_dir_url(__DIR__) . 'assets/css/ecs-style.css',array(),ELECS_VER); |
| 30 | wp_enqueue_script('ecs-script', plugin_dir_url(__DIR__) . 'assets/js/ecs.js',array(),ELECS_VER); |
| 31 | |
| 32 | $styles=$this->get_skin_template(); |
| 33 | $upload_dir = wp_upload_dir(); |
| 34 | |
| 35 | //some people forget to change the http into https and blame the plugin |
| 36 | $upload_dir['baseurl']=set_url_scheme($upload_dir['baseurl']); |
| 37 | |
| 38 | if(is_array($styles)) foreach($styles as $id => $ver){ |
| 39 | $style_url = $upload_dir['baseurl'].'/elementor/css/post-'.$id.'.css'; |
| 40 | $style_file = $upload_dir['basedir'].'/elementor/css/post-'.$id.'.css'; |
| 41 | if (file_exists($style_file)) wp_enqueue_style('elementor-post-'.$id, $style_url, array(), $ver); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | new ECS_Enqueue_Style(); |