artemsemkin

Unload Elementor's Swiper & Load theme's Swiper

Nov 2nd, 2020
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Theme functions and definitions.
  4.  * This child theme was generated by Merlin WP.
  5.  *
  6.  * @link https://developer.wordpress.org/themes/basics/theme-functions/
  7.  */
  8.  
  9. /*
  10.  * If your child theme has more than one .css file (eg. ie.css, style.css, main.css) then
  11.  * you will have to make sure to maintain all of the parent theme dependencies.
  12.  *
  13.  * Make sure you're using the correct handle for loading the parent theme's styles.
  14.  * Failure to use the proper tag will result in a CSS file needlessly being loaded twice.
  15.  * This will usually not affect the site appearance, but it's inefficient and extends your page's loading time.
  16.  *
  17.  * @link https://codex.wordpress.org/Child_Themes
  18.  */
  19. function rubenz_child_enqueue_styles() {
  20.   wp_enqueue_style( 'rubenz-style', get_template_directory_uri() . '/style.css' );
  21.   wp_enqueue_style(
  22.     'rubenz-child-style',
  23.     get_stylesheet_directory_uri() . '/style.css',
  24.     array( 'rubenz-style' ),
  25.     wp_get_theme()->get( 'Version' )
  26.   );
  27.  
  28.   // unload Elementor's Swiper
  29.   wp_deregister_script( 'swiper' );
  30.   // load Rubenz Swiper
  31.   wp_enqueue_style( 'swiper', ARTS_THEME_URL . '/css/swiper.min.css', array(), '4.5.0' );
  32.   wp_enqueue_script( 'swiper', ARTS_THEME_URL . '/js/swiper.min.js', array( 'jquery' ), '4.4.1', true );
  33. }
  34. add_action( 'wp_enqueue_scripts', 'rubenz_child_enqueue_styles', 50 );
RAW Paste Data