Guest User

Loop

a guest
Aug 13th, 2015
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2. $do_not_duplicate = array();
  3. //get all categories then display all posts in each term
  4. $taxonomy = 'category';
  5. $param_type = 'category__in';
  6. $term_args=array(
  7.  
  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.       'connected_type' => 'posts_to_invitations',
  15.       'connected_items' => get_queried_object(),
  16.       'nopaging' => true,
  17.       'post_type' => 'post',
  18.       'post_status' => 'publish,draft',
  19.       'posts_per_page' => -1,
  20.       'post__not_in'     => $do_not_duplicate,
  21.       'caller_get_posts'=> 1
  22.       );
  23.     $my_query = null;
  24.     $my_query = new WP_Query($args);
  25.     if( $my_query->have_posts() ) {
  26.     $do_not_duplicate[] = get_the_ID(); ?>
  27. <?php
  28.       while ($my_query->have_posts()) : $my_query->the_post(); ?>
  29.         <tr>
  30.                 <td><?php include (TEMPLATEPATH . '/contactfullname.php'); ?></td>
  31.                 <td><?php echo get_post_meta($post->ID, 'ecpt_position', true); ?></td>
  32.                 <td><?php echo p2p_get_meta( get_post()->p2p_id, 'table', true ); ?></td>
  33.                 <td><?php echo ' ' .$term->name;?></td>
  34.                 <td><?php echo p2p_get_meta( get_post()->p2p_id, 'confirmation', true ); ?></td>
  35.         </tr>
  36.        <?php
  37.       endwhile;
  38.       ?>
  39. <?php
  40.     }
  41.   }
  42. }
  43. wp_reset_query();  // Restore global post data stomped by the_post().
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment