Looper + Sticky Posts: Condition Workaround

Hi there! I’ve created a blog layout for a site and am having trouble with sticky posts – it wasn’t behaving how I was expecting it to with all sticky posts at the top of the blog page (also filtered by category if user is on that category page).

I created a workaround where using Looper Consumer and ACF on two versions of the post, one for sticky posts with the conditions “{{dc:acf:post_field field=“make_post_sticky”}} IS Yes” and another for regular posts where this condition IS NOT Yes – but for some reason it’s only showing the most recent post, rather than this and three others with this field checked. I am not sure what I am doing wrong…

See secure note for login credentials.

Many thanks!

Hello Rose,

Thanks for writing in! Instead of using the ACF field to make the post sticky, you can utilize the built-in WP feature.

This will ensure that the WordPress loop will generate the sticky posts first before the rest of the normal post items. You will have to keep in mind that WordPress loop or the Looper will only return the recent items. Even if you can filter them out, when those posts are not returned by the loop because they are not the most recent items, nothing will display. This is I think what happens to your current layout.

Best Regards.

Hi thanks for this info. So are you saying that only the most recent sticky post will show at the top? I think this is what I was seeing but I as trying to pin ALL posts that are “sticky” to the top as these are classed as key info for their customers – is there a way to achieve this at all?

Hi Rose,

It shows all the Sticky posts first and then others, I have created a Test page and added the following Query String in the Looper Provider and set the first two Post as Sticky and it shows at the top of the list.

Hope it helps.
Thanks

Thank you – this seems to work fine on the main blog page, but can I get this to also apply on specific category pages? The same layout is used throughout all archives so I would have expected the sticky posts to apply there too?

Hi Rose,

You can use the same anywhere.

Thanks

Thanks – so can you explain why not all sticky posts appear on category pages?

Hi Rose,

All the sticky posts which have that specific category will be shown on the specific category page.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.