do { Engine.BlogAbout(".NET","Silverlight"); } while ( alive );  

Mark Monster

Mark Monster  

The TagCloud in practice

Yes it took me some time to get the TagCloud I created in Silverlight to work with WordPress. It’s very easy It isn’t that it’s difficult to set up the tagcloud but the documentation of WordPress isn’t very clear in my opinion. I found out I needed the functions get_terms and get_tag_link and the properties of a term. I used a small section of php code to assemble xml that I needed for the TagCloud.

<?php $posttags = get_terms('post_tag', $args); $outputTags = "<tags>"; if ($posttags) { foreach($posttags as $tag) { $outputTags .= "<tag count='"; $outputTags .= $tag->count; $outputTags .= "' tag='"; $outputTags .= $tag->name; $outputTags .= "' link='"; $outputTags .= get_tag_link($tag->term_id); $outputTags .= "' />"; } } $outputTags .="</tags>"; ?>

This would essential output xml like:

<tags> <tag count='46' tag='.NET' link='http://mark.mymonster.nl/tag/net/' /> <tag count='3' tag='Astoria' link='http://mark.mymonster.nl/tag/astoria/' /> <tag count='8' tag='Blogging' link='http://mark.mymonster.nl/tag/blogging/' /> </tags>

This resulted in the Cloud page, click on a tag to see all posts belonging to the tag. I probably move along with this and write a Wordpress Widget to also replace the TagCloud in the sidebar with a Silverlight one.

Leave a Reply