wc_list_pages( string $pages )
Fix active class in wp_list_pages for shop page.
Description Description
See details in https://github.com/woocommerce/woocommerce/issues/177.
Parameters Parameters
- $pages
-
(string) (Required) Pages list.
Return Return
(string)
Source Source
File: includes/wc-page-functions.php
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 ); }