Aleš Sýkora / November 28, 2023 / 6 comments

Featured (sticky) posts query with Oxygen Advanced Query Builder

Post summary: If you create custom grids with posts, you may need to display the Featured Sticky Posts in some cases. This can be done with Oxygen Builders advanced query builder for repeaters and easy posts. I will continue to add examples of queries continuously. Here is the first query: Featured (sticky) posts query If you want…

If you create custom grids with posts, you may need to display the Featured Sticky Posts in some cases. This can be done with Oxygen Builders advanced query builder for repeaters and easy posts. I will continue to add examples of queries continuously. Here is the first query:

Featured (sticky) posts query

If you want to display only sticky posts in repeater, then construct your query like this:

  • post_type
    • post
  • meta_query
    • key = featured
    • value = 1
  • (optional disable pagination) no_found_rows = true
  • (optional add offset) offset = 1
Featured posts query with Oxygen Advanced Query Builder

Need to ignore sticky (featured) posts in query?

If you want to display your WordPress posts without featured posts, then add the ignore_sticky_posts option to your advanced query builder:

  • post_type
    • post
  • ignore_sticky_posts = true
  • (optional disable pagination) no_found_rows = true
Ignore sticky featured posts in advanced Oxygen query builder

Fuel my passion for writing with a beer🍺

Your support not only makes me drunk but also greatly motivates me to continue creating content that helps. Cheers to more discoveries and shared success. 🍻

6 comments

  • Christopher Bomar

    If someone wanted only to display only the most recent x number of sticky posts, what would they need to add or modify to make that work?

  • Manish Jain

    Thank you for explaining the stuff about Oxygen Builder.

    How to make the sticky post always on top using Oxygen Advanced Query Builder when we query all the posts?

  • A

    Change the number of posts per page and go with the first example probably. If you specify it more, I will help better.

  • A

    Hello, what if you try the default query?

  • Manish Jain

    Thank you for the reply.

    It somehow does not work for us when using Repeater Element.

    We are using Repeater Element in Oxygen Builder to display all the posts but it does not make the featured posts to display on top if we use Advanced Query with post_type=post, no_found_row=true.

  • A

    Hello, if you want to use default query to display all posts, then it every time makes the featured posts display at the top by default in WordPress. You can find the query examples in developer handbook.

Share Your Thoughts