Archived topic
Change H3 in comments
23 replies · Started by AJ on February 24, 2019
It should work for both, no matter the post has comments or not.
Could you share the link of your site in question?
Here is a link for a post with comment: https://tri-it-fit.de/motivationsprueche-sport/
And here is one without a comment: https://tri-it-fit.de/fitnessuebung-turkish-get-up/
Let's try the steps below:
1) Disable your cache plugin and clear your cache.
2) Make sure this is the only code you added to your child theme to eliminate conflicts from other codes.
I did both. Cleared the cache, and it is the only code I added.
I can see both of them are working now, no matter there's comment or no comment :)
https://www.screencast.com/t/v1aoby8k1K
Sorry. Now I know what you mean. 😅 Yes the "leave a comment" part is no longer an H3 headline. But the "x thought on.." part is still H3.
In this case I still have a problem with the headline structure because in many articles there is no H2 headline.
That's why I asked for both headlines in the comment section (https://generatepress.com/forums/topic/change-h3-in-comments/#post-1688542)
The topic starter is using a child theme, so this is how he managed to change the H3 tag of the comment title:
https://wp-puzzle.com/docs/basic/change-h3-in-comments-list-and-form.html
If you are not using child theme, try this:
add_filter( 'generate_comments_title_output', function( $output, $comments_title ) {
return sprintf(
'<strong class="comments-title">you custom comment title</strong>',
esc_html( $comments_title )
);
}, 10, 2 );
Thanks for your help. The last solution is working. :)
Nice!
Glad to hear that :)