WC_Admin_Post_Types::add_display_post_states()
Add a post display state for special WC pages in the page list table.
Method of the class: WC_Admin_Post_Types{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Admin_Post_Types = new WC_Admin_Post_Types(); $WC_Admin_Post_Types->add_display_post_states( $post_states, $post );
- $post_states(array) (required)
- An array of post display states.
- $post(WP_Post) (required)
- The current post object.
WC_Admin_Post_Types::add_display_post_states() WC Admin Post Types::add display post states code WC 9.7.1
public function add_display_post_states( $post_states, $post ) { if ( wc_get_page_id( 'shop' ) === $post->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_terms'] = __( 'Terms and Conditions Page', 'woocommerce' ); } return $post_states; }