WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13666 closed defect (bug) (fixed)

"sticky" shouldn't be added to paged posts

Reported by: iandstewart Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch
Focuses: Cc:

Description

Sticky posts are routinely styled by WordPress themers with the "sticky" class added to get_post_class if a post is sticky and it's in the blog loop (is_home). But, currently, that means paged posts are also getting "sticky" styles and appearing like "sticky" posts out of joint.

Attached is a diff checking to see if a post is paged before adding sticky to the array of post classes

Attachments (1)

paged-sticky-class.diff (423 bytes) - added by iandstewart 4 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 ryan4 years ago

Stickies are only fetched in WP_Query::get_posts() if page <= 1, so I think this is safe.

comment:2 ryan4 years ago

That line was last changed when #7712 introduced is_home(). !is_paged() seems like a good addition.

comment:3 ryan4 years ago

  • Milestone changed from Unassigned to 3.0

comment:4 ryan4 years ago

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

(In [15088]) Don't add sticky class if is_paged(). Props iandstewart. fixes #13666

Note: See TracTickets for help on using tickets.