Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cats = get_the_category();
- $cat_id = $cat_id[0];
- $category_posts = new WP_Query('cat=' . $cat_id->cat_ID);
- $all_tags = array();
- while ( $category_posts->have_posts() ) : $category_posts->the_post();
- $tags = wp_get_post_terms(get_the_ID(), 'post_tag');
- foreach($tags as $tag)
- $all_tags[$tag->term_id][] = get_the_ID();
- endwhile;
- foreach($all_tags as $key => $tag) {
- $term = get_term($key, 'post_tag');
- echo $term->name . '<BR>';
- foreach($tag as $post_id) {
- echo '<a href="' . get_permalink($post_id) . '">'. get_the_title($post_id) . "</a><BR>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement