- This topic has 23 replies, 5 voices, and was last updated 2 years ago by
Ying.
-
AuthorPosts
-
February 24, 2019 at 9:05 pm #820241
AJ
Hi team,
I am in the process of making a few changes to the comments section.
I want to change
<h3>
tags into<strong>
tags.I’ve managed to change the comments-title (“x thoughts on…”) successfully but am struggling to work out how to change the reply-title (“leave a comment”).
I did find this ticket but it doesn’t explain the code changes required:
https://generatepress.com/forums/topic/remove-h3-from-leave-comment/I’m sure it’s very easy, but I’m not seeing it.
Thanks!
GeneratePress 2.2.2GP Premium 1.7.8February 25, 2019 at 7:19 am #820959David
StaffCustomer SupportHi there,
in your child theme copy of the comments.php look for this section of code:
You can see the opening and closing
<h3>
just change them.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 25, 2019 at 11:37 am #821263AJ
Thanks David.
That’s actually what I did but strangely enough that only changes the “x thoughts on…” header, not the “leave a comment” header.
I am using the marketer template, if that makes a difference.
February 25, 2019 at 12:29 pm #821318David
StaffCustomer SupportOops my bad… having one of those days. So you can filter the Reply title like so:
add_filter( 'comment_form_defaults', 'custom_reply_title' ); function custom_reply_title( $defaults ){ $defaults['title_reply_before'] = '<strong id="reply-title" class="comment-reply-title">'; $defaults['title_reply_after'] = '</strong>'; return $defaults; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 25, 2019 at 12:53 pm #821335AJ
Thanks David, that worked nicely.
February 25, 2019 at 1:16 pm #821353David
StaffCustomer SupportGlad to be of help ( second time round lol )
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 9, 2021 at 9:12 am #1688447Jörg
Hi,
I would like to change the H3 too, but that solution is not working.
Can you help me?
Thanks
March 9, 2021 at 10:15 am #1688533Ying
StaffCustomer SupportHi Jörg,
Could you open a new topic for your question instead of leaving comments in a resolved topic?
In your new topic, could you specify which H3 you are trying to change?
Thanks 🙂
March 9, 2021 at 10:26 am #1688542Jörg
Hi,
I would like to change the same H3 as AJ in the first place (in the comment section “x thoughts on…” and “leave a comment”. Because it’s the same topic, I commented here.
I tried the solution from David, but it didn’t work.
Sure, I should open a new topic with the same problem?
ThanksMarch 9, 2021 at 11:25 am #1688608Ying
StaffCustomer SupportSo you want to change the
<H3>
tag to<strong>
as well?Or you just want to change the text?
March 9, 2021 at 11:42 pm #1689093Jörg
Hi,
I want to change theH3 to a strong.March 9, 2021 at 11:54 pm #1689108Elvin
StaffCustomer SupportHi Jorg,
David’s code found here should work:
https://generatepress.com/forums/topic/change-h3-in-comments/#post-821318I’ve tested it myself to verify. See the comment title here: Demo
You can see that
Leave a comment
got smaller because it’s using<strong>
now instead of<h3>
Perhaps there’s an issue with how you’re adding the PHP snippet. Can you tell us how you’re adding it to your site? Let us know.
A wise man once said:
"Have you cleared your cache?"March 10, 2021 at 1:10 am #1689180Jörg
Hi Elvin,
I tried Davids fist solution (https://github.com/tomusborne/generatepress/blob/6933da4f9a85e183bcf8485836339043dfc4a650/comments.php#L44-L62) but in my comments.php I did not find the line:… if ( have_comments() ) : ?>
<h3 class=”comments-title”> …And i dont know where I should insert the second solution:
add_filter( ‘comment_form_defaults’, ‘custom_reply_title’ );
function custom_reply_title( $defaults ){ …Where should I put this in?
March 10, 2021 at 9:13 am #1689953Ying
StaffCustomer SupportYou could use 1 of the methods from here to add php snippet:
Adding PHP: https://docs.generatepress.com/article/adding-php/March 10, 2021 at 11:15 am #1690142Jörg
I copied this in the child theme functions.php (https://generatepress.com/forums/topic/change-h3-in-comments/#post-821318)
That is fixing my problem for sites who have already one or more comments. On sites without a comment the “write a comment” title is still an H3. -
AuthorPosts
- You must be logged in to reply to this topic.