order && filter next event

This commit is contained in:
Kevin Tessier 2020-09-07 17:45:01 +02:00
parent 65dc8922eb
commit d998b4b3cc

View File

@ -2,6 +2,7 @@
/** /**
* template name: Accueil * template name: Accueil
*/ */
use Timber\Post; use Timber\Post;
use Timber\Timber; use Timber\Timber;
@ -9,8 +10,6 @@ $context = Timber::get_context();
$post = new Post(); $post = new Post();
$context['post'] = $post; $context['post'] = $post;
$args = 'post_type=post&numberposts=3&orderby=date';
$projet = array( $projet = array(
'post_type' => 'les-projets', 'post_type' => 'les-projets',
'post_status'=>'publish', 'post_status'=>'publish',
@ -23,6 +22,22 @@ $tpsF = array(
'numberposts' => 3 'numberposts' => 3
); );
$today = date('Y-m-d H:i:s');
$args = array (
'post_type' => 'post',
'orderby' => 'informations_debut_event',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'informations_debut_event',
'compare' => '>=',
'value' => $today,
),
),
'numberposts' => 3
);
$context['projet'] = Timber::get_posts( $projet ); $context['projet'] = Timber::get_posts( $projet );
$context['posts'] = Timber::get_posts( $args ); $context['posts'] = Timber::get_posts( $args );
$context['tpsF'] = Timber::get_posts( $tpsF ); $context['tpsF'] = Timber::get_posts( $tpsF );