WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#13997 closed enhancement (wontfix)

wp_nav_menu enhancement

Reported by: Kaiey Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: needs-patch 2nd-opinion dev-feedback
Focuses: Cc:

Description

Additional parameters need to be added to wp_nav_menu.

When trying to convert my theme that used wp_list_pages to generate navigation to wp_nav_menu I noticed I was unable to list the children of ("child_of" parameter) a specific menu item.

This was problematic as my theme displayed the children pages for the parent of the current page.

wp_nav_menu should be extended to include as mentioned at http://www.wptavern.com/forum/general-wordpress/1506-any-news-v3-2.html#post14806

<?php $args = array( 
    'depth'        => 0, 
    'show_date'    => , 
    'show_pages'     => 0, // defaults to TRUE, set to FALSE to display a menu of only cats or links 
    'show_cats'     => 0, // defaults to FALSE, set to TRUE to include categories 
    'show_linkcats'     => 0, // defaults to FALSE, set to TRUE to include links (by link category) 
    'date_format'  => get_option('date_format'), 
    'child_of'     => 0, 
    'child_of_cat'     => 0, // categories that are children of specified Category ID 
    'child_of_linkcat'     => 0, // links that are children of specified LinkCat ID 
    'exclude'      => , 
    'exclude_cat'      => , // categories to exclude, if including categories 
    'exclude_linkcat'      => , // link categories to exclude, if including links 
    'include'      => , 
    'include_cat'      => , // categories to include explicitly; used with show_cats 
    'include_linkcat'      => , // link categories to include explicitly; used with show_linkcats 
    'title_li'     => __('Pages'), 
    'echo'         => 1, 
    'authors'      => , 
    'sort_column'  => 'menu_order, post_title', 
    'link_before'  => , 
    'link_after'   => , 
    'exclude_tree' => , 
    'exclude_cat_tree' => , // exclude specified category tree; used with show_cats 
    'exclude_linkcat_tree' =>  // exclude specified link category tree; used with show_linkcats 

Change History (9)

comment:1 @Kaiey5 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

comment:2 @Kaiey5 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

comment:3 @ocean905 years ago

  • Keywords menu extension children removed
  • Milestone changed from 3.0.1 to Future Release
  • Priority changed from high to normal

3.0.1 will be a maintenance release.
Also related to #13793

comment:4 follow-up: @kaiey5 years ago

  • Keywords needs-patch added
  • Milestone changed from Future Release to 3.1

It's ridiculous that the new menu system doesn't include all of the functionality that is in wp_list_pages, wp_list_categories and wp_page_menu. This functionality needs to be included in the next release.

comment:5 in reply to: ↑ 4 ; follow-up: @filosofo5 years ago

Replying to kaiey:

It's ridiculous that the new menu system doesn't include all of the functionality that is in wp_list_pages, wp_list_categories and wp_page_menu. This functionality needs to be included in the next release.

The key difference is that the output of those other functions cannot be customized in the admin; the nav menus can. So you don't need arguments to include or exclude certain pages, categories, etc., because all of that is done with the admin UI.

comment:6 in reply to: ↑ 5 @kaiey5 years ago

Replying to filosofo:

Replying to kaiey:

It's ridiculous that the new menu system doesn't include all of the functionality that is in wp_list_pages, wp_list_categories and wp_page_menu. This functionality needs to be included in the next release.

The key difference is that the output of those other functions cannot be customized in the admin; the nav menus can. So you don't need arguments to include or exclude certain pages, categories, etc., because all of that is done with the admin UI.

While I can understand why this functionality may of been overlooked, it's just stupid to expect users to create multiple menus for menus with the same content. Say you wanted to reuse the header navigation menu for a site within the footer (breadcrumb-style), but want to exclude irrelevant menu items - you shouldn't have to create an entirely new menu.

comment:7 @kaiey5 years ago

  • Keywords 2nd-opinion added

comment:8 @kaiey5 years ago

  • Keywords dev-feedback added

comment:9 @nacin4 years ago

  • Milestone Awaiting Triage deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

I'm going to close as wontfix -- but please note that this is covered in some form by like 3 other overlapping tickets.

Note: See TracTickets for help on using tickets.