Make WordPress Core

Ticket #29890: 29890.4.diff

File 29890.4.diff, 5.7 KB (added by DrewAPicture, 10 years ago)

'item_descriptions'

  • src/wp-includes/nav-menu-template.php

     
    151151                $item_output = $args->before;
    152152                $item_output .= '<a'. $attributes .'>';
    153153                /** This filter is documented in wp-includes/post-template.php */
    154                 $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
     154                $item_output .= $args->link_before;
     155                $item_output .= apply_filters( 'the_title', $item->title, $item->ID );
     156                if ( $args->show_description ) {
     157                        $item_output .= ' <span class="menu-item-description">' . $item->description . '</span>';
     158                }
     159                $item_output .= $args->link_after;
    155160                $item_output .= '</a>';
    156161                $item_output .= $args->after;
    157162
     
    200205 * @param array $args {
    201206 *     Optional. Array of nav menu arguments.
    202207 *
    203  *     @type string        $menu            Desired menu. Accepts (matching in order) id, slug, name. Default empty.
    204  *     @type string        $menu_class      CSS class to use for the ul element which forms the menu. Default 'menu'.
    205  *     @type string        $menu_id         The ID that is applied to the ul element which forms the menu.
    206  *                                          Default is the menu slug, incremented.
    207  *     @type string        $container       Whether to wrap the ul, and what to wrap it with. Default 'div'.
    208  *     @type string        $container_class Class that is applied to the container. Default 'menu-{menu slug}-container'.
    209  *     @type string        $container_id    The ID that is applied to the container. Default empty.
    210  *     @type callback|bool $fallback_cb     If the menu doesn't exists, a callback function will fire.
    211  *                                          Default is 'wp_page_menu'. Set to false for no fallback.
    212  *     @type string        $before          Text before the link text. Default empty.
    213  *     @type string        $after           Text after the link text. Default empty.
    214  *     @type string        $link_before     Text before the link. Default empty.
    215  *     @type string        $link_after      Text after the link. Default empty.
    216  *     @type bool          $echo            Whether to echo the menu or return it. Default true.
    217  *     @type int           $depth           How many levels of the hierarchy are to be included. 0 means all. Default 0.
    218  *     @type object        $walker          Instance of a custom walker class. Default empty.
    219  *     @type string        $theme_location  Theme location to be used. Must be registered with register_nav_menu()
    220  *                                          in order to be selectable by the user.
    221  *     @type string        $items_wrap      How the list items should be wrapped. Default is a ul with an id and class.
    222  *                                          Uses printf() format with numbered placeholders.
     208 *     @type string        $menu              Desired menu. Accepts (matching in order) id, slug, name. Default empty.
     209 *     @type string        $menu_class        CSS class to use for the ul element which forms the menu. Default 'menu'.
     210 *     @type string        $menu_id           The ID that is applied to the ul element which forms the menu.
     211 *                                            Default is the menu slug, incremented.
     212 *     @type string        $container         Whether to wrap the ul, and what to wrap it with. Default 'div'.
     213 *     @type string        $container_class   Class that is applied to the container. Default 'menu-{menu slug}-container'.
     214 *     @type string        $container_id      The ID that is applied to the container. Default empty.
     215 *     @type callback|bool $fallback_cb       If the menu doesn't exists, a callback function will fire.
     216 *                                            Default is 'wp_page_menu'. Set to false for no fallback.
     217 *     @type string        $before            Text before the link text. Default empty.
     218 *     @type string        $after             Text after the link text. Default empty.
     219 *     @type string        $link_before       Text before the link. Default empty.
     220 *     @type string        $link_after        Text after the link. Default empty.
     221 *     @type bool          $echo              Whether to echo the menu or return it. Default true.
     222 *     @type int           $depth             How many levels of the hierarchy are to be included. 0 means all. Default 0.
     223 *     @type object        $walker            Instance of a custom walker class. Default empty.
     224 *     @type string        $theme_location    Theme location to be used. Must be registered with register_nav_menu()
     225 *                                            in order to be selectable by the user.
     226 *     @type string        $items_wrap        How the list items should be wrapped. Default is a ul with an id and class.
     227 *                                            Uses printf() format with numbered placeholders.
     228 *     @type bool          $item_descriptions Whether to show menu item descriptions. Default false.
    223229 * }
    224230 * @return mixed Menu output if $echo is false, false if there are no items or no menu was found.
    225231 */
     
    228234
    229235        $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '',
    230236        'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
    231         'depth' => 0, 'walker' => '', 'theme_location' => '' );
     237        'depth' => 0, 'walker' => '', 'theme_location' => '', 'item_descriptions' => false );
    232238
    233239        $args = wp_parse_args( $args, $defaults );
    234240        /**