[Resolved] Change the Comments are closed message for closed comments

Home Forums Support Change the Comments are closed message for closed comments

  • This topic has 3 replies, 2 voices, and was last updated 6 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1247637
    Jurica

    Hi,

    Other than copying comments.php in my child theme and modifying it, is there another way to change default message for closed comments?

    I’m want to change the default text and add a link to the contact page.

    Thank you.

    #1247830
    David
    Staff
    Customer Support

    Hi there,

    you can use the gettext filter like so:

    function db_change_comment_field_names( $translated_text, $text, $domain ) {
    
            switch ( $translated_text ) {
    
                case 'Comments are closed.' :
    
                    $translated_text = __( 'ADD YOUR NEW COMMENTS CLOSED TEXT HERE', 'generatepress' );
                    break;
    
            }
    
        return $translated_text;
    }
    add_filter( 'gettext', 'db_change_comment_field_names', 20, 3 );
    #1248497
    Jurica

    Thank you!

    #1248906
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.