adding a text message beside the comment submit button

What is the cleanest way to display a text message beside the submit button like this in screen shot:

example of what I am talking about

I am currently doing it by editing the file wp-includes/comment-template line 1577 (wordpress 3.5)

before:

<input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" 
value="<?php echo esc_attr( $args['label_submit'] ); ?>" /> 

after:

<input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" 
value="<?php echo esc_attr( $args['label_submit'] ); ?>" /> 
(your message will only be visible after moderation)

I understand this is not the optimal way to do it, but what is the way to do it.

I prefer as a plugin, but editing a theme would be fine.

3 Answers
3

You should not edit the WordPress core files!

If you have comment_id_fields() in your comments template, like this:

<p class="form-submit">                                                            
    <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>"
    value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
    <?php comment_id_fields( $post_id ); ?>
</p>

you might use:

add_filter("comment_id_fields","my_submit_comment_message");
function my_submit_comment_message($result){
    return $result." <span>(your message will only be visible after moderation)</span>";
}

and place it in functions.php in your current theme directory.

Leave a Comment