0

Good Day. I Recently try to figure out for adding the custom field in the comment box it working fine. Still I need to know how to add the custom field after the comment box. I am not sure how to do this.

add_filter('comment_form_defaults', 'change_comment_form_defaults');

function change_comment_form_defaults($default) {

    $commenter = wp_get_current_commenter();

    $default['fields']['comment'] .= '<p class="comment-form-author">' .
            '
<input type="checkbox" style="margin:0px;height:auto;width:auto; position:relative;" name="privacy" value="1"/> I agree to the Terms of Use and Privacy Policy</p>';
    return $default;
}

When i Tried this above code this way itself is appear. enter image description here

How can i do this to show this field next to the comment box. Any suggestion would be great.

EDITED: enter image description here

1

Try use this action instead

<?php
    add_action("comment_form", "append_notice");
    function append_notice($post_id) {
        ?><p>Here is a notice</p><?php
    }
?>
  • Hi Angela, +1 Thanks for your Response when i use the comment_form hook is working perfect but it appear below the submit button of comment form. I edited my question with what i experienced exactly. Is there is a way to call this output above the submit button of comment form. Thanks in Advance. – Vignesh Pichamani Aug 12 '13 at 9:49
  • Hi Vicky, I don't think there is such option is available unfortunately. The do_action only runs after the form has finished. The best you can do is to modify comments.php directly. – Angela Aug 12 '13 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.