wp-bootstrap-navwalker icon indicating copy to clipboard operation
wp-bootstrap-navwalker copied to clipboard

Active Menu Issue

Open prakash opened this issue 13 years ago • 2 comments

I tried to use Post Category into the Menu and while reading a post, its category does not gets selected (active class) into the menu.

prakash avatar Oct 20 '13 14:10 prakash

Hi, it's not issue, see current class that wordpress created: current-post-ancestor current-menu-parent current-post-parent for ex.

.current-menu-parent {
    background-color: rgba(255,255,255,0.3);
}

yazdi avatar Oct 20 '13 16:10 yazdi

@thapame I did some testing with the WordPress default themes and that word exactly the same way the walker class does. Personally, I prefer not to highlight the menu item for posts as you are not actually on that page.

That said as @yazdi mentioned the walker does output the standard WordPress classnames. This is made extremely simple if you are using LESS to compile your CSS as you can actually reference a class name and its properties inside another class.

.current-post-parent > a {
     .navbar-nav > .active > a;
}

.current-post-parent > a:hover {
     .navbar-nav > .active > a:hover;
}

When you compile this it should automatically apply the bootstrap active styles to the .current-post-parent class.

SideQuestDIY avatar Oct 21 '13 17:10 SideQuestDIY