1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Show Last Post Excerpt On Any WordPress Page

So there is a little code that you can use to query the posts then show the last post on a page. in this particular code we are ordering by date and grabbing the last post that was made according to the date.

The following code will grab:

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂
  1. The Permalink
  2. The title
  3. The Excerpt
  4. The Featured image


<?php $the_query = new WP_Query( 'posts_per_page=1&order=DESC&orderby=date' ); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

<div class="entry">
 <a href="<?php echo get_post_permalink();?>">
<h3><?php the_title(); ?></h3>

 <?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); 
 echo '<img src="'.$feat_image.'"/>'; ?>
 <?php the_excerpt(); ?></a>

<?php endwhile; wp_reset_postdata(); ?>


Subscribe To My YouTube Channel:
Show Last Post Excerpt On Any WordPress Page was last modified: June 3rd, 2016 by Maximus Mccullough

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips


Cool People Share:
wordpress under attack

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.