Opened 23 months ago
Last modified 13 months ago
#18035 new enhancement
ignore_sticky_posts fails to remove sticky class
| Reported by: |
|
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)
Change History (10)
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';
comment:3
jakub.tyrcha — 23 months ago
- 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')
jakub.tyrcha — 23 months ago
comment:5
jakub.tyrcha — 23 months ago
Updated :)
When uploading a new version of a patch, don't overwrite the old one, so that context is preserved.
comment:7
jakub.tyrcha — 23 months ago
OK.
comment:8
mikkelbreum — 13 months ago
- Cc mikkel@… added
Theres a patch provided here (18035), but it hasn't been implemented as of WP 3.3. Any reason?
comment:9
SergeyBiryukov — 13 months ago
- Keywords commit added
- Milestone changed from Awaiting Review to Future Release

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.