• Resolved Andrew

    (@andrewkantor)


    I’m trying to do something I thought was simple: I want the date on each post in my search results (search.php) to show the date the post was published, not the date I posted it.

    For some reason, though, it always displays the posted date, so if I’ve backdated or scheduled posts, they get listed on the posted date.

    My code is pretty vanilla:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       <div class="entry">
         <a href="<?php the_permalink(); ?>" target="_self">
         <h2><?php the_title(); ?></h2></a>
         <div class="date">Published <?php the_time('F n, Y'); ?></div>
         <?php the_excerpt(); ?>
       </div>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    Any idea why the_time is showing the posted dates? Is there a workaround? Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter Andrew

    (@andrewkantor)

    Ha! Found and fixed — but I can’t see how to remove this post. So… resolved by the dopey OP himself.

Viewing 1 replies (of 1 total)
  • The topic ‘Show PUBLISHED date, not POSTED date’ is closed to new replies.