It's a problem to create a dynamic menu in my blog.
Used as a documentation: http://codex.wordpress.org/Dynamic_Menu_Highlighting
My code:
<?php /* Dynamic Menu Highlighting - CSS */
if ( is_home() ) { $current = 'home'; }
elseif ( in_category(10) || in_category (11) || in_category (12) ) { $current = 'new'; }
elseif ( in_category(20) || in_category (21) ) { $current = 'games'; }
else { $current = 'others'; }
?>
The menu worked, but the problem is when I make a publication in two different categories parents, then if I published the same post in the category 'games' (20), sub-category 'online games' (21) and also in the category child 'news' (12) that is within the category default (10), and when user enters the category games (www.myblog.com/category/games), instead of highlighting the link games, highlighting the link default (as if you were on (www.myblog.com/category/default).
I think I get it correct, is missing define any further condition in the code, someone could help me?