Open
Description
First, I would like thank you for this amazing contribution! Without it I would be lost :)
Issue:
When the menu item for a custom post type archive (archive-karriar.php) is active, then also the blog menu item (home.php or index.php - which ever used) is hi-lighted as the current menu item.
Strange thing is, this does not happen the other way around - when home.php or index.php menu item is active, the cpt archive is not hi-lighted as current page. Other than that the walker i working flawlessly.
I'm using
- Wordpres 5.8
- Bootstrap 5.1
This is the code I'm currently using in header.php:
<nav id="main-nav" class="navbar navbar-expand-lg fixed-top navbar-light bg-light" aria-labelledby="main-nav-label">
<div class="container-fluid">
<a class="navbar-brand" href="<?php echo site_url(); ?>">
<img src="<?php echo get_theme_file_uri('/img/logo.svg'); ?>" alt="" class="custom-logo">
</a>
<button class="hamburger hamburger--squeeze" type="button" data-bs-toggle="collapse" data-bs-target="#main-menu" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
<div class="collapse navbar-collapse" id="main-menu">
<?php
wp_nav_menu(array(
'theme_location' => 'main-menu',
'container' => false,
'menu_class' => '',
'fallback_cb' => '__return_false',
'items_wrap' => '<ul id="%1$s" class="navbar-nav ms-auto mb-2 mb-md-0 %2$s">%3$s</ul>',
'depth' => 2,
'walker' => new bootstrap_5_wp_nav_menu_walker()
));
?>
</div>
</div>
</nav>
I'm not sure what else info you would need, but if something is missing just let me know. Thnx!
Metadata
Metadata
Assignees
Labels
No labels