Skip to content

Comments

Ivan edited this page Aug 18, 2022 · 40 revisions

Navitaion



Starter uses default WordPress comment & default Woo reviews features extended by custom cool features: privacy checkbox, recaptcha, fileuploader, ajax for submit comment and load to front, extended rating (woo only), low-rating popup (woo only).

There are two different template sets for WordPress and WooCommerce.

Default WordPress Discussion feature

Default WP "discussion" setting located at /wp-admin/options-discussion.php
Aren't all default features supports by Starter.

Default post settings

Comment - Default post settings
  • "Attempt to notify any blogs linked to from the post" and "Allow link notifications from other blogs (pingbacks and trackbacks) on new posts" - is recommended to keep disabled (why - read here).

  • "Allow people to submit comments on new posts" - only changing default state of Woo "Advanced->Enable reviews" setting when new product is been creating (see)


Other comment settings

Comment - Other comment setting
  • Comment author must fill out name and email - it require name&email for submit comment.
    Files:

    • templates\comment\comment-form.php - template for WP
    • woocommerce-custom\comment\comment-form.php - template for Woo
  • Users must be registered and logged in to comment (Signup has been disabled. Only members of this site can comment.) - when enabled for unlogged users form does not available and displays related message.
    Files:

    • templates\comment\comment-section.php - template for WP
    • woocommerce-custom\comment\comment-section.php - template for Woo
  • Automatically close comments on posts older than, Show comments cookies opt-in checkbox, allowing comment author cookies to be set, Enable threaded (nested) comments - does not supports.

  • Break comments into pages with {#} top level comments per page - in Starter sets how many comments load by default and by click "Show more".
    Files:

    • inc\comment\comment.php
    • templates\comment\comment-section.php - template for WP
    • woocommerce-custom\comment\comment-section.php - template for Woo
  • and the {last|first} page displayed by default - does not supports (due no pagination for comments).

  • Comments should be displayed with the {newer|older} comments at the top of each page - comment order: display older/newer comments on single page.
    Files:

    • inc\comment\comment.php
    • templates\comment\comment-section.php - template for WP
    • woocommerce-custom\comment\comment-section.php - template for Woo

Email me whenever, Before a comment appears, Comment Moderation, Disallowed Comment Keys

Comment - Moderation

All these settings pure backend - so works as expected.

Avatars

Comment - Avatar

Does not supports




Default WooCommerce Reviews feature

Default woo "reviews" setting located at /wp-admin/admin.php?page=wc-settings&tab=products and on each single product in "Advanced" tab.
All default woo features supports by Starter.

Enable reviews

Woo reviews
  • Enable product reviews - enable/disable all reviews for all products: when disabled in loops and on single page displays nothing.
    Files:

    • woocommerce\single-product.php
    • woocommerce-custom\global\product-item.php
  • Show "verified owner" label on customer reviews - display verified owners badge in review.
    Files:

    • woocommerce-custom\comment\comment-item.php
  • Reviews can only be left by "verified owners" - allow reviews for verified owners only.
    Files:

    • woocommerce-custom\comment\comment-item.php

Product ratings

Woo rating
  • Enable star rating on reviews - enable/disable rating.
    Files:

    • inc\comment\comment-backend.php
    • woocommerce\single-product.php
    • woocommerce-custom\comment\comment-form.php
    • woocommerce-custom\comment\comment-item.php
    • woocommerce-custom\global\product-item.php
  • Star ratings should be required, not optional - require rating when enabled.
    Files:

    • inc\comment\comment-backend.php
    • woocommerce-custom\comment\comment-form.php

Single product page

Comment - Single Product

Works only when reviews enabled for all products - allow to disable reviews only for some certain products.
Files:

  • woocommerce\single-product.php
  • woocommerce-custom\global\product-item.php




Custom WordPress Discussion feature

WordPress Discussion feature extended by a few cool features, each can be enabled/disabled in customizer /wp-admin/customize.php -> Starter Theme -> Comments.

"Privacy Policy" checkbox

Comment - 'Privacy Policy' checkbox

Block sending comment without privacy agreeing.
Files:

  • assets\js\modules\wp\comment\comment.js
  • inc\comment\comment-backend.php
  • inc\comment\comment-customizer.php
  • templates\comment\comment-form.php - template for WP
  • woocommerce-custom\comment\comment-form.php - template for Woo

Fileuploader

Comment - File

Files:

  • ACF Comment additional fields
  • assets\js\modules\wp\comment\comment.js
  • assets\js\modules\wp\comment\fileuploader.js
  • assets\scss\theme\snippets\_forms_file_input.scss
  • inc\comment\comment-backend.php
  • inc\comment\comment-customizer.php
  • templates\comment\comment-form.php - template for WP
  • woocommerce-custom\comment\comment-form.php - template for Woo

Ajax load comments

Comment - Break comments

If to setup default WordPress setting 'Break comments into pages with' (and when amount of comments > then setup number) - on single page in comments section appears button 'Show more', by click on this button comments loads via ajax.
Files:

  • assets\js\modules\wp\comment\comment.js
  • inc\comment\comment.php
  • templates\comment\comment-section.php - template for WP
  • templates\comment\comment-item.php - template for WP
  • woocommerce-custom\comment\comment-section.php - template for Woo
  • woocommerce-custom\comment\comment-item.php - template for Woo

Ajax load comment image modal

Images in comments are clickable, by click loads image modal via ajax.
Files:

  • assets\js\modules\wp\comment\comment_modal_image.js
  • inc\comment\comment.php
  • templates\comment\comment-image-modal.php - template for WP
  • woocommerce-custom\comment\comment-image-modal.php - template for Woo

Ajax send comment

Send comment via ajax.
Files:

  • assets\js\modules\wp\comment\comment.js
  • inc\comment\comment-backend.php
  • templates\comment\comment-form.php - template for WP
  • woocommerce-custom\comment\comment-form.php - template for Woo

Validation

Frontend validation processed by html5 checkValidity() (file assets\js\modules\wp\comment\comment.js) in cooperation with bootstrap validation.
Backend validation processed by default $comment->get_error_message() and in file inc\comment\comment-backend.php for catch custom errors (privacy, recaptcha, images, extended rating).
Files:

  • assets\js\modules\wp\comment\comment.js
  • inc\comment\comment-backend.php




Custom WooCommerce Reviews feature

WooCommerce Reviews feature extended by a few cool features, each can be enabled/disabled in customizer /wp-admin/customize.php -> Starter Theme -> Comments.

Extended rating

(woocommerce only feature) Comment - Extended rating

Extend default rating up to 3 separate ratings.
Default rating: available to change by changing value in inputs .js_rating_input (woocommerce-custom\comment\comment-form.php).
Star item width: because rating calculates by js - it's require to know the width of each star, by default it's 22px. If you need to change star item width - it's require to update attribute data-elem_width="22" (woocommerce-custom\comment\comment-form.php) for correct rating functional.
Files:

  • ACF Comment additional fields
  • assets\js\modules\woo\review.js
  • assets\scss\theme\woo\_rating.scss
  • assets\scss\theme\woo\_review.scss
  • inc\comment\comment-backend.php
  • inc\woocommerce\woocommerce-customizer.php
  • woocommerce-custom\comment\comment-form.php
  • woocommerce-custom\comment\comment-item.php
  • woocommerce-custom\global\rating.php

Low-rating popup

(woocommerce only feature) Comment - Low-rating popup

Display popup when low rating comment - low rating is < 4 by default (can be changed in attribute data-minimum_rating="4", woocommerce-custom\comment\comment-form.php).
Files:

  • assets\js\modules\woo\review.js
  • assets\js\modules\wp\comment\comment.js
  • assets\scss\theme\woo\_review.scss
  • inc\woocommerce\woocommerce-customizer.php
  • woocommerce-custom\comment\comment-form.php

Code

  • ACF: Comment additional fields
  • js:
    • assets\js\modules\wp\comment\comment.js - validation, submit, load more
    • assets\js\modules\wp\comment\comment_modal_image.js - comment image modal
    • assets\js\modules\wp\comment\fileuploader.js - fileuploader
    • assets\js\modules\woo\review.js - rating, low-rating modal
  • css:
    • assets\scss\theme\components\_comment.scss - comment
    • assets\scss\theme\snippets\_forms_file_input.scss - fileuploader
    • assets\scss\theme\woo\_rating.scss - rating
    • assets\scss\theme\woo\_review.scss - low-rating popup
  • logic:
    • inc\comment\comment-backend.php - custom validations, save custom rating and images
    • inc\comment\comment-customizer.php - customizer settings.
    • inc\comment\comment.php - load comment, image comment modal
    • inc\woocommerce\woocommerce-customizer.php - customizer extended rating, low-rating modal
  • tpl:
    • templates\comment\comment-form.php - comment form, template for WP
    • templates\comment\comment-image-modal.php - comment image modal, template for WP
    • templates\comment\comment-item.php - comment item, template for WP
    • templates\comment\comment-section.php - wrapper for comments and comment form, template for WP
    • woocommerce-custom\comment\comment-form.php - comment form, template for Woo
    • woocommerce-custom\comment\comment-image-modal.php - comment image modal, template for Woo
    • woocommerce-custom\comment\comment-item.php - comment item, template for Woo
    • woocommerce-custom\comment\comment-section.php - wrapper for comments and comment form, template for Woo
    • woocommerce-custom\global\product-item.php - rating/count comment in loops
    • woocommerce-custom\global\rating.php - rating template
    • woocommerce-custom\single-image-modal.php - single image modal
    • woocommerce\single-product.php - rating/comment on single, comments, comment form include
  • dependence - recaptcha:
    • assets\js\modules\wp\recaptcha.js - recaptcha js
    • inc\recaptcha.php - recaptcha customizer and function

Clone this wiki locally