Skip to content

Instantly share code, notes, and snippets.

@rajeebbanstola
Created October 7, 2015 10:56
Show Gist options
  • Save rajeebbanstola/4fa7f75a0a88c880aba0 to your computer and use it in GitHub Desktop.
Save rajeebbanstola/4fa7f75a0a88c880aba0 to your computer and use it in GitHub Desktop.
Enqueue Scripts Only if widget is active
<?php
add_action( 'wp_enqueue_scripts', 'colormag_scripts_styles_method' );
/**
* Enqueues styles and scripts.
*/
function colormag_scripts_styles_method() {
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
if(is_active_widget( '', '', 'colormag_category_post_slider')){
wp_enqueue_script( 'colormag-bxslider', COLORMAG_JS_URL . '/jquery.bxslider' . $suffix . '.js', array( 'jquery' ), '4.1.2', true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment