[Resolved] Customize text on comment form

Home Forums Support [Resolved] Customize text on comment form

Home Forums Support Customize text on comment form

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1296323
    Chad

    I am trying to change the text on the comment form.

    Rather than it show things like “Leave a Comment” or the submit button having “Post Comment” — I want it to say “Leave an Answer” and “Post Answer.”

    I attempted to do this like so:

    function change_comment_form( $defaults ) {
    	$defaults['comment_field'] = sprintf(
    		'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    		esc_html__( 'Comment', 'generatepress' )
    	);
    
    	$defaults['comment_notes_before']	= null;
    	$defaults['comment_notes_after']	= null;
    	$defaults['id_form'] 				= 'answerform';
    	$defaults['id_submit'] 				= 'submit';
    	$defaults['title_reply'] 			= apply_filters( 'generate_leave_comment', __( 'Leave an Answer', 'generatepress' ) );
    	$defaults['label_submit'] 			= apply_filters( 'generate_post_comment', __( 'Post Answer', 'generatepress' ) );
    
    	return $defaults;
    }
    
    add_filter( 'comment_form_default_fields', 'change_comment_form' );

    But it doesn’t work and I’m sure it’s probably not the way you’d prefer.

    Please advise.

    Thank you.

    #1296912
    Leo
    Staff
    Customer Support
    #1297547
    Chad

    Yep, worked perfectly. Thanks!

    #1298254
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.