Back to contents

Setting the Posts Query. How to use the Tax Query type for publications

Explore this tutorial in order to learn the basics of how to use the tax query type for the publications in the Listing Grid widget with the JetEngine plugin for Elementor.

Let’s check it out!

Preparations

First of all, ensure, that you have created the Post Type and add there some posts with JetEngine plugin. For more details look here.

Then, you should consider, that you have created and added taxonomies to the posts. Read this tutorial to learn more.

After that, you should create a new listing to apply for a certain post type. Read here how to do it step by step.

Customizing Single template

Tax Query type settings

Step 1 – After everything above is done, go to the created Single template and add there a Listing Grid widget, select the Listing, that you’ve created in the previous step.

Step 2 – Above all, you should hide the current post from displaying. Go to the Content > Post Query tab and select the Posts Parameters type. In the Exclude posts by IDs put the next macros %current_id%.

Excluding the current ID

Step 3 – Proceed to the Content > Post Query tab and add a new item that is called Tax Query.

Step 4 – Then, select in the dropdown menu the necessary taxonomy, or you are able to enter the taxonomy name from the current page meta field in the corresponding field.

Step 5 – In the dropdown below called Field 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 macros %current_terms% to display the posts with the same terms as the main one in the page.
To add more terms to the current ones you can simply enter the needed IDs separating them with a comma.

Current terms

To know the ID you should hover the name of the term in the WP Dashboard and in the bottom of the page, you will see the number that is the ID.

If you’ve chosen the Slug or Name, just put in the needed slug or name.

Alternatively, you can put an ID, slug or name manually from the current page meta field.

Step 6 – In the select field below you can choose the operator, that will suit your needs.
For example, IN operator compares every value in the result list.
NOT IN allows doing the opposed action.
AND operator allows the existence of multiple conditions.
EXIST is used to test for the existence of any record in a subquery.
NOT EXIST perform the opposed action.

Step 7 – What is more, you can combine different settings in Tax Query and Meta Query type. Read this tutorial (at the end) for more details.

Congrats!
In this tutorial, we’ve made up how to use the tax query type for publications.
With it, you can confidently set the needed settings and enjoy the work you’ve done!