Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( is_category() ) :
- $cat_id = get_query_var('cat');
- query_posts('posts_per_page=-1&cat='.$cat_id);
- if (have_posts()) :
- $posttags = array(); $the_tags = array();
- while (have_posts()) : the_post();
- $tags = get_the_tags($post->ID);
- if( $tags ){
- foreach( $tags as $tag ) {
- $posttags[] = $tag->term_id;
- };
- }
- endwhile;
- $slug = get_category($cat_id)->slug;
- $posttags = array_unique( $posttags );
- foreach( $posttags as $tag ) {
- $tag = get_tag($tag);
- $the_tags[] = '<a href ="' . get_bloginfo('wpurl') . '/?category_name=' . $slug . '&tag=' . $tag->slug . '">' . $tag->name . '</a>';
- }
- sort($the_tags); //sort optional
- if( $the_tags ) {
- echo '<ul><li>' . implode("</li>\n<li>", $the_tags) . '</li></ul>';
- }
- endif; wp_reset_query();
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement