the_date is empty in a loop
-
At Weblog Tools Collection they explained about using WP_Query:
https://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/So I tried it out. I installed WordPress 2.5 and created 4 test posts.
Then I create a page template (news.php) and then created a page news which uses the template “news” (news.php).In the resulting page it only shows the date in the first post. In the other posts the date is empty. I don’t understand why.
The code I’ve used is this:
<h3>Recent Articles</h3> <?php $recentPosts = new WP_Query(); $recentPosts->query('showposts=5'); ?> <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php the_date('F jS, Y', '<strong>', '</strong>'); ?><br /> <?php the_content(); ?><br /><br /> <?php endwhile; ?>
I even changed the_date as described in this post at the bottom:
https://www.ads-software.com/support/topic/136773?replies=5
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘the_date is empty in a loop’ is closed to new replies.