Site logo

[Resolved] Remove Default Post Comments and Replace with Gutenberg Post Comments Block

Home Forums Support [Resolved] Remove Default Post Comments and Replace with Gutenberg Post Comments Block

Home Forums Support Remove Default Post Comments and Replace with Gutenberg Post Comments Block

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2126010
    Dean

    Hi.

    I’m using a GP Layout and Block element to create a new blog post design (single). But I’m confused about how to use the Gutenberg “Post Comments” block within a GP Block element.

    When I add the Gutenberg “Post Comments” block to a GP Block element, I can hook it into the right place, and style the container background colours etc as I want, however it still displays the default WP post comments. So now every post has 2 comment areas.

    Trying to figure out how to remove the original WP default blog post comments without disabling or affecting the new Gutenberg Post Comments block which I added.

    This is on an existing website which has a few blog posts with existing comments.

    I tried:

    1. turning off new comments in Settings->Discussion (no effect on existing posts)
    2. unticking “Allow Comments” under discussion in a post’s editor screen (results in “Comments are closed” for both the default WP Comment area and “Post Comments” block)
    3. looked for a Disable Elements setting in GP Element Layout and Post editor screens but can’t find anything

    Any other ideas?

    Thanks guys.

    #2126100
    Dean

    Hi Guys.

    Just a quick update. I couldn’t figure it out so decided to go a different route and just style the default comments with custom css and not use the “Post Comments” block in the end.

    However, if you know how to remove the default WP comments area without affecting the Gutenberg Post Comments block, please let me know so I can make a mental not for the future (was an annoying one for sure).

    Just wanted to let you know not to waste any time on this as I gave up on it.

    Kind regards 🙂

    #2126167
    David
    Staff
    Customer Support

    Hi there,

    not sure how that block works, but you can use this function to remove the comments template:

    add_action( 'wp', function() {
        remove_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 );
    } );
    #2126208
    Dean

    As usual GeneratePress has thought of everything. Weird block that one. Not sure how people are supposed to use it. I mean who wants two comment areas on one page…?

    Anyway thanks David much appreciated :-).

    #2126211
    David
    Staff
    Customer Support

    I think its for Block Based themes, where you can create your owns static HTML templates for posts… i wouldn’t add it directly to the post your editing 🙂

    Glad to be of help

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