Wp plugin

How To Add Thumbnails To Recent Posts Without A Plugin

Some of you might be asking, “Why would you not want to use plugins?” Well, one of the reasons for that is because plugins sometimes can be a little temperamental over time as newer versions of WordPress are released, another one would be to avoid excessive use of plugins.

But the main purpose of this article is to show you how to add a thumbnail to your blog’s ‘Recent Posts’ without the use of any plugin. The following code is written by Jacob Stoops.

Below is the whole gist of it but you can get a full breakdown of the code at Jacob’s page, which includes his step-by-step instructions.

<div id="recent-posts">
<?php $postslist = get_posts('numberposts=10&order=DESC');
foreach ($postslist as $post) : setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>"><img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=300&h=275&zc=1&q=100" alt="<?php the_title(); ?>" width="40px" height="40px" /></a>
<p><a title="Post: <?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?> »</a></p>
<p><?php the_time('F j, Y') ?> : <?php comments_number('0 comments','1 comment','% comments'); ?></p>
<?php endforeach; ?>
 </div><!-- End Recent Posts -->

Incoming search terms for the article:

Related Posts

Simple Chat Plugin

EWWW Image Optimizer

Twitter Cards PHP 1.1

Create An Effective RSS Feed With mPress WordPress Plugin