you will have to use timthumb its an opensource script to generate thumbnails.. http://c.hadcoleman.com/2008/06/adding-timthumb-to-your-wordpress-theme/ you can either use a custom image url field or you can set it up so that it takes up the first(or as u wish) uploaded image in your wordpress post to generate the thumbnails..
I'm comfortable with creating thumbnails and the custom fields, I've read up on that, I'm just not sure what code I need to add to the sidebar.php and where in the sidebar.php to add it so that I can achieve this effect.
in the side bar make <?php query_posts('showposts=5'); while (have_posts()) : the_post(); ?> // image with permalink <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo get_option('home'); ?>/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=<?php echo $width; ?>&h=<?php echo $height; ?>&zc=1&q=100" alt="<?php the_title(); ?>" class="left" width="<?php echo $width; ?>px" height="<?php echo $height; ?>px" /></a> <?php endwhile; ?> Code (markup): this is how it works if the custom field name is Image width and height are the parameters for generating the thumbnail which shud be assigned values as i said you can also user the first(or any image) in your blogpost to generate the thumbnail..
Here is the code you need. Edit category name and number of posts as you wish. <?php $my_query = new WP_Query('category_name=sidebarposts&showposts=5'); while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="featured_post" id="post-<?php the_ID(); ?>"> <img src="<?php echo get_post_meta($post->ID, 'Thumb', true) ?>" alt="" class="thumb" /> <h3 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> </h3> <?php the_excerpt() ?> </div> <?php endwhile; ?> PHP:
query_posts is not advices to be used for extra queries. Rather it is used to edit the main query loop. For extra queries you need to use WP_Query.
This code worked really well, Thanks. The code showed the last 5 posts in a specific category. Is there a way to show the last 5 most recent posts on the blog, regardless of what category they are in?
$my_query = new WP_Query('category_name=sidebarposts&showposts=5'); change this to $my_query = new WP_Query('showposts=5');