I’ve got a great Comment Form and Threaded Comments setup by using the native WordPress functions: comment_form
and wp_list_comments
.
However, I’m trying to also create a custom Contest Comment template for certain posts. I call comments_template('/contest-comments.php', true);
conditionally based on whether a certain custom field exists or not. It works great.
I’m trying to make it look along the lines of http://2010.sf.wordcamp.org/attendees/
I only want to show the person’s name wrapped in a link and their avatar. Therefore, I want my comment form to only show the Name, Email, and URL fields. The text area should be hidden.
For the Comment Form, I am passing an empty value for the comment_field
key in the $args
array I’m passing into comment_form
.
This makes the comment form look okay, but when someone submits a comment, they get a warning from WordPress saying that their message was blank.
Any solutions on how to solve this? Thanks!
Short answer: It doesn’t, but you can get around this:
If you want this only for certain pages, then you should create a custom page template, for eg “boo.php”, and in the code I posted above, only add these filters if the current page template is boo (use
$post->page_template
to get the current page template when doing the check).Related questions:
Yes, it does, use the allow_empty_comment hook, see details here:
https://developer.wordpress.org/reference/hooks/allow_empty_comment/
Here is a sample:
You may also consider unchecking the checkbox in Settings > Discussion for: