Support » Fixing WordPress » the_time() incorrectly shows July 9, 2009 for all posts

  • I’m having an issue at the page: All posts on the page are showing up as July 9, 2009, even though the posts were all posted on different days (if you navigate to the page for an individual post, it shows the correct date). The page does correctly show the post title / content / comments / etc — everything except the date is shown correctly.

    Any thoughts on why the_time() is displaying the incorrect date here? I’ve posted below the loop for displaying posts from that page. Thanks!

    while ($fellow_query->have_posts()) : $fellow_query->the_post(); ?>
                                            <h2<?php if ($post_count == 1) echo(' class="top"'); ?>><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_titl\
    e(); ?></a></h2>
                                            <div class="format_text">
    <?php the_content('[Read more &rarr;]'); ?>
            <p class="to_comments"><span class="date"><?php the_time('F j, Y'); ?></span> &nbsp; <span class="num_comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span></p>
            endwhile; ?>
Viewing 1 replies (of 1 total)
  • Ridonkulous


    I’ve experienced this recently myself, and can say that the second loop that you have going is probably getting its date from the container page. While somewhat roundabout, my solution is to get the information directly from the $post as follows:

    global $post;
    echo mysql2date('F j, Y', $post->post_date);
Viewing 1 replies (of 1 total)
  • The topic ‘the_time() incorrectly shows July 9, 2009 for all posts’ is closed to new replies.