WordPress.org

Support

Support » How-To and Troubleshooting » How to add extra field to comments

How to add extra field to comments

  • Tara

    @t-p

    Volunteer Moderator

    Hi evrybody,

    I use Twenty Ten theme.

    If it’s possible to do, please guide me:

    (1) to add extra field for comments.
    (2) and make it required field.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • cbvmercado

    @cbvmercado

    I got the similar question.

    Tara

    @t-p

    Volunteer Moderator

    hi cbvmercado,

    I figured out as to how to add extra field as follows, hope this helps:

    function my_fields($fields) {
    $fields['new'] = '<p class="comment-form-antispam"</p>' .
    '<label for="new">' . __( custom field ) . '</label>' .
    '<span style="color:red; font-weight:bold"> *</span> ' .
    '<br /><input id="new" name="new" type="text" maxlength="2" value="' .
    esc_attr( $commenter['comment_new'] ) . '" size="10"' . $aria_req . ' />' .
    '</p><!-- #form-section-new .form-section -->';
    return $fields;
    }
    add_filter('comment_form_default_fields','my_fields');

    I don’t know this: I want to make this custom field REQUIRED and use it for anti-spam simple math question like “what is 2+2?”, and be able to check the correct answer.

    If you or someone else can help that be really great.

    Hi t-p,

    Did you have to do anything else to get the extra comment field to display on your website once a comment has been made? I can add the field to the form but then it doesnt show on the published comment!

    Thanks

    Not working please suggest any plugins I using thematic theam and i want to add extra field in my post a comment form … how can I ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add extra field to comments’ is closed to new replies.