Fix WooCommerce mobile menu for new navigation (https://github.com/woocommerce/woocommerce-admin/pull/6096)

* Show the first WooCommerce item in WP menu on mobile

* Hide excluded menu items from WooCommerce wp menu
This commit is contained in:
Joshua T Flowers 2021-01-20 19:26:54 -05:00 committed by GitHub
parent c98e3ca343
commit 828ffc8a1a
2 changed files with 14 additions and 1 deletions

View File

@ -7,5 +7,11 @@ body.js:not(.has-woocommerce-navigation) {
.toplevel_page_woocommerce ul.wp-submenu {
display: none;
@include breakpoint( '<782px' ) {
.wp-first-item.hide-if-js {
display: list-item;
}
}
}
}

View File

@ -494,8 +494,15 @@ class Menu {
return;
}
foreach ( $submenu['woocommerce'] as $menu_item ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
if ( in_array( $menu_item[2], CoreMenu::get_excluded_items(), true ) ) {
// phpcs:disable
if ( ! isset( $menu_item[ self::CSS_CLASSES ] ) ) {
$submenu['woocommerce'][ $key ][] .= ' hide-if-js';
} else {
$submenu['woocommerce'][ $key ][ self::CSS_CLASSES ] .= ' hide-if-js';
}
// phpcs:enable
continue;
}