How to use it
- Select a Container, Block or Div and turn on its query loop.
- In the Query editor, choose the query type Comments / reviews (Kiln).
- Under the Query control, set what to loop over:
- Comments of: The current post, Any post (site-wide) or Specific posts.
- Post IDs: shown for Specific posts. Enter IDs such as
12, 34. Dynamic data is allowed. - Type: Comments (the default), Product reviews or Both.
- Number: from 1 to 100. The default is 10.
- Order: Newest first (the default) or Oldest first.
- Top-level only (no replies): tick it to leave out replies.
- Minimum rating (reviews): from 1 to 5. Shown unless Type is Comments.
- Inside the loop, add the tags below from the dynamic data picker (group Kiln) or type them.
Tags
{kiln_comment_author}: the author's name.{kiln_comment_content}: the comment text. Add a word count to shorten it:{kiln_comment_content:25}.{kiln_comment_excerpt}: a short plain-text excerpt. A number sets the words:{kiln_comment_excerpt:15}.{kiln_comment_date}: the date in your site's date format. Add a PHP date format to change it:{kiln_comment_date:Y-m-d}.{kiln_comment_avatar}: the avatar. In a text field it prints an image tag. As an image source it gives the image. A number sets the size in pixels:{kiln_comment_avatar:64}.{kiln_comment_rating}: the review rating as a number from 1 to 5.{kiln_comment_stars}: the rating as stars, for example ★★★★☆.{kiln_comment_link}: the URL of the comment.{kiln_comment_post_title}: the title of the post the comment belongs to.{kiln_comment_post_link}: the URL of that post.{kiln_comment_id}: the comment ID.
How it works with Bricks
- The current post is the post of the nearest loop around this one: a post loop item, or the post of a comment. Outside a loop it is the preview post in the builder, or the page being viewed on a single post or page. On an archive, the blog index or the shop there is no current post, so the loop is empty.
- A rating comes from the comment's
ratingvalue. With Both, Minimum rating (reviews) also hides comments that have no rating. - Dates, ratings and the other tags work only inside a Kiln comments loop. Elsewhere they print nothing.
Limits
- Kiln lists only approved comments on published posts. Comments on drafts, private posts and password-protected posts never show.
- Any post (site-wide) and Specific posts use public post types only.
- Only the comment types
commentandrevieware listed. Comment types from other plugins stay out. - The loop has no pagination. Number is the most you get, up to 100.
- Braces in a comment's text are encoded, so a visitor cannot enter a Bricks tag in a comment and have it run.
- The avatar tag prints nothing when avatars are off (Settings > Discussion).
- If your site or another plugin turns on the
bricks/dynamic_data/replace_nonexistent_tagsfilter, Bricks blanks unknown tags before Kiln resolves them. Then{kiln_comment_avatar}as an image source and{kiln_comment_link}as a link target come out empty. Tags inside text still work.
Settings
None. Turn the module on in Bricks > Kiln (it is on by default).
Requirements
Bricks 2.4 or newer. The module does not need WooCommerce. Product reviews show up when WooCommerce, or
another plugin, saves comments of type review.