From ebf3ab5cc6f95ea1caa0238fb663b19a15f01fc0 Mon Sep 17 00:00:00 2001 From: Bryce Date: Mon, 29 Dec 2014 15:31:18 +0700 Subject: [PATCH 1/3] New `is_view_order_page` conditional function Returns true when on the `my-account/view-order/` page --- includes/wc-conditional-functions.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/includes/wc-conditional-functions.php b/includes/wc-conditional-functions.php index a540c71783e..12ed252b3aa 100644 --- a/includes/wc-conditional-functions.php +++ b/includes/wc-conditional-functions.php @@ -7,7 +7,7 @@ * @author WooThemes * @category Core * @package WooCommerce/Functions - * @version 2.1.0 + * @version 2.3.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -178,6 +178,21 @@ if ( ! function_exists( 'is_account_page' ) ) { } } +if ( ! function_exists( 'is_view_order_page' ) ) { + + /** + * is_view_order_page - Returns true when on the view order page. + * + * @access public + * @return bool + */ + function is_view_order_page() { + global $wp; + + return ( isset( $wp->query_vars['view-order'] ) ? true : false ); + } +} + if ( ! function_exists( 'is_order_received_page' ) ) { /** From ca5416217c7f1d2748fad69845aa082c8681b2e9 Mon Sep 17 00:00:00 2001 From: Bryce Date: Mon, 29 Dec 2014 21:46:03 +0700 Subject: [PATCH 2/3] Add check for my account page too --- includes/wc-conditional-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-conditional-functions.php b/includes/wc-conditional-functions.php index 12ed252b3aa..50f02934a05 100644 --- a/includes/wc-conditional-functions.php +++ b/includes/wc-conditional-functions.php @@ -189,7 +189,7 @@ if ( ! function_exists( 'is_view_order_page' ) ) { function is_view_order_page() { global $wp; - return ( isset( $wp->query_vars['view-order'] ) ? true : false ); + return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['view-order'] ) ? true : false ); } } From d8c49cb988c62f24c4868e072e9242f47d276cbe Mon Sep 17 00:00:00 2001 From: Bryce Date: Mon, 29 Dec 2014 21:48:26 +0700 Subject: [PATCH 3/3] Fix brackets --- includes/wc-conditional-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-conditional-functions.php b/includes/wc-conditional-functions.php index 50f02934a05..866482e4b7c 100644 --- a/includes/wc-conditional-functions.php +++ b/includes/wc-conditional-functions.php @@ -189,7 +189,7 @@ if ( ! function_exists( 'is_view_order_page' ) ) { function is_view_order_page() { global $wp; - return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['view-order'] ) ? true : false ); + return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['view-order'] ) ) ? true : false; } }