Hi @appliedwater456
Changing the heading level of the comment box title using CSS is possible, although it is not the recommended approach. To do so, you can use the content property in a pseudo-element, along with the counter-increment and counter-reset properties.
Here is an example of how you can change the heading level of the comment box title to a level 4 heading using CSS:
/* Reset the heading level counter */
body {
counter-reset: h;
}
/* Increment the heading level counter for each heading element */
h1,
h2,
h3,
h4,
h5,
h6 {
counter-increment: h;
}
/* Use the pseudo-element to insert the heading level as content */
.comments-title:before {
content: "h" counter(h) " ";
}This will change the heading level of the comment box title to level 4, regardless of the actual heading element used in the HTML.
Keep in mind that this approach is not recommended, as it goes against the semantic meaning of the heading element and can create confusion for assistive technology users. A better approach would be to modify the code in the comment-template.php file to use an appropriate heading element for the context.
You could also consider using a plugin or custom function to modify the heading level of the comment box title. This would allow you to make the change without modifying core WordPress files, which is generally a good practice to avoid conflicts when updating the WordPress software.
Hi!
You can use the hook: comment_form_defaults.
Is this working for you?
add_filter('comment_form_defaults', function ($defaults){
$defaults['title_reply_before'] = '<h4 id="reply-title" class="comment-reply-title">';
$defaults['title_reply_after'] = '</h4>';
}
Thread Starter
Scott
(@midipedalboards)
Thank you Miguel. When I try that snippet in Code Snippets it returns:
The code snippet you are trying to save produced a fatal error on line 4:
Unclosed ‘(‘ on line 1
Thread Starter
Scott
(@midipedalboards)
This fixed it though,
add_filter('comment_form_defaults',function($defaults){
$defaults['title_reply_before'] = '<p id="reply-title" class="comment-reply-title">';
$defaults['title_reply_after'] = '</p>';
return $defaults;
}, 10, 1);
