<?php
/*
Template Name: Team Page 
*/
?>
<?php get_header(); ?>

  <div id="container">
  
    <div id="content">
    
    
      <div id="team-page-content">

        <div id="team-page-title"> <?php  the_title(); ?></div>
      
        <div id="team-page-photo"><div id="team-page-photo-inner">
          <?php  the_post_thumbnail( 'full' ); ?>
        </div></div>
        
        <div id="team-page-members"><div id="team-page-members-inner">
        
        <?php $right_member = false; ?>

        <?php

        

        $loop_args = array( 'post_type' => 'team' );

        // Save original loop for later
        $original_post = $post;


        //$my_query = new WP_Query( $loop_args );

        $team_loop = get_posts( $loop_args );
      
        
         foreach( $team_loop as $post ) : setup_postdata($post);
       
        
          $custom = get_post_custom( $post->ID );
          $function = $custom['function'][0];
          $member_img = get_the_post_thumbnail( $post->ID );
        
        ?>
        
          <div class="team-page-member <?php if( $right_member ){ echo 'float-right'; }?>">
          
            <div class="team-page-member-img"><div class="team-page-member-img-inner">
              <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo $member_img; ?></a>  
            </div></div>
            
            <div class="team-page-member-text">
              <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h3><?php the_title(); ?> -  <span><?php echo $function; ?></span></h3></a>
              
              <p><?php the_content(""); ?></p>
            </div>
          
          </div>
          
          <?php if( !$right_member ){ $right_member = true; } else{ $right_member = false; } ?>
        
        <?php endforeach;

        
        $post = $original_post;
        wp_reset_postdata();
          
        ?>  
          
          
        
        </div></div> <!-- #team-page-members --><!-- #team-page-members-inner -->
      
      
        <div class="clear"></div>
        
      </div> <!-- #team-page-content -->
    
    
    </div><!-- #content -->
  
  </div><!-- #container -->


<?php get_footer(); ?>