Display wordpress posts using get_posts – first post shows no date

Hi am using get_posts to grab all posts tagged as ‘news’ and display them on a given page. I am using the_date() to get the date but what is weird is that the first post shows no date, whereas all posts after this display the date fine. Also I have used this identical code to show posts tagged as ‘blogs’ on another page, yet they work fine.

Here is the page:
http://appshare.nsdesign7.net/news/

Read More

Also here is the other page the same code is used on but works fine:
http://appshare.nsdesign7.net/blog/

<? $pageTitle = wp_title('',false,'');
if ($pageTitle == "  News") { ?>


 <?php $appsharenewspage = array( 'numberposts' => 10, 'order'=> 'ASC', 'orderby'=>     'title', 'category' => 3 ); 
 $postslist = get_posts( $appsharenewspage ); foreach ($postslist as $post) :     setup_postdata($post); ?> 
     <article class="newsstyle">
        <span class="imagestyle"><?php the_post_thumbnail(array(120,120)); ?>    </span>
        <h3><?php the_title(); ?></h3>
        <span class="date"><?php the_date(); ?></span>
       <?php the_excerpt(); ?>
           <div class="clear"></div>
    </article>
<?php endforeach; ?>

  <?php } ?>

Related posts

Leave a Reply

4 comments

  1. the_date() is restricted to only show the date once per day. So if you have more then one post from the same day, it will only show on one of those posts.

    Use the_time instead.

  2. The date only occurs once per day. ie for 2 posts on the same day one will be without the date. It is a WP function. To get what you want replace with the php function get time. try to use the_time() instead of the_date()