WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display dates on Every Post (2 posts)

  1. techtoll
    Member
    Posted 1 year ago #

    I have used a condition for displaying post which is older than 1 day. I have used the looping which something like this

    <?php
    $mylimit=1 * 86400; //1 day * seconds per day
    $post_age = date('U') - mysql2date('U', $post->post_date_gmt);
    if ($post_age < $mylimit) {
    	echo ("at ");
      the_time();
    }
    else {
    	echo ("on ");
    	the_date();
    }
    ?>

    This works fine on single post but on index page only one post displays the date if multiple posts have been done on the same page.

    How to modify it?

    Here is my blog.

  2. techtoll
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags