How to add extra field to comments (6 posts)

  1. Tara
    Volunteer Moderator
    Posted 5 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.


  2. cbvmercado
    Posted 5 years ago #

    I got the similar question.

  3. Tara
    Volunteer Moderator
    Posted 5 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;

    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
    Posted 5 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!


  5. solace10
    Posted 5 years ago #

  6. pritee
    Posted 5 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