Forums
Home / Themes and Templates / $args 'menu' => 'main-menu'
(@linards)
10 years, 5 months ago
Hi,
has anyone have an idea how to add current page for the menu?
I have this code for my pages:
<?php $args = array( 'menu' => 'main-menu', ); wp_nav_menu ( '$args'); ?>
I would like to highlight the current page with some css, but dont know how to add the dynamic class.
Any ideas?
menu on IMGUR
Many thanks.
(@ronangelo)
@linards No need to add your own class for currently displayed pages on the menu as WordPress already outputs some default class you could use. .current-menu-item and .current_page_item
.current-menu-item
.current_page_item
ex.
.current-menu-item, .current_page_item {background-color: #FFFFFF;}
or
.current-menu-item a, .current_page_item a {background-color: #FFFFFF;}
Thank you