Query Builder Custom Content Type Query Type
This overview describes the settings of Query Builder’s Custom Content Type Query type, which is a part of the JetEngine plugin.
The JetEngine functionality allows the creation of a Custom Content Type (CCT).
The Query Builder feature can be used to create a custom query of the “Custom Content Type Query” type to narrow down the displayed results, e.g., in the Listing Grid.
The following settings are available if the Custom Content Type module is activated in the WordPress Dashboard > JetEngine > JetEngine > Modules > Default Modules tab.
General Settings
In the WordPress Dashboard > JetEngine > JetEngine > Query Builder directory, the query adjusting starts from the following settings:
- Name — a field where the name of the query should be put;
- Description — a short description of the query features that helps for navigation in the list among the built queries;
- Query Type — a type of query. In the given case, a “Custom Content Type Query” should be picked to query CCT items;
- Query ID — an optional field to connect a query to JetSmartFilters. The value set here should be identical to the one used in the filter;
- Cache Query — a toggle activated by default. It caches the current query and can be deactivated if the query results are incorrect;
- Cache Expires — a field where the object cache expiration time can be entered (in seconds). The default is “0”, meaning no expiration. Note: this option is relevant only when an external object cache (e.g., Redis, Memcached) is used. Otherwise, the cache remains valid only for a single request.
- Register Rest API Endpoint – if enabled, this toggle activates settings with which you can register a WordPress Rest API endpoint to grant public access to query results and allow remote retrieval of current query data. For example, you can use the endpoint in the Make.com scenarios or as the backend for mobile applications. More about these settings can be found in the Register Rest API Endpoint chapter of the Query Builder Overview.
Content Types Query Settings
This section contains such options:
- From Content Type — a drop-down menu where the needed CCTs can be set;
- Number — the number of items can be defined to be shown in the list. If the JetSmartFilters Pagination is added to the Listing Grid, this feature will determine the number of items per page. The “Query Results Count” dynamic tag will show the total number of items that match the current query;
- Offset — the number of items can be specified that will be skipped;
- Status — only the items with the status chosen here will be added to the list;
- Search Query — a field where one can enter a search string to query across all CCT fields. To search by a specific field, the Query settings should be used with the “Like” operator in the Compare dropdown.
This option contains the “database” button that opens the dropdown menu with the macros. For instance, the “Query Variable” macro can be selected, and the “jet_search” parameter can be entered into the Variable Name field to display the search results from the AJAX Search from the JetSearch plugin.
- Order & Order By — appears when the From Content Type is filled. The “Add new sorting parameter” button should be clicked to add a new sorting condition. There could be several of them for every query. Every sorting parameter item has additional features:
- Order By — in this dropdown menu, the parameter by which the items will be sorted can be set;
- Order — here, one can select ascending “From lowest to highest values (1, 2, 3; a, b, c)” or descending “From highest to lowest values (3, 2, 1; c, b, a)” order;
- Type — this drop-down allows specifying what kind of data is stored in the chosen parameter:
- Char — alphabetic data;
- Numeric – whole numbers only;
- Date — date values;
- Datetime — date and time values ;
- Timestamp — date and time values stored as a timestamp. This format is particularly useful for tracking local events while accounting for time zones, as well as for use in analytics and statistical analysis;
- Decimal — fraction number data;
- Time — time values;
- Binary — data compared in a case-sensitive manner by treating it as raw binary;
- Signed — whole numbers, both positive and negative;
- Unsigned — whole numbers, only positive.
- Query — appears when the From Content Type is filled. The “Add new” button should be clicked to add a new query clause. There could be several of them for every query. Every query clause has additional settings:
- Field — a CCT field can be selected which values will be used;
- Compare — here, one can select how the values will be compared:
- Equal — displays items having an equal value;
- Not Equal — shows items that don’t have an equal value;
- Greater than — shows items that have a greater value. It works with numeric values only;
- Greater or equal — displays items that have a greater or equal value. It also works only for numeric values;
- Less than — shows items that have a lesser value. For numeric values only;
- Less or equal — displays items that have a lesser or equal numeric value;
- Like — shows items that have the value set in the Value field mentioned in the content;
- Not like — displays only the items that don’t have the value put in the Value field mentioned in the content;
- In the list — after one adds several values to the Value field, it shows the items that have at least one of them in their content;
- Not in the list — displays items that have any values except the ones typed into the Value field;
- Between — displays items that contain the value between two, which are set in the Value field;
- Not between — shows all the items except the ones that have a value that matches the set interval;
- Exist — shows all the items that contain the Field key/name of the selected meta field. There is no need to set the Value in this case;
- Not exist — displays all the items that don’t have the Field key/name of the meta field. There is no need to set the Value either;
- Regexp — queries items according to “Checkbox” and “Radio” meta field values;
- Not regexp — excludes mentioned “Checkbox” and “Radio” meta field values from the query;
- Value — the value set here will be compared to the value of the meta field chosen in the Field bar. The “database” icon opens the macros list that can be used in this field;
- Type — the same options as for the Order & Order By sorting conditions.
- Select location — one can select the point on the map, and it will be the center of the query radius if users don’t allow access to their geolocation. The Map Provider can be adjusted in the WordPress Dashboard > JetEngine > JetEngine > Maps Settings tab;
- Address Field — the name of the post, term, user, or CCT meta fields with the address can be entered here. It can be the same fields as in the Meta fields to preload option in the Maps Settings of the JetEngine dashboard (without a prefix, as the query type is already selected in advance), a field of the “Map” type, or comma-separated fields in which latitude and longitude are stored (in separate fields);
- Distance — the radius for the search results;
- Units — the measurement units: “Kilometers” or “Miles”;
- Fields for filters — available fields list to filter with the JetSmartFilters plugin. To filter query results by selected field, one can copy and paste the field name into the Query Variable option of the needed filter. More information can be found in the Filters Data Source Overview.
That is all for the “Custom Content Type Query” type included in the JetEngine plugin functionality for WordPress.