Advertisement
darrenbachan

Untitled

Jun 7th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.70 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.                                 // $release_date = new DateTime($release_date); ->format('j M Y')
  52.  
  53.                                 $publisher = get_field( "publisher" );
  54.                                 $developer = get_field( "developer" );
  55.                                 $youtube_link = get_field( "youtube_link" );
  56.  
  57.                                 $label_release_date = get_field_object($release_date);
  58.  
  59.                                 $tags = get_the_tags();
  60.                                 $separator = ", ";
  61.                                 $output = '';
  62.                             ?>
  63.                            
  64.                             <div class="upcoming-games-meta">
  65.                                 <ul>
  66.                                     <?php if( !empty ($release_date) ) echo '<li>' . '<span>' . $label_release_date . ': ' . '</span>' . $release_date . '</li>'; ?>
  67.                                     <?php if( !empty ($publisher) ) echo '<li>' . $publisher . '</li>'; ?>
  68.                                     <?php if( !empty ($developer) ) echo '<li>' . $developer . '</li>'; ?>
  69.                                     <?php the_terms( $post->ID, 'genres', '', ', ' ); ?>
  70.                                     <?php if( !empty ($youtube_link) ) echo '<li>' . '<a href="'. $youtube_link .'" target="_blank">' . 'Watch Trailer' . '</a>' . '</li>'; ?>
  71.                                 </ul>
  72.                             </div>
  73.                         </div><!-- end upcoming game title -->
  74.                     <?php endwhile; ?>
  75.                 </article>
  76.             <?php else : ?>
  77.                 <p><?php _e( "No Upcoming Games? Well this isn't right...", 'wp-upcoming-games' ); ?></p>
  78.             <?php endif ?>
  79.     </div>
  80.  
  81. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement