WordPress.org

Make WordPress Core

Ticket #29890: 29890.diff

File 29890.diff, 1.7 KB (added by obenland, 5 years ago)
  • src/wp-includes/nav-menu-template.php

     
    153153                /** This filter is documented in wp-includes/post-template.php */
    154154                $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
    155155                $item_output .= '</a>';
     156                if ( $args->description ) {
     157                        $item_output .= '<span class="menu-item-description">' . $item->description . '</span>';
     158                }
    156159                $item_output .= $args->after;
    157160
    158161                /**
     
    220223 *                                          in order to be selectable by the user.
    221224 *     @type string        $items_wrap      How the list items should be wrapped. Default is a ul with an id and class.
    222225 *                                          Uses printf() format with numbered placeholders.
     226 *     @type bool          $description     Whether to show menu item descriptions. Default false.
    223227 * }
    224228 * @return mixed Menu output if $echo is false, false if there are no items or no menu was found.
    225229 */
     
    228232
    229233        $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '',
    230234        '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' => '' );
     235        'depth' => 0, 'walker' => '', 'theme_location' => '', 'description' => false );
    232236
    233237        $args = wp_parse_args( $args, $defaults );
    234238        /**