Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2>Final test</h2>
- <?php
- $cat_id = $category->cat_ID;
- global $post;
- $category_posts = new WP_Query('cat=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();
- var_dump($tags);
- endwhile;
- foreach($all_tags as $key => $tag) {
- $term_id = get_term($key);
- $term = get_term($term_id, '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