Advertisement
artemsemkin

Untitled

Oct 20th, 2020 (edited)
2,082
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. ...
  4.  
  5. /**
  6.  * Enqueue Theme JS Files
  7.  */
  8. add_action( 'wp_enqueue_scripts', 'arts_enqueue_scripts', 50 );
  9. function arts_enqueue_scripts() {
  10.   $ajax_enabled     = get_theme_mod( 'ajax_enabled', false );
  11.   $gmap             = get_option( 'arts_gmap' );
  12.   $main_script_deps = array( 'modernizr', 'jquery', 'barba', 'isotope', 'imagesloaded', 'swiper' );
  13.  
  14.   // Force load Google Maps script
  15.   // on all the pages with AJAX turned on
  16.   if ( $ajax_enabled && isset( $gmap['key'] ) && ! empty( $gmap['key'] ) ) {
  17.     wp_enqueue_script( 'googlemap', '//maps.googleapis.com/maps/api/js?key=' . $gmap['key'], array(), null, true );
  18.     $main_script_deps [] = 'googlemap';
  19.   }
  20.  
  21.   // Force load Elementor assets
  22.   // on non-Elementor pages with AJAX turned on
  23.   if ( class_exists( '\Elementor\Frontend' ) && ! arts_is_built_with_elementor() && $ajax_enabled ) {
  24.     \Elementor\Frontend::instance()->enqueue_scripts();
  25.   }
  26.  
  27.   ...
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement