From 33602b1d7450a335e9112e813d6f437feb2948d7 Mon Sep 17 00:00:00 2001 From: Stef Kariotidis Date: Fri, 18 Nov 2016 23:33:34 +0200 Subject: [PATCH] dont load script on woocommerce pages --- inc/enqueue.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/enqueue.php b/inc/enqueue.php index c9cc8b4..ad97456 100644 --- a/inc/enqueue.php +++ b/inc/enqueue.php @@ -16,7 +16,15 @@ if ( ! function_exists ( 'understrap_scripts' ) ) { } // menu - vertical page association - if ( is_page_template( 'page-templates/vertical-one-page.php' ) || is_home() || is_single() ) { + // do not load on WooCommerce pages + // do not load if we are in WooCommerce pages + $loadit = true; + if ( class_exists( 'WooCommerce' ) ) { + if (is_woocommerce()) { + $loadit = false; + } + } + if ( is_page_template( ('page-templates/vertical-one-page.php' ) || is_home() || is_single()) && $loadit ) { wp_enqueue_script( 'vertical-one-page', get_template_directory_uri() . '/js/vertical-one-page.js', array( 'jquery' ), '0.4.9', true ); $page_for_posts = strtolower( get_the_title( get_option( 'page_for_posts' ) ) ); $home_url = home_url();