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.

Usually, you can’t take the comments left via the default WordPress commenting system and display them using Listing Grid. However, Comments Query of JetEngine Query Builder functionality allows you that. Create a query for comments, build a listing template, and use it in the Listing Grid

You can also check one of the available cases on how you can use the Comments Query to display the recent user’s comments on the account page.

Let’s take a look at the settings.

Include/Exclude

This tab is responsible for including and excluding the needed items to/from the query, such as specific comments or parent comments.

include exclude tab in the comments query
  • Comment In — type the IDs of comments here, separated by commas, and those comments will be added to the list;
  • Comment Not In — here, you can type the IDs of comments you want to exclude from the list. Separate them by commas;
  • Parent — this is a bar for a single value. If you have parent comments that have child comments attached to them, you can type the ID of the parent here. All the child comments will be added to the list;
  • Parent In — here, you can type several parent comments IDs, separated by commas. The child comments of all those parents will be added to the list;
  • Parent Not In — type IDs of parent comments here, and their child comments won’t be added to the list.

Author

All the settings presented here concern the author of the comment. Set up the desired criteria to query the comments depending on their author.

author tab in the comments query
  • Author Email — type the email address of the author here, and all the comments they left will be added to the list;
  • Author URL — insert the author’s URL here, and all the comments they left will be added to the list;
  • Author In — in this bar, you can add several authors by their IDs, separating them with commas. All the comments they’ve left will be added to the list;
  • Author Not In  — if you want to exclude comments of some authors from the list, type their IDs here, separated by commas;
  • Post Author In — when you type the ID of an author here, all the comments that were left under that author posts will be added to the list;
  • Post Author Not In — type the ID of the author here, and comments that were left to that author’s posts will be excluded from the list.

Meta Query

If you have a plugin that allows you to set meta fields for the comments, this tab will allow you to add the comments to the list according to the values of their meta fields. You put a value in the Value text area, and then the data from the meta field you choose in the Field key/name bar is compared to that value. If they match, the comment is added to the list. 

Optionally, you can select a dynamic tag for the described fields and set the Context and Fallback for some of the values. The conditions the value of the meta field has to meet are called Meta Query Clause. You can add as many Meta Query Clauses as you want by clicking on the “Add New” button.

meta query tab in the comments query
  • Field key/name — enter the name of the meta field that is attached to the comments. You can use dynamic tags in this bar and type the Callback and Context (if needed) that are available once you click on the dynamic tags button and “Advanced Settings” feature;
  • 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 select how the values will be compared:
    • Equal — displays comments having an equal value;
    • Not Equal — shows comments that don’t have an equal value;
    • Greater than — shows comments that have a greater value. It works with numeric values only;
    • Greater or equal — displays comments that have a greater or equal value. It also works only for numeric values;
    • Less than — shows comments that have a lesser value. For numeric values only;
    • Less or equal — displays comments that have a lesser or equal numeric value;
    • Like — shows comments that have the value you set in the Value field mentioned in the content;
    • Not like — displays only the comments 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 comments that have at least one of them in their content;
    • Not in the list — displays comments that have any values except the ones you typed into the Value field;
    • Between — displays comments that contain the value between two, which are set in the Value field; 
    • Not between — shows all the comments except the ones that have a value that matches the set interval;
    • Exist — shows all the comments that contain the Key. You don’t need to set the Value in this case;
    • Not exist — displays all the comments that don’t have the Key. You don’t need to select the Value either;
    • Regexp — uses checkbox/radio meta fields values to query the comments;
    • Not regexp — excludes checkbox/radio meta field value from the query;
  • Type — this drop-down allows you to specify what kind 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 (be aware, there should be enabled the Save as timestamp toggle in the fields from where you get date values);
    • Datetime — date and time (be aware, there should be switched the Save as timestamp toggle in the fields from where you get date values);
    • Decimal — fraction number data;
    • Time — time values;
    • Binary — data that is sensitive to the case;
    • Signed — whole numbers, both positive and negative;
    • Unsigned — whole numbers, only positive.

Date Query

Adjust query by selecting the specific date options for display. Here you can customize all the settings concerning the date of the comment publishing.

the first part of the date query tab in the comments query
  • Year — posts that were created or modified this year will be added to the list;
  • Month — posts that were made or altered 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;
the second part of the date query tab in the comments query
  • 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 — you can choose which date to take in this drop-down menu – the date of creation or modification.

Pagination

This tab works as if the list of comments had pagination. However, you don’t need to add the Pagination widget or block to your Listing Grid. You add the comments that would be on a particular page of pagination if they were attached to the Listing Grid.

pagination tab in the comments query
  • Number — here, you can define the maximum number of comments that will be added to the list;
  • Paged — you can insert the page number in the pagination here. All comments that would’ve been on that page will be added to the list;
  • Offset — here, you can define how many of the first comments in the row won’t be added to the list;
  • Order By — choose by what value to order the comments in a list;
  • Order — you can sort the comments “From lowest to highest” value orFrom highest to lowest.”

Post

Work on the query considering the post to which comments were added. Query only the needed posts’ comments.

the first part of the post query tab in the comments query
  • Post ID — set the post ID to limit results to the specific post comments;
  • Post In — include affiliated comments for an array of post IDs;
  • Post Not In — exclude connected comments for an array of post IDs;
  • Post Status — comments of posts that have a status you choose here will be added to the list;
  • Post Type — here, you can select the Post Type. Comments of all posts of that type will be added to the list;
the second part of the post query tab in the comments query
  • Post Name — insert the name of the post here, and all its comments will be added to the list;
  • Post Parent — add 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

The last tab represents additional query settings available for you. These are added to make your query more precise and useful.

the first part of the misc query tab in the comments query
  • Search — you can write a word or several words here. The comments that contain that word in their content or title will be added to the list;
  • Status — by default, there are two possible statuses of the comment – “1” means that it is approved, and “0” means that it is waiting for approval. Type one of these numbers, and all the comments of that status will be added to the list. If you have plugins that allow you to add some different status for comments, you can use it here too because the comment status is checked in the database table;
  • Type — this is a bar for a single value. Type the name of the comment type here, and all the comments of that type will be added to the list. You can check for the comment types in the comment_type column of the wp_comments table in the database;
the second part of the misc query tab in the comments query
  • Type In — insert names of the comment types here, separated by commas. Comments of those types will be added to the list;
  • Type Not In — 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. Now you can create a good-looking list of comments with the help of JetEngine and display it wherever you want.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.