Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- query_posts('category_name=work');
- if (have_posts()) : while (have_posts()) : the_post();
- $posttags = get_the_tags();
- if ($posttags) {
- foreach($posttags as $tag) {
- $all_tags_arr[] = $tag->term_id; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique
- }
- }
- endwhile; endif; wp_reset_query();
- $tags_arr = array_unique($all_tags_arr); //REMOVES DUPLICATES
- //echo '<pre>'.print_r($tags_arr, true).'</pre>'; //OUTPUT FINAL TAGS FROM CATEGORY
- echo '<ul>';
- foreach ($tags_arr as $tag) {
- echo '<li><a href="' . get_tag_link($tag) . '">' . get_tag($tag)->name . '</a></li>';
- }
- echo '</ul>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement