Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A snippet to list recent posts with their post thumbnail on the Single.php template, which excludes the current Single Post.
<div class="recent-post-list">
$the_query = new WP_Query(array('showposts' => 5, 'orderby' => 'post_date', 'order' => 'desc', 'offset' => 1, 'post__not_in' => array( $post->ID )));
while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="recent-post">
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark">
<?php the_post_thumbnail(array(50,50, true), array ('')); ?>
<h3><?php the_title(); ?></h3>
<div class="clear"></div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment