Advertisement
Guest User

Untitled

a guest
May 14th, 2012
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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 = 'category';// e.g. post_tag, category
  4. $param_type = 'category__in'; // e.g. tag__in, category__in
  5. $term_args=array(
  6. 'orderby' => 'name',
  7. 'order' => 'ASC'
  8. );
  9. $terms = get_terms($taxonomy,$term_args);
  10. if ($terms) {
  11. foreach( $terms as $term ) {
  12. $args=array(
  13. "$param_type" => array($term->term_id),
  14. 'post_type' => 'post',
  15. 'post_status' => 'publish',
  16. 'posts_per_page' => -1,
  17. 'caller_get_posts'=> 1
  18. );
  19. $my_query = null;
  20. $my_query = new WP_Query($args);
  21. if( $my_query->have_posts() ) {
  22. echo 'List of Posts in '.$taxonomy .' '.$term->name;
  23. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  24. <?php $author = get_the_author();?>
  25. <p><?php echo $author;?></p>
  26. <?php
  27. endwhile;
  28. }
  29. }
  30. }
  31. wp_reset_query(); // Restore global post data stomped by the_post().
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement