Advertisement
Guest User

Untitled

a guest
Jan 12th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. //get all terms (e.g. categories or post tags), then display all posts in each term
  3. $taxonomy = 'post_tag';// e.g. post_tag, category
  4. $param_type = 'tag__in'; // e.g. tag__in, category__in
  5. $term_args=array(
  6. 'include' => '200',
  7. 'orderby' => 'count',
  8. 'order' => 'ASC'
  9. );
  10. $terms = get_terms($taxonomy,$term_args);
  11. if ($terms) {
  12. foreach( $terms as $term ) {
  13. $args=array(
  14. "$param_type" => array($term->term_id),
  15. 'post_type' => 'post',
  16. 'post_status' => 'publish',
  17. 'posts_per_page' => -1,
  18. 'caller_get_posts'=> 1
  19. );
  20. $my_query = null;
  21. $my_query = new WP_Query($args);
  22. if( $my_query->have_posts() ) {
  23. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  24. <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  25. <?php
  26. endwhile;
  27. }
  28. }
  29. }
  30. wp_reset_query(); // Restore global post data stomped by the_post().
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement