/
page-events.php
46 lines (45 loc) · 1.75 KB
/
page-events.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php get_header();
/*
Template Name: Events
*/
// REQUIRES EVENTS MANAGER WP_PLUGIN
?>
<main class="container" id="events">
<section class="row">
<h1>DATES A VENIR</h1>
<?php
$args=array('post_type'=>'event', 'post_status'=>'publish', 'posts_per_page'=>-1, 'tag'=>'-residence'); // Tableau principal : affiche tout les évènements à venir, sauf les pièces en résidence
$headers=array('NOM', 'DATE', 'LIEU', 'VILLE');
$contents=array('event_name', 'event_start_date','location_id');
$events=gv_tabEvents($args, $headers, $contents);
if(!empty($events)){ ?>
<article class="col-sm-12">
<?php echo $events; ?>
</article>
<?php }
$args=array('post_type'=>'event', 'post_status'=>'publish', 'posts_per_page'=>-1, 'tag'=>'residence'); // Tableau secondaire : n'affiche que les pièces en résidence
$headers=array('NOM', 'DATE', 'LIEU', 'VILLE');
$contents=array('event_name', 'event_start_date','location_id');
$residence=gv_tabEvents($args, $headers,$contents);
if(!empty($residence)){?>
<article class="col-sm-12">
<h2>RESIDENCES</h2>
<?php echo $residence; ?>
</article>
<?php }
$req=new WP_Query(); // récupération de l'url de la page des représentations passées pour le lien h3
$all=$req->query(array('post_type' =>'page', 'posts_per_page' => '-1'));
$id=get_the_id();
$links=get_page_children($id,$all);
foreach($links as $link)
if($link->post_name==='representations-passees'){
$archives=$link->guid;
}
?>
<article class="col-sm-12 text-center">
<h3>Représentations passées</h3>
<p>Vous pouvez retrouver ici <a href="<?php echo $archives; ?>">l'ensemble de nos tournées précédentes</a>.</p>
</article>
</section>
</main>
<?php get_footer();?>