WordPress.org

Ready to get started?Download WordPress

Forums

wrong css class for wp_nav_menu container and menu item (1 post)

  1. vinaykrsharma
    Member
    Posted 1 year ago #

    While creating a new theme for wp:

    I'm calling wp_nav_menu() as below:

    wp_nav_menu(array('theme_location' => 'primary', 'container_class' => 'my_c_menu', 'menu_class' => 'ul_nav_class'))

    and it returns:

    <div class="ul_nav_class"><ul><li class="current_page_item"><a title="Home" href="http://localhost/wordpress4.2/">Home</a></li><li class="page_item page-item-2"><a href="http://localhost/wordpress4.2/?page_id=2">Sample Page</a></li></ul></div>

    expecting:

    <div class="my_c_menu"><ul class="ul_nav_class"><li><a title="Home" href="http://localhost/wordpress4.2/">Home</a></li><li class="page_item page-item-2"><a href="http://localhost/wordpress4.2/?page_id=2">Sample Page</a></li></ul></div>

    but actually I want to setup:

    <div class="my_c_menu"><ul class="ul_nav_class"><li class="active"><a title="Home" href="http://localhost/wordpress4.2/">Home</a></li><li><a href="http://localhost/wordpress4.2/?page_id=2">Sample Page</a></li></ul></div>

Topic Closed

This topic has been closed to new replies.

About this Topic