Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $meta_query = array(
- array(
- 'key' => 'date_de_representation_debut',
- 'value' => date('d/m/Y'),
- 'type' => 'DATE',
- 'compare' => '>=',
- ),
- array(
- 'key' => 'statut',
- 'value' => 'on',
- 'compare' => 'LIKE',
- ),
- );
- $args = array(
- 'post_type' => 'spectacle',
- 'orderby' => 'meta_value_num',
- 'order' => 'ASC',
- 'posts_per_page' => '3',
- 'meta_query' => $meta_query
- );
- $loop = new WP_Query( $args );
- if( $loop->have_posts()): while( $loop->have_posts() ): $loop->the_post(); ?>
- <?php // var_dump( date('d/m/Y') < get_field('date_de_representation_fin')); ?>
- <!-- article -->
- <article id="post-<?php the_ID(); ?>" class="row-fluid clearfix">
- <!-- post details -->
- <span class="date">
- <?php
- is_null( the_field('date_de_representation_unique') ) ? 'Du ' . the_field('date_de_representation_debut') . ' au ' . the_field('date_de_representation_fin') : the_field('date_de_representation_unique') . '<span class="badge badge-light">Date unique</span>';
- ?>
- </span><br>
- <!-- /post details -->
- <!-- post thumbnail -->
- <div class="col-md-2 post-thumbnail">
- <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
- <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <?php the_post_thumbnail(array(120,120)); // Declare pixel size you need inside the array ?>
- </a>
- <?php else: ?>
- Agenda
- <?php endif; ?>
- </div>
- <!-- /post thumbnail -->
- <!-- post title -->
- <div class="col-md-6">
- <h2>
- <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
- </h2>
- <a href="<?php the_permalink(); ?>" class="more-link">En savoir +</a>
- </div>
- <!-- /post title -->
- </article>
- <!-- /article -->
- <?php endwhile; ?>
- <?php else: ?>
- <!-- article -->
- <article>
- <h2><?php _e( 'Désolé, rien à afficher.', 'html5blank' ); ?></h2>
- </article>
- <!-- /article -->
- <?php endif; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement