Opened 17 years ago
Closed 15 years ago
#6664 closed enhancement (fixed)
Add CSS class 'current_page_parent' for posts when static posts page set
Reported by: | joshgerdes | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | Template | Keywords: | needs-patch reporter-feedback |
Focuses: | Cc: |
Description
The problem arises when you have set a specific page as the ‘posts page’ for the site. When you are on a post the expected result would be for the ‘current_page_parent’ class to be set in the menu for the page you specified as the ‘posts page’ in for the site. This is not the result you get with the release 2.5 version of Wordpress. After a little digging I found the following fixes the issue:
Add these lines to wp-includes/classes.php after line 562:
elseif ($page->ID == get_settings(’page_for_posts’)) $css_class .= ‘ current_page_parent’;
I have attached a patch for this bug. It has been tested again SVN revision 7638.
Attachments (2)
Change History (8)
Note: See
TracTickets for help on using
tickets.
I'm preferring a slightly different version of this solution, which I've been tracking since February on my blog at: http://www.umaitech.com/cms/?p=27. Currently for WP 2.6.2, new lines 577-580 in classes.php:
if ( empty($current_page) ) {
if ($page->ID == get_settings('page_for_posts'))
$css_class .= ' current_page_parent';
}
This also fixes #7518.