[wp-trac] [WordPress Trac] #29890: Make menu descriptions available to be displayed on the front-end

WordPress Trac noreply at wordpress.org
Thu Nov 20 06:26:35 UTC 2014


#29890: Make menu descriptions available to be displayed on the front-end
--------------------------------------+-----------------------
 Reporter:  obenland                  |       Owner:  helen
     Type:  enhancement               |      Status:  assigned
 Priority:  normal                    |   Milestone:  4.1
Component:  Menus                     |     Version:  3.0
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch twenty-fifteen  |     Focuses:  template
--------------------------------------+-----------------------

Comment (by philiparthurmoore):

 Yep, exactly this:

 {{{
                         if ( empty( $menu_item->description ) ) {
                                 /**
                                  * Filter a navigation menu item's
 description.
                                  *
                                  * @since 3.0.0
                                  *
                                  * @param string $description The menu
 item description.
                                  */
                                 $menu_item->description = apply_filters(
 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) );
                         }
 }}}

 That's inside of `wp_setup_nav_menu_item`.

 I'm really not sure of how best to handle this, but looking at your latest
 patch in
 https://core.trac.wordpress.org/attachment/ticket/29890/29890.6.diff I'm
 curious why there's no output filter via `nav_menu_description` available
 to `Walker_Nav_Menu`. How would you feel about using `nav_menu_description
 ` in your patch to allow theme developers to filter that output for
 whatever reason?

 For example, if I know that a user is on an old version of WordPress and
 has a ton of trimmed post content stored in his menu descriptions, I could
 modify that output via `nav_menu_description` from within the theme for
 front-end display.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29890#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list