Wordpress: Category Specific Tag Cloud


/ Published in: PHP
Save to your folder(s)

Most of this code is by:
http://www.wprecipes.com/get-tags-specific-to-a-particular-category-on-your-wordpress-blog

I simply added the Tag Cloud


Copy this code and paste it in your HTML
  1. query_posts('category_name=scribbles');
  2. if (have_posts()) : while (have_posts()) : the_post();
  3. $posttags = get_the_tags();
  4. if ($posttags) {
  5. foreach($posttags as $tag) {
  6. $all_tags_arr[] = $tag -> term_id; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique
  7.  
  8. }
  9. }
  10. endwhile; endif;
  11.  
  12. $tags_arr = array_unique($all_tags_arr); //REMOVES DUPLICATES
  13. foreach($tags_arr as $tag) {
  14. $includeTags = $tag.',';
  15. }
  16. $args = array('include'=>$includeTags);
  17. wp_tag_cloud( $args );

URL: http://www.wprecipes.com/get-tags-specific-to-a-particular-category-on-your-wordpress-blog

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.