I'm having problems with adding active class to wordpress menu. (If is home highlight home, if blog highlight blog and so on... )
I'm using superfish menu.
I have this in my functions.php
function me_register_menu() {
register_nav_menu('main-menu', __('Main Menu'));
}
add_action( 'init', 'me_register_menu' );
And in my header, where my menu is
<?php
if ( has_nav_menu ( 'main-menu' ) ) {
wp_nav_menu( array ( 'theme_location' => 'main-menu' , 'container_class' => 'grid_7', 'container_id' => 'menu' , 'menu_class' => 'menu sf-menu') );
}
?>
I'd like to add .active class to my active menu. Any ideas how?
You can do it with css. It's hard to say without seeing your page, but this should work:
/* Highlight using list element */
.menu-item a:active{
background:#999 !important;
color:#fff;
}
/* Highlight using link element */
.menu-item:active {
text-decoration:underline;
background:#666 !important;
}