WordPress.org

Make WordPress Core

Ticket #36163: 36163.2.diff

File 36163.2.diff, 999 bytes (added by raisonon, 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 4c1a1f2..2c621a9 100644
    a b class Walker_Nav_Menu extends Walker { 
    5858                        $n = "\n";
    5959                }
    6060                $indent = str_repeat( $t, $depth );
    61                 $output .= "{$n}{$indent}<ul class=\"sub-menu\">{$n}";
     61
     62                /**
     63                 * Filters the CSS class(es) applied to a menu list element.
     64                 *
     65                 * @since 4.8.0
     66                 *
     67                 * @param array    $classes The CSS classes that are applied to the menu `<ul>` element.
     68                 * @param stdClass $args    An object of wp_nav_menu() arguments.
     69                 * @param int      $depth   Depth of menu item. Used for padding.
     70                 */
     71
     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}";
    6277        }
    6378
    6479        /**