Title: get_posts problem
Last modified: August 18, 2016

---

# get_posts problem

 *  Resolved [aapljack](https://wordpress.org/support/users/aapljack/)
 * (@aapljack)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/get_posts-problem/)
 * I am using get_posts in my footer to get the last five posts. The problem is 
   it is only showing my dates for the first one. Here is the code..
 * `<?php
    if(is_home()) { $archive_posts = get_posts('numberposts=5&offset=1');}
   else { $archive_posts = get_posts('numberposts=5'); } foreach($archive_posts 
   as $post) : //setup_postdata($post); ?> <dt><a href="<?php the_permalink(); ?
   >"><?php the_title(); ?></a></dt> <dd><? the_date(); ?></dd> <?php endforeach;?
   >
 * Here is the page..
 * [http://redplaidshirt.com/?p=13](http://redplaidshirt.com/?p=13)
 * You will notice that the setup_postdata is commented out. The reason for this
   is, when I use that, it resets the post number to the last post displayed in 
   the list and directs my comments to post to that last post in the list instead
   of the current post displayed.
 * The footer list works on the homepage because I am using the setup_postdata, 
   since there is no comments to mess up.
 * Can anyone tell me why only the first date is displayed?
 * Thanks!
 * Brian

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/get_posts-problem/#post-444540)
 * You really should read the documentation:
 * [http://codex.wordpress.org/Template_Tags/the_date](http://codex.wordpress.org/Template_Tags/the_date)
 * Especially the text in the grey box on that page. 😉
 *  [rideforver](https://wordpress.org/support/users/rideforver/)
 * (@rideforver)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/get_posts-problem/#post-444543)
 * HI Brian,
 * I use the same code to display the _latest_ posts at the bottom of each of my
   posts and not the _last_ five. This is why that dispite having an offset=1 after
   5 posts you will not see “archives.”
 * Instead you’ll have to use a variable to replace offset with that calculates 
   the relevant offset to use for your future posts. This is a problem I am also
   facing and am looking into it today. Suggestions to fasttrack appreciated.
 * As for you date issue… I use <?php the_time(‘F jS, Y’)?> which displays in the
   format October 3rd, 2005 without a problem. RF
 *  Thread Starter [aapljack](https://wordpress.org/support/users/aapljack/)
 * (@aapljack)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/get_posts-problem/#post-444605)
 * Thanks! I didn’t realize that about the_date. Works perfect now!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get_posts problem’ is closed to new replies.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [aapljack](https://wordpress.org/support/users/aapljack/)
 * Last activity: [19 years, 7 months ago](https://wordpress.org/support/topic/get_posts-problem/#post-444605)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
