πŸ”ž ADULT: Knowledge base/jetengine/jetengine query builder comments query type - High Quality

Help Center
Query Builder Comments Query Type

Query Builder Comments Query Type

This overview will describe all the Query Builder Comments Query type settings, which are a part of the JetEngine plugin.

The Comments Query of JetEngine Query Builder is intended to create a query for comments, build a listing template, and display comments via the Listing Grid widget/block/element. This functionality is available for the comments left via the default WordPress commenting system.

To check one of the available use cases, the How to Post User’s Recent Comments on User’s Account Page tutorial should be read.

The Comments Query panel is available in the WordPress Dashboard > JetEngine > Query Builder tab after setting the “Comments Query” option in the Query Type drop-down list. This panel is presented by the Include/Exclude, Author, Meta Query, Date Query, Pagination, Post, and Misc settings.

creating the comments type query

Include/Exclude Settings

This tab is responsible for including and excluding the needed items to/from the query, such as specific comments or parent comments. All fields in this tab allow adding data dynamically by pressing the “Dynamic Tag” and selecting the needed option.

The tab is presented by the following fields:

include exclude tab in the comments query
  • Comment In β€” a field that allows inserting the IDs of comments, separated by commas, which will be added to the list;
  • Comment Not In β€” a field that allows inserting the IDs of comments, separated by commas, which will be excluded from the list;
  • Parent β€” a bar for adding the parent IDs of the comments to retrieve the children from; 
  • Parent In β€” a bar for adding a list of parent IDs of comments to retrieve the children from;
  • Parent Not In β€” a bar for adding a list of parent IDs of comments not to retrieve the children from.

Author

All the settings presented here refer to the author of the comments and are intended to set up the desired criteria to query the comments depending on their author. All fields in this tab allow adding data dynamically by pressing the “Dynamic Tag” and selecting the needed option.

author tab in the comments query
  • Author Email β€” a field for inserting the email address of the author, whose comments will be added to the list;
  • Author URL β€” a field for inserting the author URLs, whose comments will be added to the list;
  • Author In β€” a field for adding the author IDs (separated with commas), whose comments will be added to the list;
  • Author Not In β€” a field for adding the author IDs (separated with commas), whose comments will not be added to the list;
  • Post Author In β€” a field for adding the post author IDs (separated with commas), whose comments will be added to the list;
  • Post Author Not In β€” a field for adding the post author IDs (separated with commas), whose comments will not be added to the list.

Meta Query

These settings are intended to add the comments to the list according to the values of the meta fields, previously set by the corresponding plugins. The data specified in the Value text area of the meta field will be compared with the data from the meta field selected in the Field key/name bar in this group of settings. If these values match, the comment is added to the list. 

Optionally, the “Dynamic Tag” for the described fields can be pressed to set the Context and Fallback for some of the values. The conditions that the value of the meta field should meet are called the Meta Query Clause. One can add as many Meta Query Clauses as needed.Β 

After unfolding the Meta Query tab, the “Add New” and “Add new group” buttons become available. Pressing these buttons unrolls the settings to add Meta Query Clauses and add an element with a group of conditions, respectively.

Things to know

Adding and managing clause functionality via Meta Query settings is maintained for posts, users, terms, and comments, as well as via the Where arguments for SQL Query and Query Args for Custom Content Type (CCT) queries.
Also, the Meta Query settings section is available for WC Product Query.

meta query tab in the comments query

In particular, the “Add New” button unrolls the following settings:

meta query clause settings
  • Field key/name β€” a field to enter the name of the meta field that is attached to the comments. Also, the Dynamic Tags” can be used in this field, and the Callback and Context (if needed) are available after clicking on the β€œDynamic Tag” button and selecting the “Advanced Settings” feature;Β 
  • Compare β€” a drop-down list of operators to select how the values will be compared:
    • Equal β€” an operator that displays comments having an equal value;
    • Not Equal β€” an operator that shows comments that don’t have an equal value;
    • Greater than β€” an operator that shows comments that have a greater value. It works with numeric values only;
    • Greater or equal β€” an operator that displays comments that have a greater than or equal value. It also works only for numeric values;
    • Less than β€” an operator that shows comments that have a lesser value. The operator is available for numeric values only;
    • Less or equal β€” an operator that displays comments that have a lesser than or equal to numeric value;
    • Like β€” an operator shows comments that have the value to be set in the Value field mentioned in the content;
    • Not like β€” an operator that displays only the comments that don’t have the value set in the Value field mentioned in the content;
    • In the list β€” an operator that shows the comments that have at least one value in the content set in the Value field;
    • Not in the list β€” an operator that shows the comments that have any value in the content set in the Value field; 
    • Between β€”  an operator that displays comments that contain the value between two, which are set in the Value field; 
    • Not between β€”  an operator that shows all the comments except the ones that have a value that matches the set interval;
    • Exist β€” an operator that shows all the comments that contain the Key. The Value in this case need not be set;
    • Not exist β€” an operator that displays all the comments that don’t have the Key. The Value need not be selected;
    • Regexp β€” an operator that uses checkbox/radio meta fields values to query the comments;
    • Not regexp β€” an operator that excludes the checkbox/radio meta field value from the query;
  • Value β€” the field that allows setting the value that will be compared to the value of the meta field selected in the Field key/name bar. This field allows the use of “Dynamic Tag“.
Things to know

This option appears only if there is a dynamic argument selected for this field (based on the assumption that if the user intentionally left the field empty).

value settings of the meta query tab
  • Type β€” a drop-down list intended to specify what kind of data is stored in the chosen meta field:
    • Char β€” the option specifies alphabetic data not sensitive to case;
    • Numeric β€” the option specifies whole numbers only;
    • Date β€” the option specifies date values (be aware that the Save as timestamp toggle must be enabled in the fields from where the value data can be obtained);
    • Datetime β€” the option specifies date and time (be aware that the Save as timestamp toggle must be enabled in the fields from where the date values can be obtained);
    • Decimal β€” the option specifies fraction number data;
    • Time β€” the option specifies time values;
    • Binary β€” the option specifies data that is sensitive to the case;
    • Signed β€” the option specifies whole numbers, both positive and negative;
    • Unsigned β€” the option specifies whole numbers, only positive.
  • Clause name β€” a text field intended to insert the clause name to use as an Order By parameter.

The next button available in this tab is the “Add new group” button, which allows setting specific conditions to display elements.

Things to know

The "Add new group" button is added to elements that support this functionality.

After clicking this button, the Edit group clauses tab will appear with the Relation drop-down list, which allows selecting the “And” or “Or” options.

Things to know

Adding to the group allows configuring nested queries if the query arguments are added via the repeater.

the add new group button

The group clause can be edited by pressing the “Edit group clauses” link.Β 

When done, a pop-up with the “Add new clause” button will appear.

the add new clause pop-up

After clicking this button, the fields similar to the Meta Query tab will be displayed, which allow building the needed group clause.

adding new clause

More details about creating, configuring, and filtering group clauses can be found in the How to Create Group Clauses for Query Arguments tutorial.

Date Query

These settings are intended to adjust the query by selecting the specific date options for display.Β  In particular, settings can be customized regarding the publication date of the comment. Also, the “Dynamic tag” can be used to set the corresponding data.

The following settings are presented:

the date query tab in the comments query
  • Year β€” a field that allows displaying comments created or modified in the specified year;
  • Month β€” a field that allows displaying comments that were made or altered in the specified month;
  • Day β€” a field that allows displaying comments that were created or modified on the specified day;
  • After β€” a field that allows displaying comments that were created or modified after the date entered into this bar;
  • Before β€” a field that allows display of comments that were created or modified before the date entered into this bar;
  • Inclusive β€” a toggle that, if enabled, allows adding the date in the After or Before field to include in the range;
  • Compare β€” a field that allows choosing how the date added to the Year, Month, and Day bars will be compared to the date of the comment creation or modification;
  • Column β€”  a field that allows choosing which date to take in this drop-down menu – the date of creation or modification.

Pagination

These settings are applied if the list of comments has pagination. However, it is not necessary to add the Pagination widget or block to the Listing Grid, as the added comments would be displayed on a specific page of pagination if attached to the Listing Grid. Also, the “Dynamic tag” can be used to set the corresponding data.

The following settings are available:

pagination tab in the comments quer
  • Number β€” a field that allows defining the maximum number of comments that will be added to the list;
  • Paged β€” a field that allows inserting the page number in the pagination. All comments that would’ve been on that page will be added to the list;
  • Offset β€” a field that allows defining how many of the first comments in the row won’t be added to the list;
  • Order By β€” a field that allows choosing by what value to order the comments in a list;
  • Order β€” a field that allows sorting the comments “From lowest to highest” value or “From highest to lowest.”

Post

These settings are applied to the query, considering the post to which comments were added. Also, the “Dynamic tag” can be used to set the corresponding data.

The following settings are included:

query only the needed posts’ comments
  • Post ID β€” a field that allows setting the post ID to limit results to the specific post comments;
  • Post In β€” a field that allows including affiliated comments for an array of post IDs;
  • Post Not In β€” a field that allows excluding connected comments for an array of post IDs;
  • Post Status β€” a field that allows displaying comments of posts that have a status set here;
  • Post Type β€” a field that allows selecting the post type, for which comments of all posts of that type will be added to the list;
  • Post Name β€” a field that allows inserting the name of the post here, and all its comments will be added to the list;
  • Post Parent β€” a field that allows adding an ID of the post with child posts assigned to it, and all the comments added to the child posts will be added to the list.

Misc

This tab is represented by the additional query settings available. Also, the “Dynamic Tag” can be used to set the corresponding data.

The following settings are included:

misc tab in the comments query
  • Search β€” a field that allows inserting a word or several words, which the comments should contain in their content or title, to be added to the list;
  • Status β€” a field that allows setting the needed status of the comment to be shown (here, the two possible statuses of the comment are allowable: “1” means that it is approved, and “0” means that it is waiting for approval. In this field, the needed number should be added, and all the comments of that status will be included in the list. Also, specific plugins that allow inserting some different status for comments can be used here too, because the comment status is checked in the database table;
  • Type β€” a bar for a single value that allows typing the name of the comment type here, and all the comments of that type will be added to the list. The comment types can be checked in the “comment_type column” of the “wp_comments” table in the database;
  • Type In β€” a field that is intended to insert names of the comment types, separated by commas. Comments of those types will be added to the list;
  • Type Not In β€” a field that is intended to insert names of the comment types here, separated by commas. Comments of those types will be excluded from the list.

That is all for the Comments Query type, intended to create a list of comments using the JetEngine plugin for WordPress and display it wherever needed.

Was this article helpful?
YesNo

Need help?