WC_Breadcrumb::prepend_shop_page()protectedWC 1.0

Prepend the shop page to shop breadcrumbs.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->prepend_shop_page();

Код WC_Breadcrumb::prepend_shop_page() WC 8.7.0

protected function prepend_shop_page() {
	$permalinks   = wc_get_permalink_structure();
	$shop_page_id = wc_get_page_id( 'shop' );
	$shop_page    = get_post( $shop_page_id );

	// If permalinks contain the shop page in the URI prepend the breadcrumb with shop.
	if ( $shop_page_id && $shop_page && isset( $permalinks['product_base'] ) && strstr( $permalinks['product_base'], '/' . $shop_page->post_name ) && intval( get_option( 'page_on_front' ) ) !== $shop_page_id ) {
		$this->add_crumb( get_the_title( $shop_page ), get_permalink( $shop_page ) );
	}
}