Index: .
===================================================================
--- .	(revision 749)
+++ .	(working copy)

Property changes on: .
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+upgrade
Index: plugins/wc-post-types/wc-post-types.php
===================================================================
--- plugins/wc-post-types/wc-post-types.php	(revision 749)
+++ plugins/wc-post-types/wc-post-types.php	(working copy)
@@ -256,19 +256,64 @@
 			'posts_per_page' => -1,
 			'orderby' => 'date',
 			'order' => 'desc',
+			'track' => 'all',
 		), $attr );
 
 		$attr['show_avatars'] = $this->str_to_bool( $attr['show_avatars'] );
 		$attr['orderby'] = ( in_array( $attr['orderby'], array( 'date', 'title', 'rand' ) ) ) ? $attr['orderby'] : 'date';
 		$attr['order'] = ( in_array( $attr['order'], array( 'asc', 'desc') ) ) ? $attr['order'] : 'desc';
 
-		$speakers = new WP_Query( array(
-			'post_type' => 'wcb_speaker',
-			'posts_per_page' => intval( $attr['posts_per_page'] ),
-			'orderby' => $attr['orderby'],
-			'order' => $attr['order'],
-		) );
+		// Get track slugs and set transient key
+		$track_slugs = $attr['track'];
+		$transient_key = 'speaker_ids_' . md5( $track_slugs );
 
+		// Get saved speaker IDs if transient exists
+		$speaker_ids = get_transient( $transient_key );
+
+		if( ! $speaker_ids ) {
+
+			// Fetch all sessions
+			$session_args = array(
+		        'post_type'   => 'wcb_session',
+		        'posts_per_page' => -1,
+			);
+
+			// Filter by track if specified
+			if( 'all' != $track_slugs ) {
+				$session_args['tax_query'] = array(
+	                array(
+	                    'taxonomy' => 'wcb_track',
+	                    'field'    => 'slug',
+	                    'terms'    => explode( ',', $track_slugs ),
+	                ),
+		        );
+			}
+
+			// Get all relevant sessions
+			$sessions = get_posts( $session_args );
+
+			// Get array of relevant speaker IDs
+			$speaker_ids = array();
+			foreach ( $sessions as $session ) {
+		        $session_speaker_ids = get_post_meta( $session->ID, '_wcpt_speaker_id' );
+		        $speaker_ids = array_merge( $speaker_ids, $session_speaker_ids );
+			}
+
+			// Set transient with speaker IDs to prevent long page load times
+			set_transient( $transient_key, $speaker_ids, HOUR_IN_SECONDS );
+		}
+
+		// Fetch all specified speakers
+		$speaker_args = array(
+		        'post_type' => 'wcb_speaker',
+		        'posts_per_page' => intval( $attr['posts_per_page'] ),
+		        'post__in' => $speaker_ids,
+		        'orderby' => $attr['orderby'],
+				'order' => $attr['order'],
+		);
+
+		$speakers = new WP_Query( $speaker_args );
+
 		if ( ! $speakers->have_posts() )
 			return '';
 
@@ -279,13 +324,22 @@
 
 			<?php while ( $speakers->have_posts() ) : $speakers->the_post(); ?>
 
-				<div id="wcorg-speaker-<?php echo sanitize_html_class( $post->post_name ); ?>" class="wcorg-speaker">
+				<?php
+				// Get list of speaker tracks for div class
+				$tracks = get_post_meta( get_the_ID(), '_wcpt_speaker_tracks', false );
+				$track_class = '';
+				foreach( $tracks as $track ) {
+					$track_class .= ' ' . sanitize_html_class( $track );
+				}
+				?>
+
+				<div id="wcorg-speaker-<?php echo sanitize_html_class( $post->post_name ); ?>" class="wcorg-speaker<?php echo $track_class; ?>">
 					<h2><?php the_title(); ?></h2>
 					<div class="wcorg-speaker-description">
 						<?php echo ( $attr['show_avatars'] ) ? get_avatar( get_post_meta( get_the_ID(), '_wcb_speaker_email', true ), absint( $attr['avatar_size'] ) ) : ''; ?>
 						<?php the_content(); ?>
 					</div>
-				</div>
+				</div><!-- .wcorg-speaker -->
 
 			<?php endwhile; ?>
 
@@ -293,8 +347,8 @@
 		<?php
 
 		wp_reset_postdata();
-		$content = ob_get_contents();
-		ob_end_clean();
+
+		$content = ob_get_clean();
 		return $content;
 	}
 
Index: themes
===================================================================
--- themes	(revision 749)
+++ themes	(working copy)

Property changes on: themes
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+twentytwelve
