WordPress.org

Ready to get started?Download WordPress

Forums

the_time() incorrectly shows July 9, 2009 for all posts (2 posts)

  1. anuraagc
    Member
    Posted 4 years ago #

    I'm having an issue at the page: http://fellows.ghcorps.org/?page_id=131. 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;]'); ?>
                                            </div>
            <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>
    <?php
            $post_count++;
            endwhile; ?>
  2. Ridonkulous
    Member
    Posted 3 years ago #

    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);

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags