Comment
in package
Comment functionality.
Customises comment form by using standard hooks to alter values.
Tags
Table of Contents
Constants
- COMMENT_AUTHOR = 'comment-author.php'
- The partial containing markup for the comment author.
- COMMENT_AUTHOR_EMAIL = 'comment-author-email.php'
- The partial containing markup for the comment author email.
- COMMENT_COOKIES_CONSENT = 'comment-cookies-consent.php'
- The partial containing markup for the comment cookies consent.
- COMMENT_FIELD = 'comment-field.php'
- The partial containing markup for the comment field.
- COMMENT_HEADER = 'comment-header.php'
- The partial containg the comment form header markup.
- SUBMIT_BUTTON = 'comment-submit-button.php'
- The partial containing markup for the submit button.
- SUBMIT_FIELD = 'comment-submit-field.php'
- The partial containing markup for the wrapper around the submit button and hidden fields.
Properties
- $comment_author : string
- The fully qualified path to the comment author partial.
- $comment_author_email : string
- The fully qualified path to the comment author email partial.
- $comment_cookies_consent : string
- The fully qualified path to the comment cookies consent partial.
- $comment_field : string
- The fully qualified path to the comment field partial.
- $comment_header : string
- The fully qualified path to the form header partial.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $progress_container : string
- The progress indicator container markup.
- $require_name_email : bool
- Required field flag.
- $submit_button : string
- The fully qualified path to the submit button partial.
- $submit_field : string
- The fully qualified path to the submit button wrapper partial.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- render_form_top() : void
- Add markup to beginning of comment form for progress indicator container.
- set_cancel_reply_link() : string
- Edit link markup for cancel comment reply.
- set_date_link() : bool
- Remove the link on comment date.
- set_form() : array<string|int, mixed>
- Comment form customisation.
- set_reply_link() : string
- Edit link markup for comment reply.
- set_reply_link_args() : array<string|int, mixed>
- Filter the comment reply link arguments.
- __construct() : void
- Initialise the class.
Constants
COMMENT_AUTHOR
The partial containing markup for the comment author.
protected
string
COMMENT_AUTHOR
= 'comment-author.php'
Tags
COMMENT_AUTHOR_EMAIL
The partial containing markup for the comment author email.
protected
string
COMMENT_AUTHOR_EMAIL
= 'comment-author-email.php'
Tags
COMMENT_COOKIES_CONSENT
The partial containing markup for the comment cookies consent.
protected
string
COMMENT_COOKIES_CONSENT
= 'comment-cookies-consent.php'
Tags
COMMENT_FIELD
The partial containing markup for the comment field.
protected
string
COMMENT_FIELD
= 'comment-field.php'
Tags
COMMENT_HEADER
The partial containg the comment form header markup.
protected
string
COMMENT_HEADER
= 'comment-header.php'
Tags
SUBMIT_BUTTON
The partial containing markup for the submit button.
protected
string
SUBMIT_BUTTON
= 'comment-submit-button.php'
Tags
SUBMIT_FIELD
The partial containing markup for the wrapper around the submit button and hidden fields.
protected
string
SUBMIT_FIELD
= 'comment-submit-field.php'
Tags
Properties
$comment_author
The fully qualified path to the comment author partial.
protected
string
$comment_author
= ''
Tags
$comment_author_email
The fully qualified path to the comment author email partial.
protected
string
$comment_author_email
= ''
Tags
$comment_cookies_consent
The fully qualified path to the comment cookies consent partial.
protected
string
$comment_cookies_consent
= ''
Tags
$comment_field
The fully qualified path to the comment field partial.
protected
string
$comment_field
= ''
Tags
$comment_header
The fully qualified path to the form header partial.
protected
string
$comment_header
= ''
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$progress_container
The progress indicator container markup.
protected
string
$progress_container
= ''
Tags
$require_name_email
Required field flag.
protected
bool
$require_name_email
= true
Tags
$submit_button
The fully qualified path to the submit button partial.
protected
string
$submit_button
= ''
Tags
$submit_field
The fully qualified path to the submit button wrapper partial.
protected
string
$submit_field
= ''
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
render_form_top()
Add markup to beginning of comment form for progress indicator container.
public
render_form_top() : void
Tags
set_cancel_reply_link()
Edit link markup for cancel comment reply.
public
set_cancel_reply_link(string $cancel_comment_reply_link, string $link_url, string $link_text) : string
This adds the required button classes to the link.
Parameters
- $cancel_comment_reply_link : string
-
The HTML-formatted cancel comment reply link.
- $link_url : string
-
Cancel comment reply link URL.
- $link_text : string
-
Cancel comment reply link text.
Tags
Return values
string —The changed link.
set_date_link()
Remove the link on comment date.
public
set_date_link() : bool
Tags
Return values
bool —The set links flag (false).
set_form()
Comment form customisation.
public
set_form(array<string|int, mixed> $defaults) : array<string|int, mixed>
This sets to properties of the standard WordPress comment form. It leverages the standard pNet form handling and styles.
Parameters
- $defaults : array<string|int, mixed>
-
Default comment form fields.
Tags
Return values
array<string|int, mixed> —The modified form and fields settings.
set_reply_link()
Edit link markup for comment reply.
public
set_reply_link(string $comment_reply_link, array<string|int, mixed> $args, WP_Comment $comment, WP_Post $post) : string
This adds the required button classes to the link.
Parameters
- $comment_reply_link : string
-
The HTML markup for the comment reply link.
- $args : array<string|int, mixed>
-
An array of arguments overriding the defaults.
- $comment : WP_Comment
-
Comment being replied to. Default current comment.
- $post : WP_Post
-
The post that the comment is going to be displayed on.
Tags
Return values
string —The changed link.
set_reply_link_args()
Filter the comment reply link arguments.
public
set_reply_link_args(array<string|int, mixed> $args, WP_Comment $comment, WP_Post $post) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
-
Default reply links arguments.
- $comment : WP_Comment
-
Comment being replied to. Default current comment.
- $post : WP_Post
-
The post that the comment is going to be displayed on.
Tags
Return values
array<string|int, mixed> —The modified comment args.
__construct()
Initialise the class.
protected
__construct() : void