Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
</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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Wow, super thanks! –  Akmur Mar 29 '12 at 0:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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