68 lines
1.4 KiB
PHP
68 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* template name: Accueil
|
|
*/
|
|
|
|
use Timber\Post;
|
|
use Timber\Timber;
|
|
|
|
$context = Timber::get_context();
|
|
$post = new Post();
|
|
$context['post'] = $post;
|
|
|
|
$projet = array(
|
|
'post_type' => 'les-projets',
|
|
'post_status'=>'publish',
|
|
'numberposts' => 3
|
|
);
|
|
|
|
$tpsF = array(
|
|
'post_type' => 'les-temps-forts',
|
|
'post_status'=>'publish',
|
|
'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['video_url'] = get_field('video_la_mine', FALSE, FALSE);
|
|
|
|
$context['projet'] = Timber::get_posts( $projet );
|
|
$context['posts'] = Timber::get_posts( $args );
|
|
$count_events = count($context['posts']);
|
|
|
|
$args = array (
|
|
'post_type' => 'post',
|
|
'orderby' => 'informations_fin_event',
|
|
'order' => 'ASC',
|
|
'meta_query' => array(
|
|
array(
|
|
'key' => 'informations_fin_event',
|
|
'compare' => '>=',
|
|
'value' => $today,
|
|
),
|
|
),
|
|
'numberposts' => 3
|
|
);
|
|
|
|
if ($count_events == 0) {
|
|
$context['posts_now'] = Timber::get_posts( $args );
|
|
}
|
|
|
|
$context['tpsF'] = Timber::get_posts( $tpsF );
|
|
|
|
Timber::render('accueil.twig', $context);
|