Archived topic
Change the location of comments on pages
5 replies · Started by David on August 2, 2021
Hello!
I need to change the place where the comments are displayed. I have created a template for each custom post type and right now the comments are displayed in two places into the same page:
- Where I want them to be displayed. This is correct.
- Below all the content.
I want them not to be displayed below all the content. Which file do I have to touch? I have looked at several but I can't find which one it is.
Any help would be greatly appreciated.
Greetings
Hi there,
how did you create your CPT Post template ? And did that include the Comments form function? If so, you can remove that.
Hello, thanks for the quick answer!
I have created the template with the file single-[cpt_name].php and commented out the comments_template function line and then the comments disappear from where I have put them, but they still come out under the content of the template.
I understand that there is a higher file in the hierarchy where the template I created is inserted and because the comments are open the post then shows them in the original place.
Looking at the single.php of generate_press I think this should be in generate_do_template_part( 'single' ) but I don't quite know where it is exactly to create a copy in child site and modify it.
Any ideas?
Thank you very much
Hi there,
Can you share the code contents of the single-[cpt-name].php template you've created?
You can share it with us through https://gist.github.com/ .
Or perhaps can you provide us temporary back end access so we can check it from there?
You can use the private information text field to provide the details. Let us know. :D
Ok, I can see that the comments I dont want to show are included in a div with class="comments-area" so giving it a display:none is all resolved. Thanks!
Nice one. Thanks for sharing it with us. No problem. :D