Skip to content

Instantly share code, notes, and snippets.

@dionysia
Created February 11, 2013 09:57
Show Gist options
  • Save dionysia/4753591 to your computer and use it in GitHub Desktop.
Save dionysia/4753591 to your computer and use it in GitHub Desktop.
To highlight current page in WP navigation menu
1. In css file,include this line where
- nav is the id of <nav> tag, [mentioned my menus in header.php]
<nav id="nav">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav>
#nav li.current_page_item a {
-moz-border-radius: 3px 3px 3px 3px;
background-color: #82BD42;
color: #FFFFFF !important;
padding: 10px;
text-decoration: none;
}
2. Change attributes as desired
**From http://stackoverflow.com/questions/5339820/highlight-menu-item-when-viewing-single-post-wordpress?lq=1 by user
Vijaya Narayanasamy**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment