Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Query Loop Sticky Posts

  • Hi there,

    I am using GB query loop and a grid layout to display posts by category on specific pages. The sticky post function doesn’t seem to pin posts to the top. I have looked through various support threads and tried various solutions suggested without success, including this one: https://generatepress.com/forums/topic/query-loop-and-ensuring-a-single-sticky-post-is-being-shown/

    Am I missing something?

    Thank you,
    n*

  • Hi there,

    simply put, WordPress doesn’t support sticky posts anywhere other than the main query.
    Once the query is modified eg. a taxonomy > category parameter then sticky posts are not shown.

    The way it works, WP takes the ID of any sticky posts, and saves them in the 'sticky_posts' option in your database, and then it splices those IDs straight into the top of the main query.

    The posts themselves have no idea they are sticky, so its not ( easily ) possible to show only sticky posts that match your query.

    If theres not a huge amount of posts to display then perhaps use two loops, one where you can set the featured post, and the other where you display the rest of the posts.

    Alternatively you could use a custom field or post tag to mark the posts, and then we can look at some PHP to filter the query accordingly.

    Let me know

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.