Make WordPress Core

Ticket #44923: 44923.2.patch

File 44923.2.patch, 1.3 KB (added by Shizumi, 6 years ago)
  • wp-includes/class-walker-comment.php

    diff --git a/wp-includes/class-walker-comment.php b/wp-includes/class-walker-comment.php
    index 87834f5..c0d4bd3 100644
    a b class Walker_Comment extends Walker { 
    5555        public function start_lvl( &$output, $depth = 0, $args = array() ) {
    5656                $GLOBALS['comment_depth'] = $depth + 1;
    5757
     58                // Default class.
     59                $classes = array( 'children' );
     60
     61                /**
     62                 * Filters the CSS class(es) applied to a comments element.
     63                 *
     64                 * @since 4.9.9
     65                 *
     66                 * @param array    $classes The CSS classes that are applied to the comment  element.
     67                 * @param stdClass $args    Uses 'style' argument for type of HTML list. Default empty array.
     68                 * @param int      $depth   Depth of the current comment. Default 0.
     69                 */
     70                $class_names = join( ' ', apply_filters( 'comment_list_sublist_class', $classes, $args, $depth ) );
     71                $class_names = $class_names ? sprintf( ' class="%s"', esc_attr( $class_names ) ) : '';
     72
    5873                switch ( $args['style'] ) {
    5974                        case 'div':
    6075                                break;
    6176                        case 'ol':
    62                                 $output .= '<ol class="children">' . "\n";
     77                                $output .= '<ol' . $class_names . '>' . "\n";
    6378                                break;
    6479                        case 'ul':
    6580                        default:
    66                                 $output .= '<ul class="children">' . "\n";
     81                                $output .= '<ul' . $class_names . '>' . "\n";
    6782                                break;
    6883                }
    6984        }