Articles of sticky post

Show image if a post is featured

I know that posts that are sticky show on top but I want to add an image to show that is featured is there any code I could use

3 Posts in Loop, Show Stickies First

Okay I am starting to wonder if it is even possible to do this! As I’ve found very little info on the matter online. This is a fresh WP install that I’ve been experimenting on so that I can work in a more simplified environment (rather than try to solve the full problem itself on […]

Knowing if a post is sticky in the 'save_post' action. Where do I have to hook?

I’m using this plugin (FantasticElasticSearch) to index content when it’s published. So far it was strightforward and an easy task but, now that I tried to index a flag saying if a post is sticky, I’m having trouble and it’s being impossible. I’m changing the addOrUpdate function of the plugin to my profit, I’m adding […]

Update a post to remove sticky option

I’m working on a plugin that we’ll remove posts from the ‘sticky posts’. I’ll use the post ID to find it. What function should i use to remove the sticky option after i get this post? Something like this: update_post($id, ‘sticky’, false); (i know the above example won’t work…)

Sticky Post from page 2 and on

Today I updated an old blog post and set it to sticky to show info about the latest changes. It’s a typical post with Site Updates as the title for a log of a sort you could say, with past changes listed by date. What I discovered was if the post originates from page two […]

get_previous_post() while accounting for sticky posts

Let’s say I have the posts foo, bar and baz. They are published in the following order: 1. foo 2. bar 3. baz If I call get_previous_post() while on the single.php of baz, I’ll get bar. I set bar as sticky. Now, the posts are ordered like so: 2. bar 1. foo 3. baz If […]

How to remove only the latest sticky post from the loop

I know how to remove all of the sticky posts from a loop using the following argument ‘post__not_in’ => get_option( ‘sticky_posts’ ), But I am stuck in a problem. I want the loop to load all of the sticky posts except the latest one. That means only the latest sticky post won’t render in the […]

How to retrieve “sticky” post outside the “loop”?

I need to display the “sticky” post in a section that is outside the “loop“. Can someone tell me how to do this?

How to display sticky post with custom html

I’d like to display 9 posts and be able to insert a sticky post with its custom html template in between 4th & 5th post. Currently the sticky post gets displayed in both the “sticky container” and regular posts. have_posts()) : $my_query->the_post(); ?> <?php if ($count <= 9 ){ ;?> <article> <?php echo get_the_content(); ?> […]

Can't get pagination to work for sticky posts only

I don’t get my pagination to work. I need to filter my posts on sticky posts and display only two per page. Tried almost everything but can’t get it to work. It is totally ignoring my posts_per_page setting. Anyone got a suggestion? <?php query_posts(array(‘posts_per_page’ =>2, ‘paged’ => get_query_var(‘page’), ‘post__in’=>get_option(‘sticky_posts’))); ?> <?php if (have_posts()) : while […]