Advertisement
darrenbachan

Untitled

Jun 7th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.02 KB | None | 0 0
  1. <?php
  2.  
  3. $today = date('Ymd');
  4.  
  5. $args = array(
  6.         'post_type'                 => 'upcoming-games',
  7.         // 'orderby'                    => 'menu_order',
  8.         'order'                     => 'ASC',
  9.         // 'no_found_rows'              => true,
  10.         //'update_post_term_cache'  => false, // no taxonomy data
  11.         'post_per_page'             => 9,
  12.         // 'meta_query' => array(
  13.         //  array(
  14.         //         'key'        => 'end_date',
  15.         //         'compare'    => '>=',
  16.         //         'value'      => $today,
  17.         //     ),
  18.         //      array(
  19.         //         'key'        => 'start_date',
  20.         //         'compare'    => '<=',
  21.         //         'value'      => $today,
  22.         //     ))
  23.     );
  24.  
  25.     $upcoming_games = new WP_Query( $args );
  26.  
  27.     ?>
  28.    
  29.     <div id="upcoming-games-sort" class="wrap">
  30.         <div id="icon-upcoming-games-admin" class="icon32"></div>
  31.             <div class="page-header">
  32.                 <h3><?php _e('Upcoming Games', 'wp-upcoming-games'); ?></h3>
  33.             </div>
  34.            
  35.             <?php if ( $upcoming_games->have_posts() ) : ?>
  36.                 <p><?php _e( "Here's a list of some upcoming games coming out that we may play.", 'wp-upcoming-games' ); ?></p>
  37.                 <article id="upcoming-games-list">
  38.                     <?php while ( $upcoming_games->have_posts() ) : $upcoming_games->the_post(); ?>
  39.                        
  40.                         <div id="<?php the_id(); ?>" class="col-md-4">
  41.                             <?php if(has_post_thumbnail()) : ?>
  42.                                 <div class="post-img">
  43.                                         <?php the_post_thumbnail(); ?>
  44.                                 </div>
  45.                             <?php endif; ?>
  46.  
  47.                             <h4><?php the_title(); ?></h4>
  48.  
  49.                             <?php
  50.                                 $release_date = get_field( "release_date");
  51.  
  52.                                 $publisher = get_field( "publisher" );
  53.                                 $developer = get_field( "developer" );
  54.                                 $youtube_link = get_field( "youtube_link" );
  55.  
  56.                                 $label_release_date = get_field_object($release_date);
  57.                             ?>
  58.                            
  59.                             <div class="upcoming-games-meta">
  60.                                 <ul>
  61.                                     <?php if( !empty ($release_date) ) echo '<li>' . '<span>' . 'Release Date' . ': ' . '</span>' . $release_date . '</li>'; ?>
  62.                                     <?php if( !empty ($publisher) ) echo '<li>' , '<span>', 'Publisher: ' , the_field('publisher') , '</span>' , '</li>'; ?>
  63.                                     <?php if( !empty ($developer) ) echo '<li>' , the_field("developer") , '</li>'; ?>
  64.                                     <?php
  65.                                     $genres = wp_get_object_terms( $post->ID,  'genres' );
  66.                                     $separator = ", ";
  67.                                     $output = '';
  68.  
  69.                                     if ( ! empty( $genres ) ) {
  70.                                         if ( ! is_wp_error( $genres ) ) {
  71.                                             echo '<li><span>Genre:</span> ';
  72.                                                 foreach( $genres as $term ) {
  73.                                                     $output .= esc_html( $term->name ) . $separator;
  74.                                                 } echo trim($output, $separator);
  75.                                             echo '</li>';
  76.                                         }
  77.                                     }
  78.                                      ?>
  79.                                     <?php if( !empty ($youtube_link) ) echo '<li>' . '<a href="'. $youtube_link .'" target="_blank">' . 'Watch Trailer' . '</a>' . '</li>'; ?>
  80.                                 </ul>
  81.                             </div>
  82.                         </div><!-- end upcoming game title -->
  83.                     <?php endwhile; ?>
  84.                 </article>
  85.             <?php else : ?>
  86.                 <p><?php _e( "No Upcoming Games? Well this isn't right...", 'wp-upcoming-games' ); ?></p>
  87.             <?php endif ?>
  88.     </div>
  89.  
  90. <!-- ?> -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement