how to add active css class to a link in WordPress such that the active menu li will have different color when that link is viewed.
<ul>
<li class=""><a href="/news">News</a></li>
<li class="devider"> </li>
<li class=""><a href="/about">About Us</a></li>
<li class="devider"> </li>
<li><a href="#">Partners</a></li>
<li class="devider"> </li>
<li><a href="/vacancy">Careers</a></li> <li class="devider"> </li>
<li><a target="_blank" href="/webmail">Email Login</a></li>
</ul>
the code you provided is not WordPress it`s just something you added to your “header.php” but you can try something like this for it:
if you have a default WordPress menu the active class in it is called “.current-menu-item” and if you want to change it’s name to let`s say “.active” find the file called “functions.php” and add this to it:
This is the most simple way to solve it. No javascript or anything than just WordPress
Use it just using WordPress built-in boolean function
here is the link from where i got this idea.
http://www.vanseodesign.com/wordpress/hightlight-current-page-wordpress/