Using get_comment_date & get_comment_time In A Custom Comments Loop

When using get_comments or WP_Comment_Query to code your custom comments loop, you can add the date and time using any format strings WordPress.

In this case, we’re using a new WP_Comment_Query to create a custom loop of comments for reviews which output like this :

Comment Date & Time

This example shows both the comment date and comment time however you can use this code to modify both or display the date only for each comment like this:

Comment Date

Demo Video

Shows the comment date displaying for each comment in a custom comments loop. Shows you how to change the comment date format using your WordPress general settings.

Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis child theme.

How To Customize The Code

Download Folder

The download folder contains the custom customments loop you can output using any WordPress or Genesis hook like this :

add_action( 'genesis_after_entry', 'hook_comments_loop' );
function hook_comments_loop() {

if ( have_comments() || get_comments_number( $post_id > 0 ) ) {

echo custom_comments_loop();

}
}

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.