Question

Got a weird bug best shown by this page http://www.zoecormier.com/freelance/

Scroll down to the article named 'Testing turnitin' and you will see the article date is not showing. The article above it (named 'Stolen words') is showing the date. These two articles have the same date, but only one is displaying it.

Code for the article list is:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php $externalLink = get_post_meta($post->ID, 'external link', true); ?>
<?php $pdfLink = get_post_meta($post->ID, 'pdf link', true); ?>

<ul class="article_index">
    <li class="title"><a href="<?php the_permalink() ?>" title="Read <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <li class="date"><?php the_date('d.m.y') ?></li>
    <li class="publication"><?php echo get_post_meta($post->ID, 'publication', true) ?></li>
    <li class="tags"><?php the_tags(' ',' ',' '); ?></li>
    <li class="link"><?php if ( !$externalLink ) { } else { ?><a href="<?php echo $externalLink ?>"><img src="<?php echo $baseUrl; ?>images/icon_world.gif" alt="Weblink" title="Weblink" width="16" height="16" border="0" /></a><?php } ?></li>
    <li class="pdf"><?php if ( !$pdfLink ) { } else { ?><a href="<?php echo $pdfLink ?>"><img src="<?php echo $baseUrl; ?>images/icon_pdf.gif" alt="View pdf" title="View pdf" height="16" border="0" /></a><?php } ?></li>
</ul>

<?php endwhile; ?>
<?php endif; ?>

Can a kind fellow offer any ideas? Thanks.

Was it helpful?

Solution

That's a documented "feature" of the_date()

http://codex.wordpress.org/Template_Tags/the_date:

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() with a date-specific format string.

OTHER TIPS

You may have found the answer by now but here is is: (works from version 3.0)

<?php echo get_the_date('', $post->ID);?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top