Title: Display most recent entry
Last modified: August 19, 2016

---

# Display most recent entry

 *  [ae6dx](https://wordpress.org/support/users/ae6dx/)
 * (@ae6dx)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/)
 * I’m moving from Movabletype. I have a page that displays just the title, body
   and date of my most recent entry. I have then used this page as a php include
   on my main website so it updates every time I publish a new entry. How do I do
   this in WordPress?

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/#post-1367913)
 * You can the Recent Posts widget and specifiy one post to be displayed if you 
   are talking about your sidebar(s):
 * Buth, this code will also display the most recent post:
 *     ```
       <?php
       $args=array(
         'post_type' => 'post',
         'post_status' => 'publish',
         'posts_per_page' => 1,
         'caller_get_posts'=> 1
       );
       $my_query = null;
       $my_query = new WP_Query($args);
       if( $my_query->have_posts() ) {
         echo 'Most recent post';
         while ($my_query->have_posts()) : $my_query->the_post(); ?>
           <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
           the_content('Read the rest of this entry &raquo;');
         endwhile;
       }
       wp_reset_query();  // Restore global post data stomped by the_post().
       ?>
       ```
   
 *  [owzzz](https://wordpress.org/support/users/owzzz/)
 * (@owzzz)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/#post-1368017)
 * Will the above solution work if I want to pull the latest posts to a static home
   page I have set up?
 * I want to display 3 posts from my index.php to my new static home page
    front_page.
   php.. how would I do this?
 * Any help would be great.
 *  Thread Starter [ae6dx](https://wordpress.org/support/users/ae6dx/)
 * (@ae6dx)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/#post-1368189)
 * MichaelH I tried this and when I view the page I get:
 * Fatal error: Class ‘WP_Query’ not found in /home/craigbos/public_html/wordpress/
   wp-content/themes/the-lord-of-the-rings/recent-page.php on line 9
 *  Thread Starter [ae6dx](https://wordpress.org/support/users/ae6dx/)
 * (@ae6dx)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/#post-1368190)
 * Where do I save the file with this code in it?
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/#post-1368224)
 * You would create a [Page Template](http://codex.wordpress.org/Pages#Page_Templates)
   and put the code in there. Remember after creating the Page Template to assign
   it to a page.
 * Related:
    [Why is there no Page Template option when writing or editing a Page?](http://codex.wordpress.org/FAQ_Working_with_WordPress#Why_is_there_no_Page_Template_option_when_writing_or_editing_a_Page.3F)

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

The topic ‘Display most recent entry’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/display-most-recent-entry/#post-1368224)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
