From 33602b1d7450a335e9112e813d6f437feb2948d7 Mon Sep 17 00:00:00 2001 From: Stef Kariotidis Date: Fri, 18 Nov 2016 23:33:34 +0200 Subject: [PATCH 1/2] 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(); From 8e7e24a899806982261794dabb640d7c9b7549b2 Mon Sep 17 00:00:00 2001 From: Stef Kariotidis Date: Sat, 19 Nov 2016 00:15:39 +0200 Subject: [PATCH 2/2] do not show woocommerce pages on vertical template --- page-templates/vertical-one-page.php | 56 +++++++++++++++++----------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/page-templates/vertical-one-page.php b/page-templates/vertical-one-page.php index 18bd027..605fd4f 100755 --- a/page-templates/vertical-one-page.php +++ b/page-templates/vertical-one-page.php @@ -7,8 +7,8 @@ * @package understrap */ - get_header(); - $container = get_theme_mod('understrap_container_type'); +get_header(); +$container = get_theme_mod( 'understrap_container_type' ); ?> 'page', - 'post__not_in' => array( $exclude ), - 'orderby' => 'menu_order', - 'order' => 'ASC' - ); +$exclude = array(); +// exclude blog page +array_push($exclude, get_option( 'page_for_posts' ) ); +// exclude WooCommerce pages +array_push( $exclude, get_option( 'woocommerce_cart_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_shop_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_checkout_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_pay_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_thanks_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_myaccount_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_edit_address_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_view_order_page_id' ) ); +array_push( $exclude, get_option( 'woocommerce_terms_page_id' ) ); +$args = array( + 'post_type' => 'page', + 'post__not_in' => $exclude, + 'orderby' => 'menu_order', + 'order' => 'ASC' +); - $qry = new WP_Query( $args ); +$qry = new WP_Query( $args ); ?>
-
+
-
+
-
+
- have_posts() ): $qry->the_post() ?> -
- -
+ have_posts() ): $qry->the_post() ?> +
+ +
- - + + -
+
-
+
-
+