[wp-trac] [WordPress Trac] #58857: Menu class should be in BODY tag

WordPress Trac noreply at wordpress.org
Thu Jul 20 03:57:48 UTC 2023


#58857: Menu class should be in BODY tag
-------------------------+-----------------------------
 Reporter:  LukeDouglas  |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Menus        |    Version:  6.2.2
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Currently, if you assign a class to a menu item, the class is only usable
 to the menu link alone.  It would be 'very' beneficial to have the class
 in the BODY tag.  If you want to keep them separate, you could preface the
 class with 'body-'.

 So I have a menu link for 'Sponsors' and I assign the class 'g-sponsor' to
 the menu link.

 Right now, it would show similar to this:

 <li class="g-menu-item g-menu-item-648 g-menu-item-type-taxonomy
 g-sponsors">
 <a class="g-menu-item-container"
 href="https://ochs.band/category/donations/sponsors/">
 <span class="g-menu-item-content">
 <span class="g-menu-item-title">Sponsors</span>
 </span>
 </a>
 </li>

 It would be great to have it added to the body class like this:

 <body class="gantry g-offcanvas-left g-home g-sponsors g-style- home page-
 template-default page page-id-13 logged-in site outline-home dir-ltr">

 This the class can be use for 'any' element on the page instead of just
 the menu link.

 FYI, I have a lot of experience in Joomla and they have had this
 functionality since the beginning.  Now that I am migrating all Joomla
 websites to WordPress, I no longer have this functionality.

 It should be a core function of the menu class.

 Just a suggestion.

 Luke Douglas
 Webbering.com

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58857>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list