Twenty Twenty-One: Only add the sub-menu toggle button to the primary menu.

Follow-up to [49216].

Props domainsupport, mukesh27, poena, karmatosed, shailu25, SergeyBiryukov.
Fixes #52694.
Built from https://develop.svn.wordpress.org/trunk@58293


git-svn-id: http://core.svn.wordpress.org/trunk@57753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2024-06-03 12:51:12 +00:00
parent cdbb9bf2b4
commit fe3ad93303
2 changed files with 4 additions and 2 deletions

View File

@@ -25,7 +25,9 @@
* @return string Nav menu item start element. * @return string Nav menu item start element.
*/ */
function twenty_twenty_one_add_sub_menu_toggle( $output, $item, $depth, $args ) { function twenty_twenty_one_add_sub_menu_toggle( $output, $item, $depth, $args ) {
if ( 0 === $depth && in_array( 'menu-item-has-children', $item->classes, true ) ) { if ( 'primary' === $args->theme_location
&& 0 === $depth && in_array( 'menu-item-has-children', $item->classes, true )
) {
// Add toggle button. // Add toggle button.
$output .= '<button class="sub-menu-toggle" aria-expanded="false" onClick="twentytwentyoneExpandSubMenu(this)">'; $output .= '<button class="sub-menu-toggle" aria-expanded="false" onClick="twentytwentyoneExpandSubMenu(this)">';

View File

@@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-alpha-58292'; $wp_version = '6.6-alpha-58293';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.