WordPress.org

Ready to get started?Download WordPress

Forums

wp_nav_menu page classes applied incorrectly on search (6 posts)

  1. esmi
    Forum Moderator
    Posted 3 years ago #

    Theme : TwentyTen
    Front page: static
    Menu: wp_nav_menu

    When running a search, the current_page_parent or current_page_ancestor class is applied incorrectly to the posts page when, ideally, it should be applied to the front page as set in Settings/Reading.

    Can anyone else confirm this?

  2. Offhand, I don't see anything wrong, but I have a feeling that I'm not correctly comprehending your instructions.

    Have you tested on a separate installation?

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    Tested on 2 installations using TwentyTen. If your site is set to use a static front page and you opt to run a search from (say) the Home page, the current_page_parent class is added to the main posts page. If you run a search from a sub-category, the posts page get the current_page_ancestor class.

    I only spotted this because I was working on a theme that applied different background colors to current_page_parent and current_page_ancestor. In TwentyTen, you need to check the source markup.

    This class application seems illogical to me. A search results page has no direct connection with the main posts page. This is especially true for those who are using WP as a CMS with perhaps only a single catgeory of news-type posts. if anything, these classes should be applied to the static front page.

    It's as if the core devs confused is_front_page with is_home, if you know what I mean...

  4. It's as if the core devs confused is_front_page with is_home, if you know what I mean.

    Oddly enough, that makes perfect sense to me. Sounds like an easy mistake to make.

    Since it's a core theme, you should probably file a ticket in Trac.

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    I will. I was just looking for some independent confirmation first. My Trac record is about 3:0.

  6. I've tested it out, and I think I see what you're saying, but I'm just going to leave it at "I think," because the part of my brain that interprets code is not operating at peak efficiency today.

Topic Closed

This topic has been closed to new replies.

About this Topic