// Related posts. Based on http://www.bin-co.com/blog/2009/04/show-related-post-in-wordpress-without-a-plugin/
$tags = wp_get_post_tags($post->ID);
if($tags):
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array('tag__in'=>$tag_ids,'post__not_in'=>array($post->ID),'showposts'=>10,'caller_get_posts'=>1);
$backup = $post;
$rp_query = new wp_query($args);
$post = $backup;
wp_reset_query();
endif;
endif;
endif;
?>
<!-- tabbed content -->
<div class="tabbed-content post-tabs clear-block" id="post-tabs">
<?php if(($jquery) && (($comments || comments_open()) || (pings_open() && $numPingBacks>0))): // no tabs if jquery is disabled ?>
<!-- tab navigation (items must be in reverse order because of the tab-design) -->
<div class="tabs-wrap clear-block">
<ul class="tabs">
<?php if(($rp_query) && ($rp_query->have_posts())): ?><li class="related-posts"><a href="#section-relatedPosts"><span><?php _e('Related Posts','mystique'); ?></span></a></li><?php endif; ?>
<?php if($numPingBacks>0): ?><li class="trackbacks"><a href="#section-trackbacks"><span><?php printf(__('Trackbacks (%s)','mystique'),$numPingBacks); ?></span></a></li><?php endif; ?>
<?php if($comments || comments_open()): ?><li class="comments"><a href="#section-comments"><span><?php printf(__('Comments (%s)','mystique'),$numComments); ?></span></a></li><?php endif; ?>
</ul>
</div>
<!-- /tab nav -->
<?php elseif(!$jquery && (($comments || comments_open()))): ?>
<div class="clear-block">
<h2 class="alignright"><?php printf(__('Comments (%s)','mystique'),$numComments); ?></h2>
</div>
<?php endif; ?>