Support » Themes and Templates » How to add class for current page in the menu?

  • Mitul Patel



    I want to add class for the current page. If someone click over the menu and it opens page then the menu should changes the background-color. Solution would be appreciated.

    M Patel

Viewing 8 replies - 1 through 8 (of 8 total)
  • WPyogi


    Many themes already have a unique page-id class in the body tag. Look there and see. Then you can use that class in the CSS selector. If you post a link to your site, someone can likely offer more specific help.



    Use any inspect tool in your browser like firebug for firefox. Then go the page and choose inspect element after right clicking over the menu item. You’ll see the classes for that element in the html console. Hope it helps. Please reply if it helps or if you need more info on this

    Mitul Patel


    @pvashist75 I didn’t get any inspect element. Is there any another solution for it…..

    I want these type -> To be add class whenever the PRODUCT page is opened.

     <li class="active">PRODUCT</li>


    Ok so i don’t know what kind of menu’s are you using. But i think you need to add css for the “active” class. try adding css background color for class ‘current-menu-item’ and ‘current_page_item’. Mostly these classes are used for what you are trying to do.

    so add .current-menu-item{ background-color: (colorname); } to your css file.

    I don’t know which browser are you using. so try looking for inspect element option in chrome browser. just right click and it will appear in the options.

    Mitul Patel


    @pvashist75….Thanks for your reply. It works with the current_menu_item.

    Really appreciated…. 🙂



    Your most welcome…Happy to help you



    .current-menu-item{ background-color: (colorname); }

    Are there other css commands for the navigation menus as well?

    Moderator Andrew Nevins


    Front-end developer

    Zena1939, you should create a thread if you require support.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to add class for current page in the menu?’ is closed to new replies.