Title: Last Articles
Last modified: August 19, 2016

---

# Last Articles

 *  Resolved [alexsmenaru](https://wordpress.org/support/users/alexsmenaru/)
 * (@alexsmenaru)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/last-articles/)
 * How i cand edit this code `<?php
    if (have_posts()): while (have_posts()): the_post();
   include(TEMPLATEPATH . ‘/post.php’); endwhile; ?>` I want to show just the lest
   5 articles!

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

 *  [Samuel B](https://wordpress.org/support/users/samboll/)
 * (@samboll)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/last-articles/#post-1376348)
 *     ```
       <?php query_posts('showposts=5'); ?>
       <?php while (have_posts()) : the_post(); ?>
       include(TEMPLATEPATH . '/post.php');
       <?php endwhile;?>
       ```
   
 * should work
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/last-articles/#post-1376351)
 * you could put this line before your code:
 *     ```
       <?php global $query_string;
       query_posts($query_string . '&posts_per_page=5'); ?>
       ```
   
 * [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
   
   [http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters](http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters)

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

The topic ‘Last Articles’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/last-articles/#post-1376351)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
