From 290a90c8f88a6fd4a63a680b08a59dc659f47480 Mon Sep 17 00:00:00 2001 From: Caleb Burks <19caleb95@gmail.com> Date: Tue, 27 Jun 2017 23:38:09 -0500 Subject: [PATCH 1/2] Add post states for WC pages --- includes/admin/class-wc-admin-post-types.php | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 3b106d7a2e3..4748a06d8c8 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -105,6 +105,9 @@ class WC_Admin_Post_Types { // Hide template for CPT archive. add_filter( 'theme_page_templates', array( $this, 'hide_cpt_archive_templates' ), 10, 3 ); add_action( 'edit_form_top', array( $this, 'show_cpt_archive_notice' ) ); + + // Add a post display state for special WC pages. + add_filter( 'display_post_states', array( $this, 'add_display_post_states' ), 10, 2 ); } /** @@ -1999,6 +2002,36 @@ class WC_Admin_Post_Types { ID ) { + $post_states['wc_page_for_shop'] = __( 'Shop Page', 'woocommerce' ); + } + + if ( wc_get_page_id( 'cart' ) === $post->ID ) { + $post_states['wc_page_for_cart'] = __( 'Cart Page', 'woocommerce' ); + } + + if ( wc_get_page_id( 'checkout' ) === $post->ID ) { + $post_states['wc_page_for_checkout'] = __( 'Checkout Page', 'woocommerce' ); + } + + if ( wc_get_page_id( 'myaccount' ) === $post->ID ) { + $post_states['wc_page_for_myaccount'] = __( 'My Account Page', 'woocommerce' ); + } + + if ( wc_get_page_id( 'terms' ) === $post->ID ) { + $post_states['wc_page_for_myaccount'] = __( 'Terms and Conditions Page', 'woocommerce' ); + } + + return $post_states; + } } endif; From 029c28a462a08dc69ce3bab863cbef0b2b0d8f76 Mon Sep 17 00:00:00 2001 From: Caleb Burks <19caleb95@gmail.com> Date: Tue, 27 Jun 2017 23:55:14 -0500 Subject: [PATCH 2/2] Fix copy/paste fail --- includes/admin/class-wc-admin-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 4748a06d8c8..a49d648a3e8 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -2027,7 +2027,7 @@ class WC_Admin_Post_Types { } if ( wc_get_page_id( 'terms' ) === $post->ID ) { - $post_states['wc_page_for_myaccount'] = __( 'Terms and Conditions Page', 'woocommerce' ); + $post_states['wc_page_for_terms'] = __( 'Terms and Conditions Page', 'woocommerce' ); } return $post_states;