Make WordPress Core

Opened 14 years ago

Last modified 4 years ago

#14331 new enhancement

Tweaks to menu setup page

Reported by: mrmist's profile mrmist Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: needs-patch
Focuses: Cc:

Description

It would be great if you could select a parent Page and "Automatically add children" to the menu.

In a similar fashion, it would be great if the Menu could then automatically add any new children Pages created under that Parent.

Change History (15)

#1 @scribu
14 years ago

  • Component changed from General to Menus

#2 @mrmist
14 years ago

  • Keywords needs-patch added
  • Version set to 3.0

#4 @nacin
14 years ago

  • Keywords ux-feedback added
  • Milestone changed from Awaiting Review to Future Release

This was heavily discussed during the 3.0 cycle. Unfortunately, there was no good UX approach to this. Should they be actual menu items created? Or should they be automatically just pulling in any children? Just children, or up to a certain depth? If you just pull in any children to X depth, what about sibling menu items?

Just too many variables, which is why it didn't happen in 3.0, and we settled on the current situation.

We need UX feedback and a patch to continue.

#5 @ottok
12 years ago

I just installed http://wordpress.org/extend/plugins/gecka-submenu/ and the UX is good and it works great. This ticked could be resolved by adapting this plugin in main WP.

#6 @Charlie37
12 years ago

Hello, I just had trouble with Gecka Submenu (PHP errors). This plugin does the same job and works great:
http://wordpress.org/extend/plugins/auto-submenu/

#7 @gregariousjb
10 years ago

4 years ago and this feature still isn't available before plugins.

The alternative is to delete the menu and re-tick all the parent and child menus that you want after moving/changing your pages. Why this feature hasn't been implemented to make this 100x easier is very surprising.

#8 @Stagger Lee
10 years ago

I need this function often, as i often make subcategories of galleries as years, to people.

2010, 2011....2014...etc. Need it just to stop them go in menu manager. I prepare many subcategories in advance.

#9 @section214
9 years ago

I'll agree that the current system isn't perfect (in fact, it's downright obnoxious if you're adding a significant number of menu items), but the problems that Nacin brought up in the past are still valid. How DO you determine how for to take inheritance in menu items? For many users it won't be a problem... Most people don't do a dozen levels of inheritance, but what about those that do? That could magically result in a really screwed up menu hierarchy very quickly.

So, assuming for a moment that such a feature would have to be configurable, how would we do it? Adding a check box to the menu editor indicating that you want to auto-add children is what most plugins do, but that doesn't solve the inheritance issue. Adding a setting for 'number of auto-nested menu items' seems the most logical answer, but how do you handle that? Maybe something like this?

https://s3.amazonaws.com/f.cl.ly/items/0A002S3w340L2S1H3Q1S/Screen%20Shot%202015-03-19%20at%204.20.26%20PM.PNG

#10 @Stagger Lee
9 years ago

Thanks you remanded me about this trac. I found solution, was not very easy to find at Google. Not at all I can say.

This snippet, works wery well. Put all your subcategories in menu editor under parent category. Tweak will make appearance that subcategories disappeared and missing in Menu editor too. But dont mind about it, they are all there and shows directly if they have at least one Post.

add_filter( 'wp_get_nav_menu_items', 'gowp_nav_remove_empty_terms', 10, 3 );
function gowp_nav_remove_empty_terms ( $items, $menu, $args ) {
	global $wpdb;
	$empty = $wpdb->get_col( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE count = 0" );
	foreach ( $items as $key => $item ) {
		if ( ( 'taxonomy' == $item->type ) && ( in_array( $item->object_id, $empty ) ) ) {
			unset( $items[$key] );
		}
	}
	return $items;
}
Last edited 9 years ago by Stagger Lee (previous) (diff)

This ticket was mentioned in Slack in #design by karmatosed. View the logs.


7 years ago

#12 @karmatosed
7 years ago

  • Keywords needs-design added; ux-feedback removed

As menus are part of the focus this year with Customisation, I am going to add a 'needs-design' to this. @melchoyce one maybe for you to consider when you design that area? Interested in your thoughts on this.

This ticket was mentioned in Slack in #design by michelemiz. View the logs.


6 years ago

This ticket was mentioned in Slack in #design by estelaris. View the logs.


4 years ago

#15 @karmatosed
4 years ago

  • Keywords needs-design removed

Work is going on to bring blocks, specifically the navigation block the menu page. As this work is going on, for now removing needs design from this ticket.

Note: See TracTickets for help on using tickets.