Home › Forums › Support › Remove Default Post Comments and Replace with Gutenberg Post Comments Block
- This topic has 4 replies, 2 voices, and was last updated 4 years, 2 months ago by
David.
-
AuthorPosts
-
February 20, 2022 at 12:04 am #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:
- turning off new comments in Settings->Discussion (no effect on existing posts)
- 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)
- looked for a Disable Elements setting in GP Element Layout and Post editor screens but can’t find anything
Any other ideas?
Thanks guys.
February 20, 2022 at 2:59 am #2126100Dean
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 🙂
February 20, 2022 at 5:10 am #2126167David
StaffCustomer SupportHi 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 ); } );February 20, 2022 at 5:57 am #2126208Dean
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 :-).
February 20, 2022 at 6:00 am #2126211David
StaffCustomer SupportI 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
-
AuthorPosts
- You must be logged in to reply to this topic.