Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

get all tags of a category

By: alchymyth on Jun 17th, 2011  |  syntax: PHP  |  size: 0.51 KB  |  views: 132  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. $cat_id = get_query_var('cat');
  3. query_posts('posts_per_page=-1&cat='.$cat_id);
  4.  if (have_posts()) :
  5.  $posttags = array();
  6.  while (have_posts()) : the_post();
  7.    if( get_the_tag_list() ){
  8.    $posttags = array_merge( $posttags, explode('||', get_the_tag_list('','||','')));
  9.    }
  10.  endwhile;
  11.  $posttags = array_unique( $posttags );
  12.  sort($posttags); //sort optional
  13.    if( $posttags ) {
  14.    echo '<ul><li>';
  15.    echo implode("</li>\n<li>", $posttags);
  16.    echo '</li></ul>';
  17.    }
  18.  endif; wp_reset_query();
  19. ?>