Make WordPress Core

Ticket #40761: 40761.diff

File 40761.diff, 1.1 KB (added by rahulsprajapati, 7 years ago)

harmonize the css filters available in the 3 main Walker classes.

  • src/wp-includes/class-walker-category.php

    diff --git a/src/wp-includes/class-walker-category.php b/src/wp-includes/class-walker-category.php
    index 01b7264..633ea33 100644
    a b class Walker_Category extends Walker { 
    5757                        return;
    5858
    5959                $indent = str_repeat("\t", $depth);
    60                 $output .= "$indent<ul class='children'>\n";
     60
     61                // Default CSS class.
     62                $classes = array( 'children' );
     63
     64                /**
     65                 * Filters the CSS class(es) applied to a category children list element.
     66                 *
     67                 * @since 4.8.0
     68                 *
     69                 * @param array $classes The CSS classes that are applied to the menu `<ul>` element.
     70                 * @param array $args    Array of optional arguments. See wp_list_categories().
     71                 * @param int   $depth   Depth of category. Used for tab indentation. Default 0.
     72                 */
     73                $class_names = join( ' ', apply_filters( 'category_children_list_css_class', $classes, $args, $depth ) );
     74                $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
     75
     76                $output .= "$indent<ul $class_names>\n";
    6177        }
    6278
    6379        /**