There are many ways to show thumbnail gallery in sidebar in WordPress. You can use NextGen plugin or various other plugins.
Following is a very simple and straight forward code to show thumbnail gallery in sidebar.
[sourcecode language=”php”]<?php query_posts(array(‘orderby’ => ‘rand’, ‘cat’ => 391, ‘showposts’ => 12));
if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(71,71), array( "class" => "home_thumb", ‘alt’ => ”.get_the_title().”) );} ?>
</a>
<?php endwhile; ?>
<?php endif; ?>
[/sourcecode]
Above code is pretty straight forward. It shows random thumbnails. you can adjust the width and height as per your requirements and also the number of thmbnails to show.
You can see it live on Bollywood blog in right sidebar at the bottom.
Leave a Reply