• Resolved epicjono

    (@epicjono)


    Hi, I’d like to make some changes to the native WordPress comments. I tinkered with comments.php and comments-link.php in my child theme, but I wasn’t successful. I want to change the title of the comment section, and also remove the option to submit a website. Any help is appreciated!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Check out lines 9-11 in comments.php. That’s where the <h2> element with the title is created. Right now, it uses the comments_number() function to update the title text based on the number of comments, but you could replace all of that with plain text if you’d like.

    As for removing the website option, you can start by copying the ct_period_update_fields() function into your child theme’s functions.php file. This function creates the input fields for the comment form including the name, email, and website field. Update the URL field as follows:

    $fields['url'] = '';

    Instead of outputting the paragraph element with the input, you’re returning an empty string, which will effectively remove the website field from the form.

    Thread Starter epicjono

    (@epicjono)

    Hey Ben,

    For the comment title, I was talking about the “Leave a Comment” title. I believe lines 9-11 are for the “Be first to leave a comment” or “## Comments” text. I’m trying to change “Leave a Comment” to something else that can kind of encourage them a little more.

    And also, I’m not sure where to find the specified function – I searched in a few different files.

    Thank you!

    Theme Author Ben Sibley

    (@bensibley)

    Sorry for misunderstanding. The solution in this case is to add a new argument to the comment_form() function on Line 24 of comments.php. You can update it like this:

    comment_form( array(
          'title_reply_before' => '<div id="reply-title" class="comment-reply-title">',
          'title_reply_after'  => '</div>',
          'title_reply'        => 'Tell us what you think'
          
        ) );

    In my example, I’ve added the title_reply argument, which is how we can change the title text that displays before the form. You can edit the text in quotes to whatever you’d like.

    As for the ct_period_update_fields() function, you can find it on Line 167 of the functions.php file.

    Thread Starter epicjono

    (@epicjono)

    Perfect, it all worked, thanks!

    Theme Author Ben Sibley

    (@bensibley)

    You’re welcome! Stay in touch if you need anything else.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customize Comment’ is closed to new replies.