class-auxels-frontend-assets.php
5 months ago
frontend-ajax.php
1 year ago
index.php
9 years ago
templates-post.php
9 years ago
class-auxels-frontend-assets.php
81 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Load frontend scripts and styles |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2026 averta |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * Constructor |
| 15 | */ |
| 16 | class AUXELS_Frontend_Assets { |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Construct |
| 21 | */ |
| 22 | public function __construct() { |
| 23 | add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ) ); |
| 24 | add_action( 'wp_enqueue_scripts', array( $this, 'load_elementor_header_footer_assets' ), 20 ); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Styles for admin |
| 29 | * |
| 30 | * @return void |
| 31 | */ |
| 32 | public function load_assets() { |
| 33 | |
| 34 | // fix compatibility issue with "Elementor Addon Elements" plugin |
| 35 | wp_deregister_script( 'wts-isotope' ); |
| 36 | |
| 37 | if( $google_map_api_key = auxin_get_option( 'auxin_google_map_api_key') ){ |
| 38 | wp_enqueue_script( 'mapapi', esc_url( set_url_scheme( 'http://maps.googleapis.com/maps/api/js?v=3&key='. $google_map_api_key ) ) , null, null, true ); |
| 39 | } |
| 40 | |
| 41 | //wp_enqueue_style( AUXELS_SLUG .'-main', AUXELS_PUB_URL . '/assets/css/main.css', array(), AUXELS_VERSION ); |
| 42 | wp_enqueue_script( AUXELS_SLUG .'-plugins', AUXELS_PUB_URL . '/assets/js/plugins.min.js', array('jquery'), AUXELS_VERSION, true ); |
| 43 | wp_enqueue_script( AUXELS_SLUG .'-scripts', AUXELS_PUB_URL . '/assets/js/scripts.js', array('jquery'), AUXELS_VERSION, true ); |
| 44 | } |
| 45 | |
| 46 | public function load_elementor_header_footer_assets() { |
| 47 | if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { |
| 48 | // Enqueue header template styles in header |
| 49 | if( $header_template_style = auxin_get_option( 'site_elementor_header_template' ) ){ |
| 50 | $css_file = new \Elementor\Core\Files\CSS\Post( $header_template_style ); |
| 51 | $css_file->enqueue(); |
| 52 | |
| 53 | // Enqueue any additional JS/CSS required for the document |
| 54 | $page_assets = get_post_meta( $header_template_style, \Elementor\Core\Base\Elements_Iteration_Actions\Assets::ASSETS_META_KEY, true ); |
| 55 | if ( ! empty( $page_assets ) ) { |
| 56 | \Elementor\Plugin::$instance->assets_loader->enable_assets( $page_assets ); |
| 57 | } |
| 58 | |
| 59 | } |
| 60 | |
| 61 | if( $footer_template_style = auxin_get_option( 'site_elementor_footer_template' ) ){ |
| 62 | $css_file = new \Elementor\Core\Files\CSS\Post( $footer_template_style ); |
| 63 | $css_file->enqueue(); |
| 64 | |
| 65 | // Enqueue any additional JS/CSS required for the document |
| 66 | $page_assets = get_post_meta( $footer_template_style, \Elementor\Core\Base\Elements_Iteration_Actions\Assets::ASSETS_META_KEY, true ); |
| 67 | if ( ! empty( $page_assets ) ) { |
| 68 | \Elementor\Plugin::$instance->assets_loader->enable_assets( $page_assets ); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | return new AUXELS_Frontend_Assets(); |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 |