tags:

views:

15

answers:

0

Hi Im having trouble adding my custom fields to the default twentyten comment form. This is what im doing in the functions.php file of my child theme- am i forgetting something?

// Customise comment form for garage-sales page
if ( is_page('my-page') ):

add_filter('comment_form_default_fields','my_comment');
function my_comment($fields) {

    // New fields
    $fields['date'] = '<label>Date:</label><input type="text" name="date" value="'.(!empty($_POST['date']) ? $_POST['date'] : '').'" />';
    $fields['start_time'] = '<label>Start time:</label><input type="text" name="start_time" value="'.(!empty($_POST['start_date']) ? $_POST['start_date'] : '').'" />';
    $fields['end_time'] = '<label>End time:</label><input type="text" name="end_time" value="'.(!empty($_POST['start_date']) ? $_POST['start_date'] : '').'" />';
    $fields['early_birds'] = '<label>No early birds?:</label><input type="checkbox" name="early_birds" '.(isset($_POST['early_birds']) ? 'checked' : '').'  />';
    $fields['bad_weather'] = '<label>Bad weather?:</label><input type="checkbox" name="bad_weather" '.(isset($_POST['bad_weather']) ? 'checked' : '').' />';

    // Remove unwanted default fields
    unset($fields['url']);

    return $fields;
}
endif;