WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 10 years ago

#2959 closed defect (bug) (fixed)

wp_list_pages does not add current_page_item class on page_for_posts

Reported by: skeltoac Owned by: mdawaffe
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Template Keywords: has-patch
Focuses: Cc:

Description

Menus that rely on wp_list_pages are broken when page_for_posts is accessed.

Attachments (2)

posts-page.diff (1.6 KB) - added by skeltoac 13 years ago.
2959.diff (508 bytes) - added by mdawaffe 11 years ago.

Download all attachments as: .zip

Change History (21)

@skeltoac
13 years ago

#1 @skeltoac
13 years ago

  • Keywords has-patch 2nd-opinion added
  • Owner changed from anonymous to skeltoac
  • Status changed from new to assigned

Attached patch introducing $wp_query->is_posts_page and modifying $wp_query->get_queried_object().

#2 @ryan
13 years ago

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

(In [4023]) Fix current page handling when using page_for_posts. Props skeltoac. fixes #2959

#3 @francesconegri
12 years ago

  • Milestone changed from 2.1 to 2.1.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

current_page_item is again _not set_ on page_for_posts in 2.1.1
(it worked in 2.1)

#4 @jhodgdon
12 years ago

See also #3910 - a duplicate of this bug.

So I finally understand how to reproduce the bug (and agree it is a bug):

a) Make a few pages in WordPress

b) On the Options / Reading page, choose one of your pages to be the "posts page", and update.

c) Make sure wp_list_pages is in the blog sidebar for your theme.

d) Visit the blog page. Click on the page that you chose as the "posts page", and you will see posts, but the CSS class for the LI in the posts list on the right is not set to be "current_page_item". Click on a different page, and when that page is displayed, the LI class is set to "current_page_item".

Is that right? I'll test the patch above.

#5 follow-up: @jhodgdon
12 years ago

Apparently, [4956] took the changes from [4023] back out, to fix #3885 ... thereby reopening this bug instead.

#6 @ryan
12 years ago

  • Owner changed from skeltoac to ryan
  • Status changed from reopened to new

#7 in reply to: ↑ 5 @dwzemens
12 years ago

Replying to jhodgdon:

Apparently, [4956] took the changes from [4023] back out, to fix #3885 ... thereby reopening this bug instead.

jhodgdon: You have described how to duplicate the problem exactly. That is the issue. It worked correctly in 2.1, but not in 2.1.1 --- thanks for taking steps to resolve it.

#8 @redbrandonk
12 years ago

  • Cc redbrandonk added

#9 @foolswisdom
12 years ago

  • Milestone changed from 2.1.4 to 2.2

#10 @Nazgul
12 years ago

  • Keywords needs-patch added; has-patch 2nd-opinion removed

#11 @ryan
12 years ago

  • Milestone changed from 2.2 to 2.3

#12 @ariejan
11 years ago

  • Owner changed from ryan to ariejan
  • Status changed from new to assigned

Ping

Does anyone know why this bug hasn't been fixed yet? Are there any problems in particular that prevent this bug from being fixed?

#13 @lloydbudd
11 years ago

ariejan, "needs-patch"

#14 @betsyk
11 years ago

Hi there. Just wanted to add more info about this bug. Many users have reported and discussed it in the WP forums at: http://wordpress.org/support/topic/107583. I have outlined the troubleshooting steps required to replicate & resolve the problem on my blog at: http://www.umaitech.com/cms/?p=27.

#15 @mdawaffe
11 years ago

  • Owner changed from ariejan to mdawaffe
  • Status changed from assigned to new

#16 @mdawaffe
11 years ago

  • Keywords has-patch added; needs-patch removed
  • Status changed from new to assigned

[4956] and [4023] are unrelated. The regression was caused by [4863] [4864] fixing #3049.

Attached gives the current_page_item class to the page_for_posts page and does not cause a #3049 regression.

@mdawaffe
11 years ago

#17 @ryan
11 years ago

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

(In [7073]) Add current_page_item on page_for_posts. Props mdawaffe. fixes #2959

#18 @sivel
10 years ago

  • Cc redbrandonk removed
  • Milestone changed from 2.5 to 2.8
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.1 to 2.7

This fix only gives the current_page_item class to the blog page when you are on the blog page. The blog page is no longer given current_page_item once you click on one of the posts. This is something that I have seen many users complaining about.

Perhaps we should give the blog page current_page_parent and maybe even current_page_ancestor when on a single post?

#19 @sivel
10 years ago

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

Apologies. It looks like this is already functioning as I had described.

Note: See TracTickets for help on using tickets.