Opened 16 years ago
Closed 16 years ago
#7518 closed defect (bug) (fixed)
WordPress is not emitting class="current_page_item" for a page used as static front page display
Reported by: | yanggers | Owned by: | ShaneF |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | minor | Version: | 2.7 |
Component: | General | Keywords: | has-patch tested commit |
Focuses: | Cc: |
Description
The problem is apparent when using themes with navigation headers that lists user-created pages, with the latest posts as "home" or front page by default. One such theme is MistyLook by Sadish, which is widely used both by Wordpress.com and self-setup bloggers. When the user sets the front page to be a static user-created-page, navigating to this "home" front page does not let the header know it is at "home" or front page, not letting the header to highlight the appropriate navigation header.
This problem has been discussed elsewhere, http://wprocks.com/forums/comments.php?DiscussionID=1009, and has been determined to be a Wordpress code issue rather than theme code issue. Specifically, WordPress is not emitting class="current_page_item" for a page used as static front page display.
Attachments (3)
Change History (17)
#2
@
16 years ago
Looks like this has re-surfaced in Trac. Here are the details of this problem: http://www.umaitech.com/cms/?p=27. Also, here's the current fix for WP 2.6: in classes.php, new lines 577-580:
if ( empty($current_page) ) {
if ($page->ID == get_settings('page_for_posts'))
$css_class .= ' current_page_parent';
}
#3
@
16 years ago
- Milestone changed from 2.6.1 to 2.6.2
2.6.1 has been released, moving to 2.6.2 milestone
#4
@
16 years ago
- Owner changed from anonymous to ShaneF
- Status changed from new to assigned
I worked on this myself ont he 2.7.x and DD32 pointed it out. This patch for the 2.7.x line fixes the problem. tested and working per my site: http://bugssite.org/
"Home" is the front page static. http://bugssite.org/
"Blog" is the posts-page. http://bugssite.org/blog/
Blog page now does "Blog | the rabbit hole" when viewing the overall look.
When looking at a single post in the blog the "Blog" tab gets the correct CSS to indicated that it's highlighted.
#7
@
16 years ago
The only "problem" with this is that:
http://bugssite.org/about/ - About "Tab" Highlighted
http://bugssite.org/about/history/ - About "Tab" Highlighted
http://bugssite.org/about/history/wordpress-plugins/ - About "Tab" Not Highlighted since it's parent is "History" and I don't show the history. It might be prudent to do a check to get the root page id as it's going through the steps.
However in my case I do not show the tab "History" in which it would normally display, but I don't.
#8
@
16 years ago
Hi,
I don't believe that solution will resolve the problem. The problem is that it doesn't pass the current_page_parent class and you need to catch all "empty" posts -- not just pick up the class from single posts (pages). This bug and the well-tested fix have been fully documented here since February:
http://www.umaitech.com/cms/?p=27.
Also see #6664. Attached is a revised classes.php file for WP 2.6.2
New lines 577-580:
if ( empty($current_page) ) {
if ($page->ID == get_settings('page_for_posts'))
$css_class .= ' current_page_parent';
}
#9
@
16 years ago
current_page_item appears to already be fixed. The current_page_parent fix looks good. I'll commit that against this ticket and close.
#12
@
16 years ago
...and if you're not doing anything in Feb., come to WordCamp Denver with Matt!
http://denver.wordcamp.org/
tiny video illustration:
http://www.youtube.com/watch?v=EB9O1F5HitI