Back to contents

JetEngine: Listing Grid Posts Query Overview

This tutorial describes all the features of the Listing Grid widget’s Posts Query settings section. You will learn how to use all kinds of posts queries to display only the items you need.

When you place the Listing Grid on the page, it shows all the items of a specific post type. However, for different pages, you might need to show only the set of specifically chosen posts. Queries help you define the items that will be shown in the grid located on a certain page.

So, open the page where you have placed the Listing Grid widget in the Elementor page builder, click on it, and let’s go through the settings.

First sight

When you unfold the Posts Query section, there will be few features. 

Posts Query first sight

First of all, there will be a single item. Every query is added to the Listing Grid separately but you can add as many as you need by clicking the “Add Item” button. You will be offered to choose the item’s Type from five variants: “Posts&Author Parameters”, “Order and Offset”, “Tax Query”, “Meta Query”, and “Date Query”. Each of them will be described further in this overview.

The other two features are Meta query relation and Tax query relation. If you have added several meta or tax query items, you can define how they will work together here. AND means that all the added queries will work at the same time. OR means that only one of the added queries that fit the case better will be active. 

Posts&Author Parameters query

This type of query item allows you to filter the posts by their ID, relations, status, or author. 

Posts&Author Parameters
  • Include posts by IDs. This feature allows you to manually choose what posts will be displayed in the grid. Type their ID numbers in the field, separated by commas, and they will be shown in the grid. If you want to display the related posts (either parent or child one), you should put the appropriate macro into this field: %related_children_from|post-type-slug% or %related_parents_from|post-type-slug%;
  • Exclude posts by IDs. If in the list of posts there are some that you don’t want to show in this particular grid, you can exclude them here. Put the ID numbers of the posts you want to get rid of into the field, and they will be excluded;
  • Get child of. If the posts of this Listing Grid are the “children” of other post type items, you can type in the ID of the “parent” here. In that case, only the children of that parent post will be shown in the grid;
  • Get posts with status. This feature allows you to display in the grid only the posts of a chosen status, like “Publish” or “Private”;
  • Posts by author. In this drop-down list, you can choose an author, and the grid will be displaying only that author’s posts;
  • Search Query. If you need to show in the grid only those items that have a certain word in their title or description, this feature can help. Just type the word into the field;
  • Get posts from store. This option allows you to show in the grid only the items that landed in a special store. More details about this functionality can be found in this tutorial.

Order&Offset query

If you want to add an offset to the grid items or place them in a specific order, this type of query will help you.

Order&Offset query
  • Posts offset. The number you type in here is a number of posts that the grid will miss before starting to show them. For example, if you type “1” in this field, the first post in the grid will be the second post of the posts list;
  • Order. You can place the items in the ascending (ASC) or descending (DESC) order;
  • Order by. It is also possible to sort the posts by some of the values like ID or Date. This feature can be combined with the Order. For example, you can order the posts by date and then choose descending order.

Tax Query

This type of query works with taxonomies and can help you sort the posts in the grid according to the categories you create for them.

Tax 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;
  • Taxonomy from meta field. If you have a meta field where you type in the taxonomy name, you can use it here. The value of the meta field will be used as a taxonomy for query;
  • 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 chosen 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;
  • Field. Here you can choose how to display the terms: by Term ID, Slug, or Name. If you’ve chosen the Term ID, you should fill in the Terms field with the macro %current_terms% 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;
  • Terms from meta field. If you have the meta field where you put the terms data, you can use it to set the term dynamically.

Meta Query

With the help of this query type, you can display in the grid only those posts that have a similar (or not similar, it depends on the Operator) value to the one you’ve chosen.

Meta Query
  • Key (name/ID). Here you need to enter the ID or name of the Meta Field. The value of that meta field will be compared to the one you set;
  • Operator. This field defines 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;
    • Equal or less – 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 set in the Value field mentioned in the content;
    • In – 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 – 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 contain 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 contain the Key. You don’t need to set the Value either.
  • Value. The value you’ll type in here will be compared with the values in the Key meta field;
  • Or get value from query variable. This field allows you to take the value from the URL. Just paste the URL to the field and choose the Operator;
  • Type. In this drop-down menu, you can choose the type of the Meta Query Clause;
  • Meta Query Clause. After you type in the unique name here and hit the “Update” button, the clause you’ve just created will become available in the Order&Offset query. This way, you will be able to order the posts according to a custom clause.

Date Query

If you want to sort the posts according to the date, this query type can help you.

Date Query
  • Column. In this drop-down menu, you can choose the type of date you want to use. It could be the date of post creation or modification;
  • After. If you set a date here, only the posts created or modified after that date will be shown;
  • Before. With the help of this field, you can make the grid display only the posts that were created or modified before the date you set.

That is all for the Posts Query settings section of the Listing Grid widget. You now know how to use this functionality to sort the posts.