Created
April 27, 2013 20:15
-
-
Save jonathanhudak/5474525 to your computer and use it in GitHub Desktop.
A snippet to list recent posts with their post thumbnail on the Single.php template, which excludes the current Single Post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="recent-post-list"> | |
<?php | |
$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> | |
</a> | |
<div class="clear"></div> | |
</div> | |
<?php endwhile; ?> | |
<?php wp_reset_query(); ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment