dont load script on woocommerce pages

This commit is contained in:
Stef Kariotidis 2016-11-18 23:33:34 +02:00
parent fda1772470
commit 33602b1d74
1 changed files with 9 additions and 1 deletions

View File

@ -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();