WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic menu highlighting with WordPress menus (3 posts)

  1. blicht454
    Member
    Posted 2 years ago #

    Hello,

    I'm using a menu that I created on the backend under appearance > menus. The menu is functioning properly, but I'm just wondering how I can echo a "current" class for each page / menu item. Because I haven't input the links myself, I don't know how to access them.

    Any ideas?

    Thank you.

  2. Peter Wooster
    Member
    Posted 2 years ago #

    The system adds the class current-menu-item to the li containing the menu item.

    /peter

  3. Odenberg
    Member
    Posted 2 years ago #

    I just did that. I put
    li.current-menu-item a {background: black; }
    in my themes css.

Topic Closed

This topic has been closed to new replies.

About this Topic