Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Woocommerce filter account menu item classes
- */
- function custom_woocommerce_account_menu_item_classes( $classes, $endpoint ) {
- global $wp;
- $classes = array(
- 'woocommerce-myaccount-nav-link',
- 'woocommerce-myaccount-nav-link-' . $endpoint,
- );
- // Set current item class.
- $current = isset( $wp->query_vars[ $endpoint ] );
- if ( 'dashboard' === $endpoint && ( isset( $wp->query_vars['page'] ) || empty( $wp->query_vars ) ) ) {
- $current = true;
- }
- if ( $current ) {
- $classes[] = 'active';
- }
- return $classes;
- };
- add_filter( 'woocommerce_account_menu_item_classes', 'custom_woocommerce_account_menu_item_classes', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement