• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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();

}
}

Register for full access

Comments

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems