Help Center

Query Builder Posts Query Type

Query Builder Posts Query Type

This overview will describe all the settings of Query Builder’s Posts Query type, which is a part of the JetEngine plugin.

Posts Query type of Query Builder allows you to create customizable post lists. You can flexibly choose posts that will be added to the list and change them at any time. The list you make can be used to build a Listing template and then displayed via the Listing Grid widget on one or several pages of your website.

Let’s go through all the settings.

General

Adjust the general points of the custom query by working on the following fields.

the first part of the general tab of posts query
  • Post Type — in this drop-down menu, you will see all the post types on your website, both default and made with the JetEngine plugin. Choose the posts of which post type you would like to query;
  • Post Status — here, you can choose the status of the posts added to the list. You can add several of them here;
  • Search Keyword — the Posts Query will search through every post and show only those posts containing a word you type into this bar in their title, excerpt, or content. If you add a hyphen in front of the word (like that: “-shoes”), all posts with that word will be excluded from the list. You can also fill this bar using dynamic tags. Click on the button at the end of the bar, and you will see the list of dynamic tags;
  • Order & Order By — here, you can add sorting parameters. There could be several of them for every query. Click on the “Add new sorting parameter” button to add a new sorting condition. Every sorting parameter item has additional features:
    • Order By — in this drop-down menu, you can choose the parameter by which the items will be sorted;
    • Order — here, you can select ascending (from lowest to highest) or descending (from highest to lowest) order;
the second part of the general tab of posts query
  • Has Password — enable this toggle if you would like to add to the list only the posts that can be seen after entering the password;
  • Post Password — if you want to add only posts with a particular password, type it into this bar.

Meta Query

This tab allows you to add the posts to the list according to the values of their meta fields. You set a value in the Value text area, and then the data from the meta field you choose in the Field key/name bar is compared to that value. If they match, the post is added to the list. The conditions the value of the meta field has to meet are called Meta Query Clause. You can add as many Meta Clauses as you want by clicking on the “Add New” button.

Also, pay attention to the “Dynamic Tags” buttons next to the Field key/name and Value bars. It means you can not only select the value but also customize its Context and Fallback in the Advanced settings section.

Warning

Not every dynamic function needs and will work with the set Context.

In case something goes wrong, the text you type in the Fallback field will be displayed to the user.

meta query tab of posts query
  • Field key/name — enter the name of the meta field attached to the Post Type you’ve chosen in the General settings tab. You can use dynamic tags in this bar. Remember to set Context and Fallback in the Advanced settings tab if needed;
  • Value — the value you set here will be compared to the value of the meta field you have chosen in the Field key/name bar;
  • Compare — here, you can select how the values will be compared:
    • Equal – displays posts having an equal value;
    • Not Equal – shows posts that don’t have an equal value;
    • Greater than – shows posts that have a greater value. It works with numeric values only;
    • Greater or equal – displays posts that have a greater or equal value. It also works only for numeric values;
    • Less than – shows posts that have a lesser value. For numeric values only;
    • Less or equal – displays posts that have a lesser or equal numeric value;
    • Like – shows posts that have the value you set in the Value field mentioned in the content;
    • Not like – displays only the posts that don’t have the value you’ve put in the Value field mentioned in the content;
    • In the list – after you add several values to the Value field, it shows the posts that have at least one of them in their content;
    • Not in the list – displays posts that have any values except the ones you typed into the Value field;
    • Between – displays posts that contain the value between two, which are set in the Value field; 
    • Not between – shows all the posts except the ones that have a value that matches the set interval;
    • Exist – shows all the posts that contain the Key. You don’t need to set the Value in this case;
    • Not exist – displays all the posts that don’t have the Key. You don’t need to select the Value either;
    • Regexp – queries posts according to Checkbox and Radio meta field values;
    • Not regexp – excludes mentioned Checkbox and Radio meta field values from the query;
  • Type — this drop-down allows you to specify what kind of data is stored in the chosen meta field:
    • Char – alphabetic data that is not sensitive to case;
    • Numeric – whole numbers only;
    • Date – date values (be aware, the Save as timestamp toggle in the fields from where you get date values) should be enabled. Toggle Save as timestamp ON if you need to sort or query posts by date;
    • Datetime – date and time (be aware, there should be enabled the Save as timestamp toggle in the fields from where you get date values);
    • Decimal – fraction number data;
    • Time – time values;
    • Binary – data that is sensitive to the case;
    • Signed – whole numbers, both positive and negative;
    • Unsigned – whole numbers, only positive.
  • Clause name — if you give this Meta Clause a unique name, it will appear in the Order by drop-down, and you will be able to use it to sort the posts.

Tax Query

In this tab, you can query the posts according to the taxonomies, categories, or terms that are connected to them. The set of conditions is called Tax Query Clause, and you can add several of them to one query by clicking the “Add New” button.

tax query tab of posts query
  • Taxonomy — in this drop-down menu, you can select the type of taxonomy applied to the posts. All available taxonomies will be listed there;
  • Field — here, you can choose how to display the terms: by “Term ID,” “Slug,” “Name,” or “Term taxonomy ID.” If you’ve selected the “Term ID,” you should fill in the Terms field with the %current_terms% macro to display the posts with the same terms as the main one on the page. To add more terms to the current ones, you can simply enter the needed IDs separating them with a comma;
  • Terms — according to what you have chosen in the Field menu, here you have to type in the ID, slug, or name of the needed term;
  • Exclude children — if you have chosen a hierarchical taxonomy and don’t want to add the posts with children terms, enable this toggle;
  • Compare operator — this field defines how different terms will work together:
    • IN operator shows all the values in the chosen taxonomy; 
    • NOT IN hides all the items that are applied to the selected term; 
    • AND operator allows the existence of multiple conditions; 
    • EXIST is used to test the existence of any record in a subquery;
    • NOT EXIST performs the opposed action.

Date Query

Here, all fields present the date modifications. Set the needed values to get the precise result.

the first part of the date query tab of posts query
  • Year — posts that were created or modified this year will be added to the list;
  • Month — posts that were created or modified this month will be added to the list;
  • Day — posts that were created or modified on this day will be added to the list;
  • After — posts created or modified after the date you enter into this bar will be added to the list;
  • Before — type the date here, and all posts created or modified before it will be added to the list;
the second part of the date query tab of posts query
  • Inclusive — if you enable this toggle, the date you type in the After or Before fields will be included in the range;
  • Compare — here, you can choose how the date you added to Year, Month, and Day bars will be compared to the date of post creation or modification;
  • Column — in this drop-down menu, you can choose which date to take – the date of creation or modification.

Post & Page

This tab allows you to include or exclude concrete posts by their IDs or slugs. All the features can be filled with the help of dynamic tags by clicking on the button on the right side of the bar.

the first part of the post and page query tab of posts query
  • Post In — if there are several posts that you want to add to the list, you can type their IDs here, separated by commas. This bar is for several posts only. If you want to add just one, use the Post ID bar;
  • Post Not In — you can exclude one or several specific posts by typing their IDs here;
  • Post Name In — it is possible to add posts to the list not by their IDs but by names. Type slugs here and separate them by commas;
  • Post Parent ID — if you type the ID of a post here, all its child posts will be added to the list. You can also type “0” in this bar, and all parent posts that have children will be added to the list without child posts;
the second part of the post and page query tab of posts query
  • Post Parent In — here, you can add several parent post IDs separated by commas, and all their child posts will be added to the list;
  • Post Parent Not In — all the “children” of parent posts that you mention here by their IDs will be excluded from the list;
  • Post ID — a bar for single post IDs. The post you mention here will be added to the list;
  • Post Slug — type the slug of the post here, and it will be added to the list;
  • Page ID — to add the page to the list, type its ID here;
  • Page Slug — type the slug of the page here to add it to the list.

Comments

Here you can add posts with a particular number of comments to the list. The Posts Query takes the number of comments the post has and compares it with the number you set in the Comments number bar, adding them to the list afterward if the condition is met.

comments tab of posts query
  • Comments number — type the number of comments here or take the number from some meta field via the dynamic tags;
  • Compare — here, you can choose how the number will be compared. The post will be added to the list if the number of comments and the value you put on the Comments number bar are:
    • Equal – the numbers are equal;
    • Not Equal – the numbers are not equal;
    • Greater than – the number of comments is bigger than than the value you set;
    • Greater or equal – the number of comments is bigger or equal to the value you set;
    • Less than – the number of comments is lesser than the value you set;
    • Less or equal – the number of comments is lesser or equal to the value you set.

Pagination

This tab works as if the list of posts had pagination. However, you need to add the Pagination widget or block to your Listing Grid. You could set the Posts Per Page number and then add the posts that would be on the specific page of pagination if it was on the page.

the first part of the pagination query tab of posts query
  • Posts Per Page — decide how many posts there will be on each page of the pagination. If you type “-1” here, all the posts will be shown on one page, and the Offset value won’t work;
  • Offset — the number you type here will be the number of first posts that won’t be added to the list;
  • Paged — here, you can type the number of the page, and all posts that should have been shown on that page of pagination will be added to the list;
  • Page — the number you set here will be the number of pages for a static front page;
the second part of the pagination query tab of posts query
  • Ignore Sticky Posts — by default, this toggle is disabled, and sticky posts are placed on the top of the items list. You can enable it, and then the posts will remain where they are supposed to be.

Author

This tab helps to query posts according to their author and includes several fields for customization.

author tab of posts query
  • Author ID — type the ID of the single author here, and all posts that the author created will be added to the list;
  • Author Name — all the posts of the author whose name you type in here will be added to the list;
  • Author In — in this bar, you can type in the IDs of several authors, and all posts they created will be added to the list;
  • Author Not In — if you type author IDs here, the posts they created will be excluded from the list.
Warning

This tab is available only if the Maps Listings toggle is enabled in the WordPress Dashboard > JetEngine > JetEngine settings page on the Modules tab.

Set the query that depends on the geographical values. Customize all the settings concerning map indicators.

the first part of the geo search tab of posts query
  • Select location — set the point on the depicted map to get the options around it.
Warning

You may not see these changes in Elementor, but after updating, visit the website and the changes will be visible.

  • Address Field — complete this bar with the meta field value that stores an address; it can be two values that contain latitude and longitude.
the second part of the geo search tab of posts query
  • Distance — define the radius of the search. It will be conducted depending on the center you have selected earlier;
  • Units — choose between available distance units.

To learn how to display search results split by Listing categories using the Custom Query, watch this video tutorial.

That is all for the Posts Query type. Create a precise posts list and display it wherever you want.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.