-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple menu items are being highlighted as current page #18
Comments
same problem here. |
@xrdm do you have a link to your site? |
yes it's on mainteinance but if you need I can make it visible for a few minutes |
yes please, a link will help. |
@crftwrk "Articoli" are standard wp posts thank you |
this is the snippet for active class in my class-bootstrap-5-navwalker.php
|
Please switch v1.3.3 release https://github.com/AlexWebLab/bootstrap-5-wordpress-navbar-walker/releases/tag/v1.3.3, just for testing. |
yes it works |
It's the |
now with 1.3.4 it's again not correct maybe :) |
Im running into the same issue here. I have the latest version of the walker. When on a custom post type single the blog link A in the nav is getting the active class, not the custom post type archive. When I am on the custom post type archive page both the blog and cpt archive get the active class in the nav. |
I'm facing the same problem. Actually, I have a kind of single-page website. All the navbar menu items scroll to a specific section of the page. The problem is all links have the active class. The website is available here: http://development.8x.com/ Does anyone have the solution? Thanks |
That's because you use full URL in menu
function add_scrollspy() {
if( is_page('2257') ) { // Page id
echo "<script>
jQuery(document).ready(function ($) {
var scrollSpy = new bootstrap.ScrollSpy(document.body, {
target: '#top-section',
offset: 58
})
});
</script>\n";
}
}
add_action( 'wp_footer', 'add_scrollspy', 0 );
Does this help? |
Thanks. It worked @crftwrk |
I have the same issue. When on a CPT archive the 'active' class is also added to the blog archive link. Seems the walker is not currently compatible with WordPress custom post types? |
The problem it's not in the walker code, the core |
The I suggest replacing the line $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); with $item->classes = apply_filters('nav_menu_css_class', array_filter($classes), $item, $args);
$class_names = join(' ', $item->classes); |
Hi, I was getting the same multiple highlighting issue, switching to v1.3.3 fixed it, thanks 😃 |
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
This is the code I'm currently using in header.php:
I'm not sure what else info you would need, but if something is missing just let me know. Thnx!
The text was updated successfully, but these errors were encountered: