<?php
/*
* Display posts order by the frequency a tag is used.
* Most used tags first with the posts in it.
* Found at http://www.devlounge.net/code/wordpress-snippet-display-posts-by-tag-frequency
*/
$noOfTags = 10;
$noOfPosts = 4;
$cloudRight = get_tags("orderby=count&order=DESC&number=$noOfTags");
foreach((array)$cloudRight as $tagRight) : ?>
<?php
$postsRight = new WP_Query();
$postsRight->query("tag={$tagRight->slug}&showposts=$noOfPosts");
?>
<?php if ( $postsRight->have_posts() )
>
<dl class="xoxo">
<dt><?php echo $tagRight->name ?></dt>
<?php while ( $postsRight->have_posts() ) : $postsRight->the_post(); ?>
<dd><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></dd>
<?php endwhile;?>
</dl>
<?php endif; ?>
<?php
unset($postsRight);
endforeach;
?>