WordPress.org

Ready to get started?Download WordPress

Forums

Highlight menu item based on current post. (7 posts)

  1. amatsu
    Member
    Posted 3 years ago #

    Hello. I'd like to highlight an item on the wordpress navigation menu (these are all pages) based on the current post. For instance, I have 5 pages in the nav menu which are 5 people (authors), what I want to do is that when you open a post, if it's written by author #1, then keep the menu #1 highlighted. I don't have any clue as how to do this, all the other information regarding highlighting is for current pages or post categories, which do not interest me.

    If it can't be done by author ID, any other way is fine, like adding a custom field to each post maybe?

    Well, thanks anyway, I'd really like to get this done since our blog is almost finished.

  2. baszer
    Member
    Posted 3 years ago #

    hi,

    this will solve your problem

  3. amatsu
    Member
    Posted 3 years ago #

    That doesn't really help me, I know how to highlight pages, but what I want to do is hightlight a page from the nav menu when you are viewing a post.

  4. baszer
    Member
    Posted 3 years ago #

    what your URL?

  5. amatsu
    Member
    Posted 3 years ago #

    I don't have it online, I work in localhost at the moment.

  6. baszer
    Member
    Posted 3 years ago #

    it should work with the codex page is gave you.

    but you should work with classes
    something like below should work:

    .nav-authors li.current_page_item a{}

  7. AmeoCrisp
    Member
    Posted 2 years ago #

    Have you resolve this, could you share? I have the same problem.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.