Skip to content

Instantly share code, notes, and snippets.

@asifpix
Created September 12, 2020 07:18
Show Gist options
  • Save asifpix/471472da9dd88b9678bb90ddedefbf79 to your computer and use it in GitHub Desktop.
Save asifpix/471472da9dd88b9678bb90ddedefbf79 to your computer and use it in GitHub Desktop.
<?php
namespace UniAlumni;
class UniAlumni_Assets {
public function __construct() {
add_action( 'wp_enqueue_scripts', [$this, 'unialumni_enqueue_styles'] );
add_action( 'wp_enqueue_scripts', [$this, 'unialumni_enqueue_scripts'] );
}
public function unialumni_enqueue_styles() {
wp_register_style(
'owl-carousel',
UAE_ASSETS . '/vendors/owl-carousel/css/owl.carousel.min.css',
array(),
UAE_VERSION
);
wp_register_style(
'owl-theme',
UAE_ASSETS . '/vendors/owl-carousel/css/owl.theme.default.min.css',
array( 'owl-carousel' ),
UAE_VERSION
);
wp_register_style(
'unialumni-essential',
UAE_ASSETS . '/css/unialumni-essential.css',
array( 'owl-carousel', 'owl-theme' ),
UAE_VERSION
);
wp_enqueue_style( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'unialumni-essential' );
}
public function unialumni_enqueue_scripts() {
wp_register_script(
'owl-carousel',
UAE_ASSETS . '/vendors/owl-carousel/js/owl.carousel.min.js',
array( 'jquery' ),
UAE_VERSION,
true
);
wp_register_script(
'jquery-waypoints',
UAE_ASSETS . '/vendors/jquery-waypoints/jquery.waypoints.min.js',
array( 'jquery' ),
UAE_VERSION,
true
);
wp_register_script(
'jquery-countto',
UAE_ASSETS . '/vendors/jquery-count/jquery.countTo.js',
array( 'jquery', 'jquery-waypoints' ),
UAE_VERSION,
true
);
wp_register_script(
'unialumni-essential',
UAE_ASSETS . '/js/unialumni-essential.js',
array( 'jquery', 'owl-carousel', 'jquery-waypoints', 'jquery-countto' ),
UAE_VERSION,
true
);
wp_enqueue_script( 'owl-carousel' );
wp_enqueue_script( 'jquery-waypoints' );
wp_enqueue_script( 'jquery-countto' );
wp_enqueue_script( 'unialumni-essential' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment