The way you’re doing this, you’re going to get the raw SQL date that’s stored in the wp_comments table.
You can still use the convenience functions like comment_date
with get_comments
. In this case, we’ll use get_comment_date
. The first argument is the date format — if you leave it blank, WP will use whatever date format is set in the options > general page.
<?php
foreach($comments as $comment) :
echo "<li class=clearfix>
<span class=comment-details>{$comment->comment_content}</span>";
echo '<span class=comment-date>' . get_comment_date( '', $comment ) . '</span>';
echo "<span class=comment-author>By {$comment->comment_author}</span>
</li>";
endforeach;
Otherwise you could use PHP’s strtotime
and date
to generate the date format you want.
date('F j, Y', strtotime($comment->comment_date));
Related Posts:
- Stop WordPress redirecting comment-page-1 to the post page?
- Importing old Disqus comments into WordPress
- How to add a class to the comment submit button?
- Comments screen in backend, how to disable email address of commenter for non admins
- How can I limit the number of comments per registered user per day?
- Parent comment’s author name
- get_comments_number of depth-1 (Level 1) (1 post)
- How can I control the comment counts filtering my CPT replies?
- How to auto-approve internal pingbacks?
- Disable wordpress comments API
- List Recent Comments from Across a Multi-site Network
- Can I store my custom comment_type into wp_comments table?
- Number of External Links in Comments – Moderation Option
- What is comment_karma?
- How to override function twentyten_comment
- Disqus over the default commenting engine, what are some pros and cons?
- How To Remove The “Click here to cancel reply” Link From The WordPress Comment Form
- Plugin from WordPress.com for comment notification…available? [closed]
- Passing arguments to wp_list_comments callback function
- What are the additional fields in wp_comments used for?
- Enable Recent Comments widget to display comments on attachment posts
- Change allowed HTML tags for comments
- How can I highlight admin comments?
- On WordPress 4.4, how to get the post id using the comment_post hook
- Block comments from search engine indexing
- Create a “Reject” action for comments?
- Adding another arg to comments_popup_link
- Exclude Duplicate Posts in this SELECT Query
- Add action on delete comments?
- Exclude child comments in get_comments() or WP_Comment_Query?
- Changing “submitted on date” of comments
- How to allow more HTML tags in comment for a certain comment_type
- Can’t seem to get this CSS to work…any ideas why? [closed]
- Change order of comment fields
- WordPress custom form action url
- How to add a strip of visual editor on top of comments textarea
- Threaded comments not working
- Customizing comments pagination for bootstrap
- comment_post action hook running on page load instead of after a comment is posted
- woocommerce allow users to select or use avatar
- How to sort posts by the average of comment meta values
- Error While Sending Comment
- How to get all comment authors of a single post?
- Get return value of wp_insert_comment (comment ID)
- How to use the ‘comments_number’ filter?
- Problem with Comment link in Blog [closed]
- Commenting in user profile page?
- Can i Use own Facebook App ID with this Social Comment Plugin? [closed]
- How do i hide all comments from logged out users
- Only allow the post author and admin to comment on a post
- Show Social Sharing Buttons And Facebook Comments In Lightbox Modal Dialog (Image Overlay)?
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- How come pending comments are appearing in admin?
- Generate Sub-Comments with WP-CLI [closed]
- comment_date() & comment_time() not working from functions.php
- Repositioning ‘Reply’ Link in Comments
- Add an attachment feature to comments
- How Do I Allow Comment Moderation for Other User’s Posts?
- Counting Comments as Singular and Plural in comments.php Template
- Correct way to retrieve comment attributes for desired results
- how to remove WordPress default comment system
- How to get Post title by locale with Qtranslate-X
- ‘comment_post’ hook doesn’t seem to work? [closed]
- Retrieve the last 5 comment URLs
- WordPress comment for virtual page
- Admin Dashboard – Recent Comments source
- After submit comments select the current tab
- Facebook comments widget – App ID
- Comments screen in backend, how to disable visual editor when replying to a comment
- Genesis Child Theme Modifying Comments display
- Hide Trackbacks/Pingbaks if none exists
- How to use filter on comment submission/insert
- WordPress comment reply link image
- Comment Pagination
- See some statistics about the comments
- Custom comment types. Are they a possibility?
- How to output comments in Descending order by date using wp_list_comments?
- Re-Direct After Comment Submit IF Comment Comes from Sign-Up Page
- Is there a way to link to the BOTTOM of the comments on a wordpress page?
- How to add inside WordPress comments loop?
- How do I edit Comments.php so I can add Schema markup to comment output?
- Author name length character limit?
- How to pass settings to comment_form() if theme only uses comments_template()?
- Change author, disable comments, enable trackbacks for all items in library
- Display Most Recent Three Comments Per Post
- reply to comment excerpt instead of author in comment title
- How does WordPress generate a comment website preview?
- Display Comment Form on dedicated Page for each post
- Display facebook comments made on site
- Disable Link to Post from Showing Up in Post’s Comments?
- different levels of nested comments per page
- approve,spam,trash etc. options are not coming on comments in admin panel
- Actual comments not showing, but form is?
- Email from new comments
- How do I convert users who put an email and username for a comment into registered users? [duplicate]
- What filter or action to replace comments or add new comment system
- Display DISQUS on homepage
- How to stop a specific person to comment on my blog? [closed]
- TinyMCE in comment reply form showing toolbar but can’t edit reply
- Add pending for reply comment in console WordPress