artemsemkin

Rhye – replace Swiper's library

Nov 18th, 2020 (edited)
1,387
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 rhye_child_enqueue_styles() {
  20.   wp_enqueue_style( 'rhye-style', get_template_directory_uri() . '/style.css' );
  21.   wp_enqueue_style(
  22.     'rhye-child-style',
  23.     get_stylesheet_directory_uri() . '/style.css',
  24.     array( 'rhye-style' ),
  25.     wp_get_theme()->get( 'Version' )
  26.   );
  27.  
  28.   // unload Elementor's Swiper
  29.   wp_deregister_script( 'swiper' );
  30.  
  31.   // load Rhye's Swiper
  32.   wp_enqueue_style( 'swiper', ARTS_THEME_URL . '/css/swiper.min.css', array(), '5.4.1' );
  33.   wp_enqueue_script( 'swiper', ARTS_THEME_URL . '/js/swiper.min.js', array( 'jquery' ), '5.4.1', true );
  34. }
  35. add_action( 'wp_enqueue_scripts', 'rhye_child_enqueue_styles', 99 );
  36.  
RAW Paste Data