WidgetCoreWidgetCore Documentation

Comments widget

The complete guide to the WidgetCore Comments widget — comment list and form for the current post, optional fields, required name and email, field order, pagination, avatars, shortcode and styling.

The Comments widget shows the current post's comment list and the comment form in one widget. Saving, spam checks, manual approval and notification emails stay the job of WordPress itself; the widget only gives you control over the look, the layout and the form fields. It needs no other plugin, ships no JavaScript of its own and creates no page or option in the dashboard.

ItemValue
Widget namewgcr-comments
Panel titleComments
CategoryWidgetCore Widgets (wgcr)
Shortcode[wgcr_comments]
Stylewgcr-comments (no script)
Root class.wgcr-comments

Quick start

  1. Drag the widget

    On a single-post template (or any page that needs comments) drop “Comments” from the “WidgetCore Widgets” category.

  2. Choose the fields

    In the “Fields” section turn name, email, website and the save-in-browser checkbox on or off and translate the labels.

  3. Set the look

    In the Style tab change the colours, borders, spacing and typography of each part.

  4. Try it on the site

    Send a test comment; instant publishing or manual approval is decided by Settings → Discussion in WordPress.

The “Comment form” section

ControlIDTypeDefaultNotes
Show formformSwitcherOnOff means list only; reply links are hidden too
Form titletitleText“Leave a comment”Empty hides the title visually but keeps it for screen readers
Form title tagtitle_tagSelecth3h2, h3, h4, h5 or div
Note above the fieldsnote_beforeTextareaEmptySimple, safe HTML (links, bold, …)
Note below the fieldsnote_afterTextareaEmptySame as above
Submit button textsubmitText“Post comment”
Cancel reply textcancelText“Cancel reply”The link that appears beside the form title while replying to a comment
Logged-in users onlylogin_onlySwitcherOffGuests see a login message instead of the form

The “Fields” section

ControlIDDefaultNotes
Name, email and website layoutfields_layoutSide by side (row)“Side by side” (row) or “Stacked” (stack); always stacked on narrow screens
Show fieldauthor, email, url, cookiesOnEvery field can be removed on its own
Requiredauthor_required, email_requiredOnName and email; a hidden field is automatically optional
Labelauthor_label, email_label, url_label, cookies_label, comment_label“Name”, “Email”, “Website”, “Your comment” and the checkbox textLeaving it empty restores the default label
Placeholderauthor_ph, email_ph, url_ph, comment_phEmpty
Display orderorder_comment, order_author, order_email, order_url, order_cookies1, 2, 3, 4, 5A number from 1 to 9; the smaller comes first
Comment text rowsrows63 to 15
  • The comment text cannot be removed or made optional.
  • Website is always optional.
  • The “save in browser” checkbox only appears when WordPress' own option for it (Settings → Discussion) is on; the control can only turn it off or change its text.
  • Logged-in users do not see the name, email, website or checkbox fields; they get “Logged in as …” with profile and log-out links instead; the text and the links are editable in the “Messages” section.
  • The field order is changed in the HTML itself, so the Tab key order always matches the visual order.

How required fields work

Every form sends a signed hidden field that tells WordPress whether name and email are required in this form. Without that field WordPress behaves exactly as its own settings say. As a result:

  • You can make name and email optional even when WordPress requires them (for this form only).
  • You can make email required even when WordPress does not.
  • If an email is entered, its format must be valid.
  • A direct post to WordPress' core endpoint (for example by a bot) without this field is checked against the WordPress settings; the widget does not close that path.

The “Comments list” section

ControlIDTypeDefaultNotes
Show listlistSwitcherOn
List titlelist_titleText“Comments”Empty = no title and no counter
List title taglist_title_tagSelecth2h2 to h5 or div
Show comment countshow_countSwitcherOnThe number next to the title
Comments per page (0 = follow WordPress)per_pageNumber00 to 100
List orderorderSelect“Follow WordPress settings” (wp)wp, “Oldest first” (asc) or “Newest first” (desc)
AvataravatarSelect“Follow WordPress settings” (wp)wp, yes (always) or “Hide” (no)
Avatar sizeavatar_sizeNumber4816 to 128 px
Show datedateSwitcherOn
Show reply linkreplySwitcherOnOnly when threaded replies are on in WordPress
Reply link textreply_textText“Reply”
  • Threading, reply depth, pagination and the default order are decided by WordPress (Settings → Discussion); “Comments per page” and “List order” let this widget override them for itself.
  • Pagination prints “Previous”, “Next” and page numbers; the current page is announced to screen readers.
  • An unapproved comment is visible only to its own author, with the “Your comment is awaiting moderation.” message.
  • With the avatar set to “follow WordPress”, the widget respects WordPress turning avatars off.

The “Messages” section

ControlIDDefault
Empty list messageempty_text“No comments have been posted yet.”
Awaiting moderation messagepending_text“Your comment is awaiting moderation.”
Comments closed messageclosed_text“Comments are closed for this post.”
Login required messagelogin_text“You must be logged in to post a comment.”
Show logged-in user textloggedin_showOn
Logged-in user textloggedin_text“Logged in as {name}.”
Show edit profile linkloggedin_profileOn
Edit profile link textloggedin_profile_text“Edit profile”
Show log out linkloggedin_logoutOn
Log out link textloggedin_logout_text“Log out”

The logged-in user text is shown only to logged-in users and only when the form is shown. Write {name} where the user's display name should appear; without it no name is printed. HTML in the text is removed. Turning loggedin_show off removes only this line and keeps the form. It has its own “Logged-in user text” section in the Style tab.

Behaviour in different situations

SituationOutput
Comments openList and form
Comments closedThe list stays; the message “Comments are closed for this post.” replaces the form
Login required and the visitor is a guestThe login message with a login link, no form
Password-protected postNothing is shown
Private post or draftOnly for someone allowed to see it
A post type without commentsNothing is shown

Shortcode

[wgcr_comments]
[wgcr_comments form="no" list_title="Reader comments" avatar="no"]
[wgcr_comments list="no" title="Write your comment" email_required="no" rows="4"]
[wgcr_comments login_only="yes" login_text="Log in to comment"]
  • Every attribute uses the same ID as the tables above (for example author="no", per_page="10", order="desc"). Show/required values are yes and no.
  • One extra attribute, post: the ID of another post; it defaults to the current post.
  • An invalid value silently falls back to the default.
  • The Style tab options exist only in the widget; the shortcode uses the default look. Change it with custom CSS and the classes below.

The Style tab

Every style section is written without !important and affects only this widget.

All size controls (width, padding, margins, gaps, radius) have a device switcher and Normal/Hover tabs — see Responsive sizes and hover.

SectionWhat you change
LayoutMax width, Widget alignment, Gap between list and form
List titleColor, Typography, Counter color, Gap to the list
Form titleColor, Typography
Form cardBackground, Border (type, width and color), Border radius, Shadow, Padding
LabelsColor, Typography, Required asterisk color
FieldsNormal: Text color, Background, Placeholder color, Border (type, width and color); Focus: Background, Border color, Shadow; Typography, Border radius, Padding, Gap between fields
Save-in-browser checkboxColor, Typography
Form notesColor, Typography
Submit buttonNormal: Text color, Background, Border color; Hover: Text color, Background, Border color; Typography, Border radius, Padding, Shadow
Comment cardBackground, Border (type, width and color), Border radius, Shadow, Padding, Gap between comments, Reply indent and spacing (a four-side margin of the replies list relative to the parent card: top is the distance from the parent comment, left/right is the indent; it can differ per device)
AvatarBorder radius (each corner), Border (type, width and color), Avatar width (16 to 200 px, em or rem; the image stays square), Distance from the comment card (outer margin, four sides)
Author nameColor, Typography, Distance from the avatar (outer margin of the name, four sides)
DateColor, Typography, Distance from the avatar (outer margin of the date, four sides)
Comment textColor, Typography
Reply linkNormal: Color, Background; Hover: Color, Background; Typography, Border radius, Padding
PaginationTypography, Color, Background, Hover color, Current page color, Current page background, Border radius
MessagesColor, Background, Typography, Border radius, Padding, Awaiting moderation message color
Logged-in user textText color, Typography, Link color, Link hover color, Link typography, Background, Border, Border radius, Shadow, Padding, Outer spacing

The default colours were chosen for sufficient (AA) contrast. If you change them, check the text/background contrast yourself.

HTML structure and classes

ClassRole
.wgcr-commentsRoot; .wgcr-comments--fields-row for the side-by-side layout
.wgcr-comments-listwrapThe list section
.wgcr-comments-anchorAn empty element that carries id="comments" (first instance only) so theme rules such as #comments .comment .avatar can never override the widget's style controls
.wgcr-comments-title and .wgcr-comments-countTitle and counter
.wgcr-comments-listThe ol list; replies live in .children, inside their parent's card
.wgcr-commentEach comment card (an article that also holds its replies), with the .wgcr-comment-body wrapper (its id is where the reply form opens), .wgcr-comment-head, .wgcr-comment-author, .wgcr-comment-date, .wgcr-comment-text, .wgcr-comment-reply
.wgcr-comments-paginationThe pagination nav; .wgcr-comments-page and .is-current
.wgcr-comments-respondThe form card; .wgcr-comments-form, .wgcr-comments-field, .wgcr-comments-input, .wgcr-comments-submit
.wgcr-comments-notice, .wgcr-comments-pending and .wgcr-comments-loggedinMessages, and the logged-in user text

Accessibility

  • Every field has a real label, and required fields are announced with required and aria-required; the required asterisk is hidden from screen readers.
  • The submit button is a real button, and the Tab order matches the visual order.
  • The pagination navigation has an aria-label and the current page has aria-current="page".
  • The focus ring is drawn for :focus-visible; forced-colors mode and prefers-reduced-motion are supported.
  • The layout uses CSS logical properties, so it works in Persian (right-to-left) and English (left-to-right).

Troubleshooting

ProblemLikely causeFix
The widget shows nothingThe post is password-protected or private, its type has no comments, or the widget is outside a postPlace it in a single-post template; give post in the shortcode
The theme's form or list shows up as wellThe theme's comment area prints for a post the widget printed nothing for (the widget points to another post, the post is password-protected, or the widget sits in another post), or the page is an old cached copyPut the widget in this post's own content and leave post empty; clear the cache
The second form is missingA page has only one formKeep one form per page; give the other instances form="no"
“Please fill in the required fields.”A required field is empty or the email is malformedFill it in, or turn its required switch off
Guests cannot commentWordPress or “Logged-in users only” requires loginCheck Settings → Discussion
Making name or email optional has no effectAn old cached copy of the page, or the form is submitted from elsewhereClear the cache
A comment is not visible after sendingManual approval or WordPress' disallowed listSettings → Discussion; a guest sees it as “awaiting moderation” for ten minutes after sending (or longer if the save-in-browser checkbox was ticked)
The avatar image loads from another siteWordPress' Gravatar behaviourSet “Avatar” to “Hide”

Related guides: Shortcode, Accessibility, Troubleshooting.