highlighting current-menu-item on single.php
-
Hi there
Here’s a bit of background – for the news section of a site I’m building I’ve created a page (newspage.php) that I use to import post excerpts. The full post then opens up into a category specific single page.
I’ve created a menu using WPs menu system and calling for it using:<?php wp_nav_menu( array( 'container_class' => 'basictab', 'theme_location' => 'primary' ) ); ?>
In the CSS I’m using the following to highlight the current menu item:
.current-menu-item#menu-item-15 a{ /*selected tab effect*/ background-color: #875673; color: #fff; }
This highlights the menu correctly on newspage.php but as I click through to the full post on the single post page then the menu fails to highlight. I’ve also noticed the classes generated by wordpress have disappeared from the source when on the single post page.
At first I though that this was something to do with the way I was bringing posts onto pages but I’ve just double checked – the same issue happens on any page that uses a single post style page. For instance – on my blog section which uses index.php the highlighting works, but on my post detail page which uses single.php the highlighting fails.
Any solutions/work-arounds on this would be appreciated
Many thanks
John
- The topic ‘highlighting current-menu-item on single.php’ is closed to new replies.