Opened 14 years ago
Closed 14 years ago
#13994 closed defect (bug) (fixed)
Menu Item "Home" won't have class "current-menu-item" in case of there are query string in the home url
Reported by: | kamiyeye | Owned by: | filosofo |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
Repro steps:
==========
- Add "Home" to the navigation menu
- Navigate to http://thetestsite/?style=stylename[[BR]]
- Check the css class of "Home" on the navigation menu
Expected:
==========
There is the class "current-menu-item"
Actual:
==========
There isn't the class "current-menu-item"
Desc:
==========
- It works when there are no query string in the url say: http://thetestsite/[[BR]]
- It is related to Changeset 14457
Attachments (2)
Change History (17)
#2
@
14 years ago
Repro steps:
==========
- Add "Home" to the navigation menu
- Navigate to http://thetestsite/?style=stylename
- Check the css class of "Home" on the navigation menu
Expected:
==========
There is the class "current-menu-item"
Actual:
==========
There isn't the class "current-menu-item"
Description:
==========
- It works when there are no query string in the url say: http://thetestsite/
- It is related to Changeset 14457
#4
follow-up:
↓ 5
@
14 years ago
How would you propose that WP go about determining which query strings make a significant-enough change to warrant saying the page is no longer the same? In this example presumably the only change has to do with the active stylesheet, but most query strings change the content.
I propose that any plugins or themes that use these strings take on the responsibility of handling the menu classes, as they're in the best (really--the only) position of being able to make that decision.
#5
in reply to:
↑ 4
@
14 years ago
Query based on request url should have happened this time, can we use query results or relevant methods to handle this problem? is_home()?
#6
@
14 years ago
The problem is not identifying the current query; it's matching it to the menu item's URL.
Menu item's URL: http://site.com/
Requested page: http://site.com/?foo=bar
How should WP know that the second is supposed to be equivalent to the first?
#7
@
14 years ago
I think we are talking about the possibility of resolve this issue, right? Any reason we have to stick to the way by comparing url?
Have a try with is_home() on http://testsite/?que=ry, see true or false.
#8
@
14 years ago
- Keywords has-patch added
- Milestone changed from 3.0.1 to 3.1
Thinking about this some more, I think this could be useful for matching the home URL when pages are involved, too.
Try front-page-current-class.13994.diff
to see if that solves the problem for you.
#13
@
14 years ago
When is this code meant to trigger?
http://trunk.domain/?foo=bar which seems to be what the ticket is talking about doesn't trigger it.
Related #13977