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 it at any time. The list you create 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.
- Post Type. In this drop-down menu, you will see all the Post Types you have 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 posts of what status will be 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 that have 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 the posts that have 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. To add a new sorting condition, click on the “Add new sorting parameter” button. 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 choose ascending (from lowest to highest) or descending (from highest to lowest) order;
- 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 the posts that have a particular password, type it into this bar.
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 that 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.
- Field key/name. Enter the name of the meta field that is attached to the Post Type you’ve chosen in the General settings tab. You can use dynamic tags in this bar;
- 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 choose 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 set 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 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;
- Type. This drop-down allows you to specify what type 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;
- Datetime – date and time;
- Decimal – fraction number data;
- Time – time values;
- Binary – data that is sensitive to 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.
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.
- 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, 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;
- 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 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.
- Year. Posts that were created or modified in this year will be added to the list;
- Month. Posts that were created or modified in 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 that were 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 that were created or modified before it will be added to the list;
- Inclusive. If you enable this toggle, the date you type in the After or Before 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.
- 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 certain 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;
- 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.
Here you can choose to 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 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 to 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.
This tab works as if the list of posts had pagination. However, you don’t need to add the Pagination widget or block to your Listing Grid. You can set the Posts Per Page number and then add the posts that would be on the certain page of pagination if it were on the page.
- 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 showed 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;
- 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 in the places they are supposed to be.
- 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 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.
That is all for the Posts Query type. Create a precise posts list and display it wherever you want!