I found this code on the WordPress Codex recently which i think will be useful.
The code enables you to generate custom classes for specific menu items conditionally.
This way you can use CSS code to change the appearance of each item using conditional tags.
add_filter('nav_menu_css_class' , 'conditional_nav_menu_class' , 10 , 2);
function conditional_nav_menu_class($classes, $item){
if ( is_front_page() AND $item->title == "Home") {
$classes[] = "home-icon";
}
return $classes;
}
Source http://codex.wordpress.org/Function_Reference/wp_nav_menu
Leave a Reply
You must be logged in to post a comment.