Opened 23 months ago

Last modified 13 months ago

#18035 new enhancement

ignore_sticky_posts fails to remove sticky class

Reported by: mikkelbreum Owned by:
Priority: normal Milestone: Future Release
Component: General Version: 3.2
Severity: minor Keywords: has-patch commit
Cc: mikkel@…

Description

When setting the query_posts parameter:

ignore_sticky_posts = 1

all sticky posts are returned as normal posts and placed accordingly in the flow. However the sticky posts keep their sticky class, which means that an additional filtering of post_class is necessary to avoid any css rules defined for the .sticky selector taking effect.

is this intended, or could it be considered an enhancement if it was patched?

Attachments (1)

18035.patch (607 bytes) - added by jakub.tyrcha 23 months ago.

Download all attachments as: .zip

Change History (10)

  • Keywords 2nd-opinion removed

As far as I can tell, the sticky class is the only thing that allows you to style a sticky post.

Therefore, posts that are displayed normally shouldn't have the sticky class.

Judging by the syntax of the get_post_class() function, it does look like it shouldn't apply in this case:

345	        // sticky for Sticky Posts
346	        if ( is_sticky($post->ID) && is_home() && !is_paged() )
347	                $classes[] = 'sticky';
  • Keywords has-patch added; needs-patch removed

is_sticky doesn't check for ignore_sticky_posts ;) patch attached

Good catch, but you can just write

&& !get_query_var('ignore_sticky_posts')

Updated :)

When uploading a new version of a patch, don't overwrite the old one, so that context is preserved.

  • Cc mikkel@… added

Theres a patch provided here (18035), but it hasn't been implemented as of WP 3.3. Any reason?

  • Keywords commit added
  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.