How to add time tag...
 
Share:
Notifications
Clear all

[Solved] How to add time tag instead to comments?

8 Posts
2 Users
0 Likes
240 Views
Posts: 4
Topic starter
(@profmeow)
Active Member
Joined: 3 months ago

Hi, I wanted to add the <time> and inside it the datetime tag for the comment published date instead of the <div> tag currently being used to displaying the time for each comment. Is there a way I can do that?

7 Replies
Asti
Posts: 6987
 Asti
Support
(@asti)
Illustrious Member
Joined: 6 years ago

Hi @profmeow,

You can customize the wpDiscuz template files and make the modifications you want.

For an update-safe way to customization, refer to this doc: https://wpdiscuz.com/docs/wpdiscuz-7/customization/custom-template-and-style/

6 Replies
(@profmeow)
Joined: 3 months ago

Active Member
Posts: 4

@asti I'm still not sure how to do it. As it has to have a valid datetime tag and the format is not suitable for the tag.

Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 6987

@profmeow,

Consider enabling the 'Use WordPress Date/Time Format' option to align dates with the WordPress Date/Time format.

The option can be found and managed in the Dashboard > wpDiscuz > Settings > General Settings admin page.  

(@profmeow)
Joined: 3 months ago

Active Member
Posts: 4

@asti I put the WordPress Date/Time in the Y-m-d format and although it shows up in that format (eg. 2023-12-09) on that page when it comes to WPDiscuz it puts it back in the regular word format.

Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 6987

@profmeow,

What is the value of the option I've mentioned in my previous post?

(@profmeow)
Joined: 3 months ago

Active Member
Posts: 4

@asti My bad, I forgot to clarify more specifically.

 

The issue is it's missing the time section in proper ISO format after enabling WordPress Date/Time format. For example, it should be:

<time class="wpd-comment-date" datetime="2023-11-15T18:36">
<i class="far fa-clock" aria-hidden="true"></i>
2023-11-15 18:36
</time>

But it shows up as:

<time class="wpd-comment-date" datetime="2023-11-15 18:36">
<i class="far fa-clock" aria-hidden="true"></i>
2023-11-15 18:36
</time>

 

Is there any way to fix that?

Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 6987

@profmeow,

This is native (core) WordPress functions. You can use the get_comment_date hook to customize the logic according to your preferences.

For more information, refer to: https://developer.wordpress.org/reference/hooks/get_comment_date/

Additional helpful references: 

Share: