Site logo

[Resolved] Help with changing a heading

Home Forums Support [Resolved] Help with changing a heading

Home Forums Support Help with changing a heading

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2473176
    Scott

    I don’t think this is actually a generatepress issue but I’ll post it anyway to see if anyone has a solution.

    If one allows commenting on posts in a WordPress site the comment box itself seems to not be addressed by the theme. Basically one will have the title of the comment box hard coded to be an h3 heading. This can be problematic if you have anything h4 or smaller before the comment box.

    I can and have edited the core WordPress file /includes/comment-template.php at lines 2486 and 2487 to change the h3 to P because if in the content of the post you don’t use any other headings pagespeed insights will throw an accessibility error that the headings are not in a descending sequential order.

    I can change text size color etc of this title via css but I don’t think css can change an h3 to anything else.

    If anyone knows how I can do this via css please share. Or maybe a code snippet could do this the functions are title-reply-before and title-reply-after on lines 2486 and 2487.

    Merry Christmas

    #2473279
    Fernando
    Customer Support
    #2473297
    Scott

    Hey thank you for the reply. It’s way over my head though. But it seems like an awful lot just to change a h3 to a P.

    Because I have a percentage of clients who are dependent on assistive technologies the fact WordPress decided to hardcode the h3 into their core file presents a problem for some that are disabled.

    For now until I can find a fix the typical WordPress user can negotiate I’ve just edited the WordPress file and made the perms on it immutable so that it can’t be overwritten.

    #2473333
    Fernando
    Customer Support

    Actually, can you try this snippet and see if it works?:

    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);

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    #2474120
    Scott

    Works like a charm!

    Thank you

    #2474235
    Fernando
    Customer Support

    You’re welcome, Scott! Glad that worked!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.