Add Extra Comment Fields WordPress

I am using the Add Extra Comment Fields plugin https://gist.github.com/chrisguitarguy/1233407 . I want to modify it to add voting option.

This is the change I made to add the vote input

    function pmg_comment_tut_style_cheater()
{
    ?>
    <style type="text/css">
        #respond .comment-form-title {
            position: relative;
        }
        #respond .comment-form-title label {
        font-weight: lighter;
            text-transform: uppercase;
            font-size: 13px;
            font-family: 'Montserrat', sans-serif;
            display: block;
        }
    input#pmg_comment_title, input#pmg_comment_vote{
    border: 2px solid #000;
        border-radius: 0;
    width: 100%;
    }
    </style>
    <?php
}

This is the function I am using inside the functions.php

function wpsites_change_note_after_comment_form($arg) {
    $arg['comment_notes_after'] = '<p class="comment-form-title"><label for="pmg_comment_title">' . _x( 'Vote', 'noun' ) . '</label> <input type="number" name="pmg_vote" id="pmg_comment_vote" min="0" max="10" aria-required="true" required="required"/></p>';
    return $arg;
}

add_filter('comment_form_defaults', 'wpsites_change_note_after_comment_form');

The input appears, but it doesn’t work. What am I missing?

Read more here: Add Extra Comment Fields WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *