Skip to content

Instantly share code, notes, and snippets.

@mdailey77
Last active March 2, 2019 15:19
Show Gist options
  • Save mdailey77/a24260d93b3fc269e9e7265fa215c249 to your computer and use it in GitHub Desktop.
Save mdailey77/a24260d93b3fc269e9e7265fa215c249 to your computer and use it in GitHub Desktop.
Run Huge IT Lightbox plugin only on certain page templates in WordPress
<?php
add_action( 'wp_print_scripts', 'deactivate_lightbox', 100 );
function deactivate_lightbox() {
if ( !is_page_template('template-products-landing.php') && !is_singular( 'product' ) ) {
wp_deregister_script( 'hugeit-lightbox-js' );
wp_deregister_script( 'hugeit-custom-js' );
wp_deregister_script( 'hugeit-froogaloop-js' );
wp_deregister_script( 'mousewheel-min-js' );
wp_deregister_script( 'hugeit-colorbox-js' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment