Advertisement
Twansparant

Looping the loop in domtabs

Jan 22nd, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.02 KB | None | 0 0
  1. <div class="domtab cat-menu">
  2.     <ul class="domtabs">
  3.         <?php
  4.         // Projects
  5.         $c_projects = new WP_Query( array(
  6.             'connected_type' => 'event-project',
  7.             'connected_items' => get_queried_object_id(),
  8.             'posts_per_page' => -1,
  9.             'orderby' => '_order',
  10.             'order' => 'ASC'
  11.         ) );
  12.         // Artists
  13.         $c_artists = new WP_Query( array(
  14.             'connected_type' => 'event-artist',
  15.             'connected_items' => get_queried_object_id(),
  16.             'posts_per_page' => -1,
  17.             'orderby' => '_order',
  18.             'order' => 'ASC'
  19.         ) );
  20.         // Merge connected projects & artists and split them into event-time
  21.         $c_artists_projects = array_merge($c_projects->posts, $c_artists->posts);
  22.         $buckets = p2p_split_posts($c_artists_projects, 'event-time' );
  23.         foreach ( $GLOBALS['event-time'] as $type ) {
  24.             if (!isset( $buckets[$type]) )
  25.                 continue;                      
  26.             $bucket = $buckets[$type];
  27.             echo '<li><a href="#'.$type.'">'.$type.'</a></li>';
  28.         } ?>
  29.     </ul>
  30.  
  31.     <?php foreach ($buckets as $type => $bucket) { ?>
  32.         <div class="tab"><a name="<?php echo $type; ?>" id="<?php echo $type; ?>"></a>
  33.             <?php foreach ($bucket as $post) {?>                       
  34.                 <div class="post-block">
  35.                     <h3><a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title(); ?></a></h3>
  36.                     <?php if (get_post_type() == 'project') {
  37.                         $p_artists = new WP_Query( array(
  38.                             'connected_type' => 'artist-project',
  39.                             'connected_items' => $post,
  40.                             'posts_per_page' => -1,
  41.                                 'orderby' => 'title',
  42.                             'order' => 'ASC'
  43.                         ) );
  44.                         if ($p_artists->have_posts() ) :
  45.                             while ($p_artists->have_posts() ) : $p_artists->the_post(); ?>
  46.                                 <h4><a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title(); ?></a></h4>
  47.                             <?php endwhile;
  48.                             wp_reset_postdata();
  49.                         endif; ?>
  50.                     <?php } ?>
  51.                     <div class="taxonomies">
  52.                         <?php echo get_post_meta($post->ID, 'artistdesc', true); ?>
  53.                     </div>
  54.                 </div>
  55.             <?php } ?>
  56.         </div> 
  57.     <?php }
  58.     wp_reset_postdata();
  59.     wp_reset_query();
  60.     $buckets = null; ?>
  61. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement