Make WordPress Core

Ticket #29890: 29890.3.diff

File 29890.3.diff, 1.9 KB (added by obenland, 10 years ago)
  • 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
     
    220225 *                                          in order to be selectable by the user.
    221226 *     @type string        $items_wrap      How the list items should be wrapped. Default is a ul with an id and class.
    222227 *                                          Uses printf() format with numbered placeholders.
     228 *     @type bool          $show_description 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' => '', 'show_description' => false );
    232238
    233239        $args = wp_parse_args( $args, $defaults );
    234240        /**