Query Builder is a tool that helps you create lists of items, picked up from the general array according to some conditions. It allows you to query posts, terms, users, comments, SQL tables data, items received via REST API functionality, and Custom Content Type items. You set the conditions for list creation and afterward can create a Listing template for that list and display it via the Listing Grid.
Why do you need Query Builder?
When you add a Listing Grid to the page, either in Elementor page builder or Gutenberg Editor, it has settings sections that can help you query the items you are going to display. There are Post, Terms, and Users Query sections. However, the conditions you set in those settings sections work only for that specific Listing Grid. If you have several similar Listing Grids on different pages and want to change something, you’ll have to visit every page where you displayed the Listing Grid.
With the help of Query Builder, you can create a list and use it everywhere. The changes you make in the Query Builder menu tab will affect all the Listing Grids where that query is displayed.
Besides that, Query Builder allows you to query and display data that you wouldn’t be able to show otherwise, e.g., the information from your database tables.
How to create a Query?
Open your website’s dashboard and go to JetEngine > Query Builder. Press the “Add New” button.
Give your new query a Name and choose the Query Type. All the settings will depend on the Query Type you have chosen. Let’s take a closer look at all the settings.
There are separate articles about every Query Type, so you can go through them to get some details:
- Posts Query;
- Terms Query;
- Users Query;
- Comments Query;
- SQL Query;
- REST API Query;
- Custom Content Type Query.
How to display a query?
When you are done creating a query, it is time to create a Listing template for it. Go to the JetEngine > Listings and click on the “Add New” button. In the Listing source drop-down choose the “Query Builder” option. Choose the query you’ve created, give the listing a name and proceed to build the layout in Elementor or Gutenberg.
Good luck creating queries and displaying them with the help of Listing templates and Listing Grids!