Created
September 19, 2016 17:29
-
-
Save amberhinds/01096e2a84959af5c91282429690247b to your computer and use it in GitHub Desktop.
Add Woocommerce lightbox scripts on other parts of the site (put on specific page templates or in functions.php)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'frontend_scripts_include_lightbox' ); | |
function frontend_scripts_include_lightbox() { | |
global $woocommerce; | |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
$lightbox_en = get_option( 'woocommerce_enable_lightbox' ) == 'yes' ? true : false; | |
if ( $lightbox_en ) { | |
wp_enqueue_script( 'prettyPhoto', $woocommerce->plugin_url() . '/assets/js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array( 'jquery' ), '3.1.5', true ); | |
wp_enqueue_script( 'prettyPhoto-init', $woocommerce->plugin_url() . '/assets/js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery' ), $woocommerce->version, true ); | |
wp_enqueue_style( 'woocommerce_prettyPhoto_css', $woocommerce->plugin_url() . '/assets/css/prettyPhoto.css' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment