I am facing this particular problem: How can I change the color of the navigation bar once the user clicks to one particular menu?, i.e., (I make click on the menu "Contact" and the navigation bar changes color to gray).
I found few articles to this problem but just one that got my attention: http://bit.ly/1Ku8hFT . It briefly says that the header.php file can allow this effect by modifying it with the is_page() function. FYI, I also examined the code from that file and I put below the specific lines of code that I believe I should put the condition to get the desired effect.
<nav id="site-navigation" class="main-navigation top-navigation" role="navigation"> <?php $anyMenu = get_terms( 'nav_menu' ) ? true :false; $menuSelect = get_theme_mod('my_theme_tho_header_menu_select'); if ( $anyMenu && ( ( $menuSelect ) && ( $menuSelect !== 'none' ) ) ) : wp_nav_menu( array( 'menu' => $menuSelect, 'container_class' => 'header-menu' ) ); elseif ( $anyMenu && ( !$menuSelect || ( $menuSelect == 'none' ) ) ) : $menu = get_terms( 'nav_menu' ); $menu_id = $menu->term_id; wp_nav_menu( array( 'menu_id' => $menu_id ) ); elseif ( !$anyMenu ) : wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); endif; ?> </nav><!-- #site-navigation -->
I would like to know if someone has a better idea to get the desired effect I want (such as a plugin or if I need to look into another .php file and add some code rather than this one since I am not fully convinced that by modifying the header.php I will get the result. Lastly, the Word Press version I am running is 4.2.3.
All your comments, feedback and solutions will be totally appreciated.