WordPress.org

Make WordPress Core

Ticket #36163: 36163.3.diff

File 36163.3.diff, 1.2 KB (added by Kopepasah, 3 years ago)
  • src/wp-includes/class-walker-nav-menu.php

    diff --git a/src/wp-includes/class-walker-nav-menu.php b/src/wp-includes/class-walker-nav-menu.php
    index c97188b..83dbfed 100644
    a b public function start_lvl( &$output, $depth = 0, $args = array() ) { 
    5959                }
    6060                $indent = str_repeat( $t, $depth );
    6161
     62                // Default class.
     63                $classes = array( 'sub-menu' );
     64
    6265                /**
    6366                 * Filters the CSS class(es) applied to a menu list element.
    6467                 *
    public function start_lvl( &$output, $depth = 0, $args = array() ) { 
    6871                 * @param stdClass $args    An object of `wp_nav_menu()` arguments.
    6972                 * @param int      $depth   Depth of menu item. Used for padding.
    7073                 */
     74                $class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
     75                $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
    7176
    72                 $classes = array( 'sub-menu' );
    73                 $classes = apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth );
    74                 $class_names = join( ' ', $classes );
    75 
    76                 $output .= "{$n}{$indent}<ul class='" . esc_attr( $class_names ) . "'>{$n}";
     77                $output .= "{$n}{$indent}<ul $class_names>{$n}";
    7778        }
    7879
    7980        /**