I'm having a weird issue with Wordpress which I cannot solve by myself, and for which I couldn't find an aswer over this and other websites.

Basically, I have a custom loop.

while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to    <?php the_title_attribute(); ?>">
<?php the_post_thumbnail('featured'); ?></a>
<div class="datetitle">
<div class="dateonly"><?php the_date('d.m.Y'); ?></div>
<div class="titleonly"><?php    the_title(); ?></div>
<?php endwhile; ?>
<? wp_reset_postdata(); ?>

If I then create another custom query similar to this one, or even if i just duplicate this query further down my page, I don't get the php the_date to return any value! this is the strangest thing... what am I doing wrong?

1 Answer 1


See the_date() in WordPress Codex for an explanation:

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() or get_the_date() (since 3.0) with a date-specific format string. Use <?php the_time(get_option('date_format')); ?> to add the date set in the admin interface.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.