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

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

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

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.