How Query Builder Works for Posts Widget?

Posts widget provides a very powerful query builder to display posts. Below is the description for query builder options –

There are two Query Types – Main Query and Custom Query.  

Main Query

This is an advanced option that allows displaying posts dynamically dependent on a page on which posts widget is displaying.

For Example –

  • Consider you have designed a template with posts widget and selected option Main Query and set it to display on all archive pages.
  • When you visit any archive page, related posts will display.
  • Let’s say you have posts category – ‘Food’. If you visit the ‘Food’ category page where the above template is applied, you will see posts displaying that are assigned category ‘Food’.
  • Sometimes category can be empty and it does not have any posts to display. In this case, a message entered in If Posts Not Found box will display.
  • If you choose to display Show Search Box, it will display with the above message.

 

Custom Query

It allows choosing posts, pages, media, templates manually based on categories, tags, author.

1. Post Type –  Posts widget allows displaying following post type.

  • Posts
  • Pages
  • Media
  • My Templates ( Templates saved with Elementor )

2.  Categories / Tags / Author Filter Rule – These rules allow filtering posts on the basis of categories, tags, and author.

  • Every filter rule has two options. To Match or to Exclude.
  •  Choose whether to match or exclude particular categories, tags, and author and start typing the name for the selected option. A drop-down for the related option will appear. Select the exact option from it.
  • For Example, if you wish to display posts for the ‘Food’ category written by ‘Tom’ only. Then choose ‘Match Categories’ option. Start typing Food and choose it from the drop-down list. Choose ‘Match Author’ and start typing ‘Tom’ and choose it from the drop-down list. This will display ‘Food’ posts written by ‘Tom’.

3. Post Filter Rule – Allows selecting posts manually.

  • You can display particular post with Match Posts filter rule. Select this option and start typing the name for the post that you wish to display.
  • Or you can Exclude particular post. By default, all posts will display. Choose this option and start typing the name for the post that you wish to exclude.

4. Ignore Sticky Posts – 

  • What is the sticky post  – Sticky Post option will stick a post to the front page. You can set some posts as Sticky to make them appear above the other posts. This allows highlighting specific posts.
  • For example – Say you have 10 posts published. Then by default post will publish in reverse chronological order. That means posts will display in order 10,9,8,7 and so on. Consider 5th post is marked as sticky. Then it will display at the top of the page. So the sequence for the posts will be 5,10,9,8 and so on.
  • Refer a link here to see how to mark post a sticky.
  • If you select to Ignore Sticky Posts then posts will display normally in reverse chronological order and the sticky post will not be displayed at the top in the timeline.

5. Post Order – Selected posts can be ordered on the basis of date, title, menu order etc or can be displayed randomly.

No Results Message

If the query builder does not found any posts to display it shows No Results Message. And offers Search Box to the user ( only if enabled ). You can edit this message with No Results Message
options.

Not the solution you are looking for? Check other articles, or open a support ticket.