WordPress.org

Ready to get started?Download WordPress

Forums

All comments showing date of initial post (5 posts)

  1. ygggroup
    Member
    Posted 6 years ago #

    For some time now, the comments in our blog have been showing the same date as the initial blog post, no matter the length of time over which the comments were made.

    As an example:

    Nearly 200 comments were posted in this entry over the course of almost two weeks.

    But the date on every comment is the same.

    I've tried using the wp_time_since plugin to display it as "1 day, 3 hours ago", but that time remains the same as well.

    Has anyone ever experienced this or come across a fix.

    Any tips are enormously appreciated.

  2. moshu
    Member
    Posted 6 years ago #

    There was a similar case and it was caused (as always) by human error: wrong code in the comments.php file. If the_date or the_time is used = that's the post's time.

    This is the proper code to use:
    http://codex.wordpress.org/Template_Tags/comment_time

  3. ygggroup
    Member
    Posted 6 years ago #

    Thanks moshu. My mistake.

    <?php comment_time('F j, Y'); ?> worked fine.

    Cheers.

  4. ninjaboy81
    Member
    Posted 6 years ago #

    comment_time() and comment_date() functions both print the time/date by default. but how do i access the date of a comment without having it display?

    for example if i want to store the date in a variable like: $my_date = comment_date()

    without it printing to the screen?

  5. ninjaboy81
    Member
    Posted 6 years ago #

    figured it out:

    get_comment_time('format string goes here');

Topic Closed

This topic has been closed to new replies.

About this Topic