[Resolved] Remove comment url and email field, change comment label text

Home Forums Support [Resolved] Remove comment url and email field, change comment label text

Home Forums Support Remove comment url and email field, change comment label text

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1489370
    Joyce

    Hi Team,

    This ticket is 1a & 1b in https://generatepress.com/forums/topic/child-theme-12/, thanks.

    /inc/structure/comments.php
    – remove comment url/email input field (I tried to add in function.php and also generatepress/comments.php, but it does not work.

    add_filter('comment_form_default_fields', 'url_filtered');
    function url_filtered($fields)
    {
      if(isset($fields['url']))
       unset($fields['url']);
      return $fields;
    }
    add_filter('comment_form_default_fields', 'email_filtered');
    function email_filtered($fields)
    {
      if(isset($fields['email']))
       unset($fields['email']);
      return $fields;
    }

    /inc/structure/comments.php
    – change text (leave a comment, Post Comment) and author label

    $defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Change text-Leave a Comment', 'generatepress' ) );
    $defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Change text-Post Comment', 'generatepress' ) );
    <label for="author" class="screen-reader-text">Change text-author label</label>
    #1489490
    Elvin
    Staff
    Customer Support

    Hi,

    For comment fields: You can try this guide out.
    https://docs.generatepress.com/article/remove-e-mail-and-url-field-from-comment-form/

    Your code is pretty close but perhaps doing step of from the article will help.

    For label and button text: You can try these filters
    For comment area label – https://docs.generatepress.com/article/generate_leave_comment/
    For button – https://docs.generatepress.com/article/generate_post_comment/

    Example:

    add_filter( 'generate_leave_comment', function () {
        return 'Comment area text here';
    } );
    add_filter( 'generate_post_comment',function () {
        return 'Post comment button text here';
    } );
    #1489504
    Joyce

    Thanks Elvin, I added in the child theme function.php, it works fine, thanks.

    #1489505
    Elvin
    Staff
    Customer Support

    Nice one. No problem. 🙂

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