Make WordPress Core

Opened 16 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's profile joshgerdes Owned by: ryan's profile 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)

classes.diff (675 bytes) - added by joshgerdes 16 years ago.
classes.php (25.2 KB) - added by betsyk 16 years ago.
I don't have Trac installed, so here's an updated classes.php file for WP 2.6.2.

Download all attachments as: .zip

Change History (8)

@joshgerdes
16 years ago

#1 @ryan
16 years ago

  • Owner changed from anonymous to ryan

#2 @DD32
16 years ago

  • Milestone set to 2.6

#3 @betsyk
16 years ago

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.

@betsyk
16 years ago

I don't have Trac installed, so here's an updated classes.php file for WP 2.6.2.

#4 @Denis-de-Bernardy
15 years ago

  • Component changed from General to Template

isn't this fixed already?

#5 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch reporter-feedback added; has-patch tested removed
  • Milestone changed from 2.9 to Future Release
  • Type changed from defect (bug) to enhancement

needs a refresh, if not

#6 @scribu
15 years ago

  • Milestone changed from Future Release to 2.9
  • Resolution set to fixed
  • Status changed from new to closed

Already fixed.

Note: See TracTickets for help on using tickets.