I'd like to use a specific-tag related-post function like the below, but would like to use it in the sidebar. I have no idea how to do that . Would really appreciate your thoughts. I tried clumsily to add it to footer.php, but I don't think that's the right way to do it (and nothing seemed to happen). I looked at the widget tabs in Atahualpa options, but didn't quite understand how all that works. Basically, I'd like to add the following functionality to the right sidebar.
Code:
<?php $tags = wp_get_post_tags($post->ID); if ($tags) { $first_tag = $tags[0]->term_id; $args=array( 'tag__in' => array($first_tag), 'post__not_in' => array($post->ID), 'showposts'=>5, 'caller_get_posts'=>1 ); $rel_posts = new WP_Query($args); if( $rel_posts->have_posts() ) { while ($rel_posts->have_posts()) : $rel_posts->the_post(); ?> <div class="rel_posts"> <div class="rel_thumb"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(130,130)); ?></a></div> <div class="rel_link"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></div> </div> <?php endwhile; } } ?> <div class="clearer"></div>