WordPress.org

Forums

posting recent posts with dates (3 posts)

  1. rinthe
    Member
    Posted 6 years ago #

    code:
    <?php
    global $post;
    $myposts = get_posts('numberposts=5&order=DESC&orderby=post_date');
    foreach($myposts as $post) :
    ?>

  2. "><?php the_title(); ?> <small><?php the_date(); ?></small>
  3. <?php
    endforeach; ?>

    so im trying to post the latest 5 posts with the dates. but the date only appears on the latest ONE post. if i use the_time() instead of the_date(), it shows up on all of them, but the_date() is what i really need. any idea what's going on?

    thanks,

  • kulpreetsingh
    Member
    Posted 6 years ago #

    Just asking - what is the difference between the_time and the_date if you can adjust the formatting on the_time to show the date in whichever way you like?

  • whooami
    Member
    Posted 6 years ago #

    what is the difference between the_time and the_date if you can adjust the formatting on the_time to show the date in whichever way you like?

    This IS the difference:

    but the date only appears on the latest ONE post.

    http://codex.wordpress.org/Template_Tags/the_date:

    SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() with a date-specific format string.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags