Support » Themes and Templates » $args 'menu' => 'main-menu'

  • Resolved Linards

    (@linards)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @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

    ex.

    .current-menu-item,
    .current_page_item {background-color: #FFFFFF;}

    or

    .current-menu-item a,
    .current_page_item a {background-color: #FFFFFF;}

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘$args 'menu' => 'main-menu'’ is closed to new replies.