Make WordPress Core

Changeset 30358


Ignore:
Timestamp:
11/16/2014 07:36:52 AM (12 years ago)
Author:
johnbillion
Message:

Add $depth parameter to the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes filters.

Fixes #19064
Props cyclometh, chriscct7, johnbillion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu-template.php

    r30032 r30358  
    9595                 * @param object $item    The current menu item.
    9696                 * @param array  $args    An array of wp_nav_menu() arguments.
     97                 * @param int    $depth   Depth of menu item. Used for padding.
    9798                 */
    98                 $class_names = join( ' ', (array) apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
     99                $class_names = join( ' ', (array) apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
    99100                $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
    100101
    … …  
    109110                 * @param object $item    The current menu item.
    110111                 * @param array  $args    An array of wp_nav_menu() arguments.
     112                 * @param int    $depth   Depth of menu item. Used for padding.
    111113                 */
    112                 $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
     114                $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth );
    113115                $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
    114116
    … …  
    136138                 *     @type string $href   The href attribute.
    137139                 * }
    138                  * @param object $item The current menu item.
    139                  * @param array  $args An array of wp_nav_menu() arguments.
     140                 * @param object $item  The current menu item.
     141                 * @param array  $args  An array of wp_nav_menu() arguments.
     142                 * @param int    $depth Depth of menu item. Used for padding.
    140143                 */
    141                 $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
     144                $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
    142145
    143146                $attributes = '';
Note: See TracChangeset for help on using the changeset viewer.