Title: Need help with lastposts, please
Last modified: August 19, 2016

---

# Need help with lastposts, please

 *  [george](https://wordpress.org/support/users/george/)
 * (@george)
 * [18 years ago](https://wordpress.org/support/topic/need-help-with-lastposts-please/)
 * Hi everybody,
 * previous versions I was using the following code to retreive last post on my 
   index page, and now it shows not the latest post, but first.
 *     ```
       <?php
       require('./private/wp-blog-header.php');
       ?>
       <?php get_header(); ?>
       <div id="content">
   
       <?php $lastposts = get_posts('numberposts=1');
       	foreach($lastposts as $post) :
        	setup_postdata($post); ?>
   
       	<h1 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
       	<?php the_excerpt(); ?>
       	<p class="postmeta"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read the complete article</a> | <a href="<?php bloginfo('url'); ?>/index.php" rel="bookmark" title="Go to blog">Go to Blog</a> <?php edit_post_link('#',' | ',''); ?></p>
       <?php endforeach; ?>
       ```
   
 * need help with this issue, please

The topic ‘Need help with lastposts, please’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [george](https://wordpress.org/support/users/george/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/need-help-with-lastposts-please/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
