- This topic has 33 replies, 4 voices, and was last updated 2 years, 5 months ago by Elvin.
-
AuthorPosts
-
February 18, 2021 at 5:21 pm #1663879Jesse
Hello,
I’m using this comments.php in my child theme: https://docs.generatepress.com/article/move-the-comment-form-above-comments/
I want to completely remove (not hide) the comment date and time stamp, along with the “| Edit” link if you are logged in as admin. Please see the attached screenshot to see exactly what I want to remove.
How would I modify the above comments.php in order to accomplish this?
Best regards,
JesseFebruary 18, 2021 at 6:38 pm #1663908ElvinStaffCustomer SupportHi there,
There’s no need to edit any files to do this.
You can completely remove these from the customizer settings.
On Appearance > Customize > Layout > Blog, you’ll find checkboxes to display comment count and display post date. You can uncheck them for both Archive and Post pages if you don’t want them to display for both.
Note: This completely removes the dates and comment links from being included to the DOM structure. If you inspect your page after applying this, you’ll see that the actual HTML structure for these are completely excluded.
February 18, 2021 at 6:43 pm #1663912JesseElvin,
I do not have a “Display Comment Count” option and the “Display Post Date” option is to turn on or off the POST date.
I am wanting to remove the date and time and edit links that appear under each comment as explained in my original post.
Best regards,
JesseFebruary 18, 2021 at 6:51 pm #1663915ElvinStaffCustomer SupportI do not have a “Display Comment Count” option and the “Display Post Date” option is to turn on or off the POST date.
Perhaps your Blog module is not enabled.
Can you check under Appearance > GeneratePress if your “Blog” module is enabled as shown here?
https://share.getcloudapp.com/kpu76RywFebruary 18, 2021 at 6:54 pm #1663920JesseYes, the Blog module is enabled.
February 18, 2021 at 9:01 pm #1663967ElvinStaffCustomer SupportThat’s strange, the option shown here – https://share.getcloudapp.com/WnuBk8JQ – should be visible once you’ve enabled the Blog module.
Can you try disabling ALL plugins except GP Premium to check if its caused by a plugin conflict?
Let us know.
February 19, 2021 at 3:54 am #1664221JesseRespectfully, how will disabling the “Display POST Date” option remove the date and time stamp from the COMMENTS?
Although I don’t see the “Display Comment Count” option for some reason, I do have the “Display Post Date” option. By disabling that option, it removed the publish date from the top of my post. This setting has nothing to do with the date and time stamp in the comments section from what I can tell.
Best regards,
JesseFebruary 19, 2021 at 4:15 am #1664240DavidStaffCustomer SupportHi there,
see Toms reply here:
February 19, 2021 at 4:28 am #1664246JesseThanks, David.
I read that post last night and I see that Tom provided a comments.php to use, but would that solution work for me? Because I’m already using a different comments.php in my child theme (the one that I linked to in my original post).
I’m wondering if we need to modify the existing comments.php that I’m already using?
Best regards,
JesseFebruary 19, 2021 at 11:05 am #1664901TomLead DeveloperLead DeveloperIdeally, we need to add some filters in there to make this easier/prevent the need for a child theme template.
Can you share your current
comments.php
file (using a GitHub gist would be great)? That way I can suggest the necessary changes.February 19, 2021 at 12:48 pm #1664964JesseHi Tom,
This is the exact comments.php that I’m using: https://docs.generatepress.com/article/move-the-comment-form-above-comments/
Thanks so much!
Best regards,
JesseFebruary 20, 2021 at 11:46 am #1665933TomLead DeveloperLead DeveloperSo that function doesn’t actually have the date/time in it. That can be found here: https://github.com/tomusborne/generatepress/blob/3.0.2/inc/structure/comments.php#L21
However, there is no filter to remove those elements right now, so you’d need to overwrite the entire function. That would be kind of a shame in order to do something so small.
What I would suggest is using CSS to hide the date/time for now, and we will have the necessary filters in 3.1.0 in order to fully remove them without overwriting the entire function.
Of course, if you’re required to remove it now, you can overwrite the entire function by copying it: https://github.com/tomusborne/generatepress/blob/3.0.2/inc/structure/comments.php#L12-L91
Then paste it into your child theme
functions.php
file, and remove the date/time: https://github.com/tomusborne/generatepress/blob/3.0.2/inc/structure/comments.php#L47-L58February 20, 2021 at 12:45 pm #1665995JesseThanks, Tom. Very helpful!
Do you have an ETA on v3.1.0?
Best regards,
JesseFebruary 21, 2021 at 10:18 am #1666795TomLead DeveloperLead DeveloperWould love to get it out in March – will do our best 🙂
February 21, 2021 at 12:43 pm #1666901JesseHello Tom,
Just to confirm, the filter will allow complete removal of the comment date and time entirely? Not just removal of the date and time link?
Best regards,
Jesse -
AuthorPosts
- You must be logged in to reply to this topic.