Archived topic
Change h3 tag comment title w/ child theme
5 replies · Started by finanzbeben on September 24, 2022
Dear GP Team
I came across older posts regarding the change of the HTML heading in the comment title tag.
As I learned, I have installed the child theme and copied the comment.php snippet to the child.
Accordingly, I have also changed the HTML heading from H3 to H2 just to make sure that this solution works.
See also the picture from the code in the child theme: https://ibb.co/khpMKkS
The thing ist, this doesn't change a thing.
Do I miss something here? I simply need to install the child theme, copy comment php from the parent theme and adjust, right? Parent theme still activated and NOT the child theme, or am I wrong here?
Kind regards and thanks for your support
Hi there,
If you go with the child theme method, you don't need to add a filter to the functions.php file.
The steps would be:
1. Take a copy of comments.php from the GeneratePress theme, and paste it to your child theme folder.
2. Change this line <h2 class="comments-title">%s</h2> of the child theme comments.php file to <h3 class="comments-title">%s</h3>.
3. Activate the child theme at appearance > themes.
Hi Ying,
Thanks for your answer.
I will try. Is there another method? I thought, it's only possible to use a child theme.
Kind regards
If you install a child theme just for this, then don't.
The PHP snippet would work with the parent theme:
https://docs.generatepress.com/article/generate_comments_title_output/
You can install a plugin called code snippet, then add this PHP snippet to the plugin.
Actually, that did the job for me. Thank you so much. Better approach.
You are welcome :)