WordPress.org

Ready to get started?Download WordPress

Forums

How to add extra field to comments (6 posts)

  1. Tara
    Member
    Posted 3 years ago #

    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.

  2. cbvmercado
    Member
    Posted 3 years ago #

    I got the similar question.

  3. Tara
    Member
    Posted 3 years ago #

    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.

  4. tubs
    Member
    Posted 3 years ago #

    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

  5. solace10
    Member
    Posted 3 years ago #

  6. pritee
    Member
    Posted 3 years ago #

    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 ?

Topic Closed

This topic has been closed to new replies.

About this Topic