ri0ter
Member
Posted 8 months ago #
I am making query_posts to display three subpages on my homepage and problem is that it displays DATE only in first item.
<?php query_posts("posts_per_page=3&post_type=page&post_parent=27"); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="test">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<p class="date"><?php the_date('Y-m-d'); ?></p>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
chadrew
Member
Posted 8 months ago #
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.
http://codex.wordpress.org/Function_Reference/the_date