I searched a lot of thread regarding my problem, but unfortunately I found nothing works, and this my final option. I want to add some custom fields on my comment form. How can I do that?
Leave a Reply
You must be logged in to post a comment.
I searched a lot of thread regarding my problem, but unfortunately I found nothing works, and this my final option. I want to add some custom fields on my comment form. How can I do that?
You must be logged in to post a comment.
Here you go: Adding Custom Fields to WordPress Comment Forms?
And another awesome post on this: http://wpengineer.com/2214/adding-input-fields-to-the-comment-form/
Functions are available to add/update, delete comment meta, similar to post and user meta.
Edit:
Here’s an example to give you a start (put the code into the
functions.php
or in a custom plugin):Add the fields to comment form:
4 functions to retrieve/add/update/delete comment meta:
This is where you’d do the validations:
And save the comment meta:
Retrieve and display comment meta:
(Note: All the code is from the WPengineer link I posted above. There are more details and advanced usages in that post, please check them too! )
This slideshow from Beau Lebens should be able to show you how:
Hooking into Comments
And this blog post from Otto should be able to show you more:
WordPress 3.0 Theme Tip: The Comment Form
There is also a basic plugin available here called “WordPress Plugin: Extra Comment Fields” (sorry can’t post the link).