I have a single.php page where I call the the_content()
function, followed by the comment_form()
function to display the comment box.
While this function does display the logged in user, link to log out, textarea for comment, and post button, and I can edit the CSS, I'm wondering if there a way to edit the markup that is generated.
I've found a link that details the markup of comment.php from TwentyTwenty theme, but does not include the markup for said comment box.
The two main things I'd like to do is; add the users avatar next to the comment box, and add css classes to the button and textarea for styling.
I have a single.php page where I call the the_content()
function, followed by the comment_form()
function to display the comment box.
While this function does display the logged in user, link to log out, textarea for comment, and post button, and I can edit the CSS, I'm wondering if there a way to edit the markup that is generated.
I've found a link that details the markup of comment.php from TwentyTwenty theme, but does not include the markup for said comment box.
The two main things I'd like to do is; add the users avatar next to the comment box, and add css classes to the button and textarea for styling.
Share Improve this question asked May 11, 2020 at 12:32 Chillin'Chillin' 1011 Answer
Reset to default 0I covered just the other day some of the comment (textarea) filters here, https://wordpress.stackexchange/a/366147/144392
But the filters you may want to look into are most likely,
- comment_form_fields
- comment_form_field_{$name}
EDIT 11.5.2020: Codex example for comment_form($args)
,
$comments_args = array(
// Change the title of send button
'label_submit' => __( 'Send', 'textdomain' ),
// Change the title of the reply section
'title_reply' => __( 'Write a Reply or Comment', 'textdomain' ),
// Remove "Text or HTML to be displayed after the set of comment fields".
'comment_notes_after' => '',
// Redefine your own textarea (the comment body).
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
);
comment_form( $comments_args );