wc_list_pages() WC 1.0
Fix active class in wp_list_pages for shop page.
See details in https://github.com/woocommerce/woocommerce/issues/177.
Хуков нет.
Возвращает
Строку.
Использование
wc_list_pages( $pages );
- $pages(строка) (обязательный)
- Pages list.
Код wc_list_pages() wc list pages WC 5.0.0
function wc_list_pages( $pages ) {
if ( ! is_woocommerce() ) {
return $pages;
}
// Remove current_page_parent class from any item.
$pages = str_replace( 'current_page_parent', '', $pages );
// Find shop_page_id through woocommerce options.
$shop_page = 'page-item-' . wc_get_page_id( 'shop' );
if ( is_shop() ) {
// Add current_page_item class to shop page.
return str_replace( $shop_page, $shop_page . ' current_page_item', $pages );
}
// Add current_page_parent class to shop page.
return str_replace( $shop_page, $shop_page . ' current_page_parent', $pages );
}