wpgenie

remove lottery JS on all pages except product page

Dec 9th, 2020 (edited)
1,577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. /*
  2.     Code should go to your child theme functions.php file.
  3.     Lottery widgets and shortcodes will not work properly when this code snippet is active.
  4.  
  5. */
  6. add_action( 'wp_enqueue_scripts', 'woo_js_cleaner', 99 );
  7. function woo_js_cleaner() {    
  8.     if ( !is_product() ) {
  9.         wp_dequeue_script( 'wc-lottery-jquery-plugin' );
  10.         wp_dequeue_script( 'wc-lottery-countdown' );
  11.         wp_dequeue_script( 'wc-lottery-countdown-language' );
  12.         wp_dequeue_script( 'wc-lottery' );
  13.         wp_dequeue_script( 'wc-lottery-public' );
  14.         wp_dequeue_script( 'wc-lottery-pn' );
  15.         wp_dequeue_script( 'jquery-alertable' );
  16.     }    
  17. }
Advertisement
Add Comment
Please, Sign In to add comment