Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $today = date('F j, Y');
- $args = array(
- 'post_type' => 'upcoming-games',
- // 'orderby' => 'menu_order',
- 'order' => 'ASC',
- // 'no_found_rows' => true,
- //'update_post_term_cache' => false, // no taxonomy data
- 'posts_per_page' => 4,
- // 'meta_query' => array(
- // array(
- // 'key' => 'end_date',
- // 'compare' => '>=',
- // 'value' => $today,
- // ),
- // array(
- // 'key' => 'start_date',
- // 'compare' => '<=',
- // 'value' => $today,
- // ))
- );
- $upcoming_games = new WP_Query( $args );
- ?>
- <div class="col-md-12">
- <div class="page-header">
- <h3><?php _e('Upcoming Games', 'wp-upcoming-games'); ?></h3>
- </div>
- </div>
- <?php if ( $upcoming_games->have_posts() ) : ?>
- <div class="col-md-12">
- <p><?php _e( "Check out some of the games that are coming out soon!", 'wp-upcoming-games' ); ?></p>
- </div>
- <article id="upcoming-games-list">
- <?php while ( $upcoming_games->have_posts() ) : $upcoming_games->the_post(); ?>
- <div id="<?php the_id(); ?>" class="col-xs-12 col-sm-4 col-md-3 upcoming-game">
- <?php if(has_post_thumbnail()) : ?>
- <div class="post-img">
- <?php the_post_thumbnail(); ?>
- </div>
- <?php endif; ?>
- <?php
- $release_date = get_field( "release_date");
- $publisher = get_field( "publisher" );
- $developer = get_field( "developer" );
- $youtube_link = get_field( "youtube_link" );
- $label_release_date = get_field_object($release_date);
- ?>
- <div class="upcoming-games-meta">
- <div class="meta-game-title">
- <h4><?php the_title(); ?></h4>
- </div>
- <ul>
- <?php if( !empty ($release_date) ) echo '<li>' . '<span>' . 'Release Date' . ': ' . '</span>' . $release_date . '</li>'; ?>
- <?php if( !empty ($publisher) ) echo '<li>' , '<span>', 'Publisher: ' , '</span>' , the_field('publisher') , '</li>'; ?>
- <?php if( !empty ($developer) ) echo '<li>' , '<span>', 'Developer: ' , '</span>' , the_field("developer") , '</li>'; ?>
- <?php
- $genres = wp_get_object_terms( $post->ID, 'genres' );
- $separator = ", ";
- $output = '';
- if ( ! empty( $genres ) ) {
- if ( ! is_wp_error( $genres ) ) {
- echo '<li><span>Genre:</span> ';
- foreach( $genres as $term ) {
- $output .= esc_html( $term->name ) . $separator;
- } echo trim($output, $separator);
- echo '</li>';
- }
- }
- ?>
- <?php
- $consoles = wp_get_object_terms( $post->ID, 'consoles' );
- $separator = ", ";
- $output = '';
- if ( ! empty( $consoles ) ) {
- if ( ! is_wp_error( $consoles ) ) {
- echo '<li><span>Platforms:</span> ';
- foreach( $consoles as $term ) {
- $output .= esc_html( $term->name ) . $separator;
- } echo trim($output, $separator);
- echo '</li>';
- }
- }
- ?>
- </ul>
- <?php if( !empty ($youtube_link) ) echo '<div class="meta-trailer">' . '<a class="btn btn-secondary btn-md" href="'. $youtube_link .'" target="_blank">' . 'Watch Trailer' . '</a>' . '</div>'; ?>
- </div><!--end upcoming games meta text-->
- </div><!-- end upcoming game -->
- <?php endwhile; ?>
- </article><!-- end upcoming games -->
- <?php else : ?>
- <div class="col-md-12">
- <p><?php _e( "No Upcoming Games? Well this isn't right...", 'wp-upcoming-games' ); ?></p>
- </div>
- <?php endif ?>
- <!-- ?> -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement