Advertisement
Guest User

WP Questions - 7930

a guest
Jan 25th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.86 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.     Template Name: Test
  5. */
  6.  
  7. get_header(); ?>
  8.  
  9.         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  10.        
  11.         <div id="main" role="main" class="clearfix">           
  12.             <?php if ( function_exists('yoast_breadcrumb') ) {
  13.                 yoast_breadcrumb('<p id="breadcrumbs">','</p>');
  14.             } ?>               
  15.            
  16.             <h1><?php the_field('team_name'); ?></h1>
  17.                
  18.             <div class="left-content">
  19.                 <?php if(has_post_thumbnail()) { ?>
  20.                 <div class="banner">
  21.                     <?php the_post_thumbnail('large'); ?>
  22.                 </div>
  23.                 <?php } ?>
  24.             </div>
  25.            
  26.             <div class="right-content">
  27.                 <h2>Practice Schedule</h2>
  28.                
  29.                 <?php the_field('practice_schedule'); ?>
  30.                
  31.                
  32.                 <!--! tournament section -->
  33.                 <section class="tournaments">
  34.                     <h2>Tournament Schedule</h2>
  35.                    
  36.  
  37.    
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. <?php
  45.  
  46. $tournaments = get_field( 'tournament_selection' );
  47.  
  48. if( $tournaments ) {
  49.  
  50.     $upcoming = '';
  51.     $finished = '';
  52.  
  53.     foreach( $tournaments as $tournament ) {
  54.  
  55.         $terms = wp_get_object_terms( $tournament, array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'slug') );
  56.  
  57.         if( in_array( 'upcoming-tournament', $terms ) ) {
  58.  
  59.             $upcoming .= 'Upcoming!'
  60.  
  61.         }
  62.  
  63.  
  64.         if( in_array( 'finished-tournament', $terms ) ) {
  65.  
  66.             $finished .= 'Finished!'
  67.         }
  68.     }
  69. ?>
  70.  
  71.  
  72.  
  73.     <h3>Upcoming Tournaments</h3>
  74.  
  75.     <?php echo $upcoming; ?>
  76.  
  77.  
  78.  
  79.     <h3>Finished Tournaments</h3>
  80.  
  81.     <?php echo $finished; ?>
  82.  
  83. <?php
  84.  
  85. }
  86.  
  87. ?>
  88.    
  89.    
  90.  
  91.  
  92.  
  93.  
  94.                
  95.                
  96.                
  97.                 </section>
  98.                
  99.                 <?php the_content(); ?>
  100.             </div>
  101.            
  102.             <hr />
  103.            
  104.                
  105.             <!--! player roster -->
  106.             <div class="left-content">
  107.                 <h2>Player Roster</h2>
  108.                
  109.                 <div class="player">
  110.                     <table>
  111.                         <thead>
  112.                             <tr>
  113.                                 <th class="player-name">Player's Name</th>
  114.                                 <th>#</th>
  115.                                 <th>Pos.</th>
  116.                                 <th>Height</th>
  117.                                 <th>Reach</th>
  118.                                 <th>Jump</th>
  119.                                 <th>Vertical</th>
  120.                                 <th>Grade</th>
  121.                             </tr>
  122.                         </thead>
  123.                        
  124.                         <?php $player_query = new WP_Query( 'post_type=players&category_name=13-1-elite&orderby=title&order=ASC' );
  125.                         while ( $player_query->have_posts() ) : $player_query->the_post(); ?>
  126.                
  127.                         <tr>
  128.                             <td class="player-name"><a href="<?php the_permalink(); ?>" title="Player's Bio"><?php the_title(); ?></a></td>
  129.                             <td><?php the_field("jersey_number"); ?></td>
  130.                             <td><?php the_field("position"); ?></td>
  131.                             <td><?php the_field("height_feet"); ?>'<?php the_field("height_inches"); ?>&quot;</td>
  132.                             <td><?php the_field("reach_feet"); ?>'<?php the_field("reach_inches"); ?>&quot;</td>
  133.                             <td><?php the_field("jump_touch_feet"); ?>'<?php the_field("jump_touch_inches"); ?>&quot;</td>
  134.                             <td><?php the_field("vertical"); ?>&quot;</td>
  135.                             <td><?php the_field("current_grade"); ?></td>
  136.                         </tr>
  137.                        
  138.                         <?php endwhile; wp_reset_postdata(); ?>            
  139.                     </table>
  140.                 </div>
  141.             </div>
  142.            
  143.                
  144.             <!--! coaches roster -->
  145.             <div class="right-content">
  146.                 <h2>Coaches</h2>
  147.            
  148.                 <p><strong>Head Coach(es):</strong>
  149.                 <br />
  150.                 <?php $posts = get_field('head_coach');
  151.                 if( $posts ): ?>
  152.                 <?php foreach( $posts as $post_object): ?>
  153.                     <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
  154.                 <?php endforeach; ?>
  155.                
  156.                 <?php else : ?>
  157.                     <p>There are not any head coaches for this team</p>
  158.                 <?php endif; ?></p>
  159.                
  160.                 <p><strong>Assistant Coach(es):</strong>
  161.                 <br />
  162.                 <?php $posts = get_field('assistant_coach');
  163.                 if( $posts ): ?>
  164.                 <?php foreach( $posts as $post_object): ?>
  165.                     <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
  166.                 <?php endforeach; ?>
  167.                
  168.                 <?php else : ?>
  169.                     <p>There are not any assistant coaches for this team</p>
  170.                 <?php endif; ?></p>
  171.             </div>
  172.            
  173.  
  174.        
  175.         <?php endwhile; endif; ?>
  176.  
  177. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement