WC_Admin_Post_Types::add_display_post_states()publicWC 1.0

Add a post display state for special WC pages in the page list table.

Метод класса: WC_Admin_Post_Types{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Admin_Post_Types = new WC_Admin_Post_Types();
$WC_Admin_Post_Types->add_display_post_states( $post_states, $post );
$post_states(массив) (обязательный)
An array of post display states.
$post(WP_Post) (обязательный)
The current post object.

Код WC_Admin_Post_Types::add_display_post_states() WC 8.7.0

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;
}