Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#9472 closed defect (bug) (fixed)

wp_list_pages() doesn't apply the "current_page_item/parent/ancestor" classes when browsing image/attachment pages

Reported by: minusfive Owned by:
Milestone: 2.8 Priority: high
Severity: major Version: 2.7.1
Component: Themes Keywords: has-patch tested
Focuses: Cc:


When you're browsing an "attachment" page which has been attached to a "Page", that Page and its ancestors don't get the "current_page_item/parent/ancestor" classes they should get when called using wp_list_pages() for navigation.

I simply added the "is_attachment()" conditional tag to the function and it works now. I'm attaching the wp-includes/post-template.php file with the modification applied.

Hope this was the right solution ;)

Attachments (3)

post-template.php (34.3 KB) - added by minusfive 6 years ago.
Change applied to line 624 of wp-includes/post-template.php
post-template.diff (515 bytes) - added by minusfive 6 years ago.
9472.001.diff (803 bytes) - added by aaroncampbell 6 years ago.
Patch with file location in it

Download all attachments as: .zip

Change History (7)

@minusfive6 years ago

Change applied to line 624 of wp-includes/post-template.php

comment:1 @minusfive6 years ago

  • Cc minusfive added
  • Severity changed from normal to major

Finally figured out how to save a diff file (I think) :) Here's the patch.

@minusfive6 years ago

comment:2 @Viper007Bond6 years ago

  • Keywords has-patch added

comment:3 @aaroncampbell6 years ago

  • Keywords tested added; wp_list_pages is_attachment current_page_item current_page_parent current_page_ancestor removed

I tested the patch and it works great. I'm attaching a new diff that should be easier to apply, but it's the same code.

@aaroncampbell6 years ago

Patch with file location in it

comment:4 @ryan6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10947]) Add page classes to page attachments. Props minusfive. fixes #9472

Note: See TracTickets for help on using tickets.