WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#39558 new enhancement

A lot of menu classes (and id's) are missing when there's no menu set for a location

Reported by: benoitchantre Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Menus Keywords:
Focuses: template Cc:
PR Number:

Description

When a fallback menu is displayed because no menu is set to a location, a lot of the CSS classes are removed, compared to the same menu when the location is set.

Would it be possible for a fallback menu to have the same classes than a menu with a location?
It would allow theme developers to use classes instead of tags to style the menu.

Fallback menu

<div id="primary-menu" class="menu">
	<ul>
		<li class="page_item page-item-3"><a href="test.dev/accueil/">Accueil</a></li>
		<li class="page_item page-item-703"><a href="test.dev/blog/">Blog</a></li>
		<li class="page_item page-item-4"><a href="test.dev/contact/">Contact</a></li>
		<li class="page_item page-item-701 current_page_item"><a href="test.dev/">Front Page</a></li>
		<li class="page_item page-item-2 page_item_has_children"><a href="test.dev/about/">About The Tests</a>
			<ul class="children">
				<li class="page_item page-item-1133"><a href="test.dev/about/page-image-alignment/">Page Image Alignment</a></li>
				<li class="page_item page-item-1134"><a href="test.dev/about/page-markup-and-formatting/">Page Markup And Formatting</a></li>
				<li class="page_item page-item-501"><a href="test.dev/about/clearing-floats/">Clearing Floats</a></li>
				<li class="page_item page-item-155"><a href="test.dev/about/page-with-comments/">Page with comments</a></li>
				<li class="page_item page-item-156"><a href="test.dev/about/page-with-comments-disabled/">Page with comments disabled</a></li>
			</ul>
		</li>
		<li class="page_item page-item-174 page_item_has_children"><a href="test.dev/level-1/">Level 1</a>
			<ul class="children">
				<li class="page_item page-item-173 page_item_has_children"><a href="test.dev/level-1/level-2/">Level 2</a></li>
				<li class="page_item page-item-742"><a href="test.dev/level-1/level-2a/">Level 2a</a></li>
				<li class="page_item page-item-744"><a href="test.dev/level-1/level-2b/">Level 2b</a></li>
			</ul>
		</li>
		<li class="page_item page-item-146"><a href="test.dev/lorem-ipsum/">Lorem Ipsum</a></li>
		<li class="page_item page-item-733"><a href="test.dev/page-a/">Page A</a></li>
		<li class="page_item page-item-735"><a href="test.dev/page-b/">Page B</a></li>
	</ul>
</div>

Menu with a location

<div class="menu-container">
	<ul id="primary-menu" class="menu">
		<li id="menu-item-1708" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-701 current_page_item menu-item-1708"><a href="test.dev/">Front Page</a></li>
		<li id="menu-item-1705" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1705"><a href="test.dev/level-1/">Level 1</a></li>
		<li id="menu-item-1706" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1706"><a href="test.dev/level-1/level-2/">Level 2</a>
		<ul class="sub-menu">
			<li id="menu-item-1709" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1709"><a href="test.dev/level-1/level-2a/">Level 2a</a></li>
			<li id="menu-item-1710" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1710"><a href="test.dev/level-1/level-2b/">Level 2b</a></li>
		</ul>
		</li>
		<li id="menu-item-1713" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1713"><a href="test.dev/contact/">Contact</a></li>
	</ul>
</div>

Change History (1)

Note: See TracTickets for help on using tickets.