Support » Fixing WordPress » posting recent posts with dates

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

  • “><?php the_title(); ?> <small><?php the_date(); ?></small>
  • <?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,

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    (@whooami)

    Member

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘posting recent posts with dates’ is closed to new replies.