question | inserting a div in the menu?
-
Good afternoon,
I want to add
<div data-href="first submenu link" > </div>
to each main WordPress menu item. With javascript it should then link toward the first link in the submenu. It’s the same idea like the menu in our current website (which we are moving away from)
I’ve been trying to find the code in header.php but it seems to point somewhere else???
<!-- START nav container --> <nav class="nav primary-nav" id="primary-nav" role="navigation"> <?php wp_nav_menu( array( 'theme_location' => 'primary_inlay', 'container' => '', 'fallback_cb' => 'onecom_add_nav_menu', ) ); ?> </nav>
There is also the wp-includes/nav-menu-template.php
I’m not sure where to start when looking at that? I created a child theme and it would amazing to have a file there make this adjustment ??
I’m reading a lot about
wp_nav_menu
but haven’t found the place to put this yet.Some tips / help would be great!
PS: Why do I want this? Well, it is surprisingly SEO friendly and fits our brand
PS2: When I used ideas in the forum like adding javascript: void(0); in the link, it broke the permalinks of the subitems. That’s why a <div> is probably the way to go.
- This topic was modified 6 years, 1 month ago by .
- This topic was modified 6 years, 1 month ago by .
- This topic was modified 6 years, 1 month ago by .
- This topic was modified 6 years, 1 month ago by .
The page I need help with: [log in to see the link]
- The topic ‘question | inserting a div in the menu?’ is closed to new replies.