SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | /** | |
3 | * Page de catégories : Agenda (category-agenda.php) | |
4 | * Category Agenda du thème | |
5 | * | |
6 | * @package WordPress | |
7 | */ | |
8 | ?> | |
9 | <?php get_header(); ?> | |
10 | <section id="main-area" class="wrap breadcrumbs clearfix" role="main"> | |
11 | <div class="breadcrumbs top clearfix"> | |
12 | <aside>Vous êtes ici:</aside> | |
13 | <ul> | |
14 | <li><a href="<?php bloginfo('url') ?>" title="">Accueil</a></li> | |
15 | <li class="current">Agenda</li> | |
16 | </ul> | |
17 | </div> | |
18 | <section id="agenda" class="clearfix"> | |
19 | <header class="clearfix"> | |
20 | <h1>L'agenda</h1> | |
21 | <aside> | |
22 | <ul id="social-buttons"> | |
23 | <li><div class="fb-like" data-href="<?php the_permalink(); ?>" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div></li> | |
24 | <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-lang="fr" data-count="none">Tweeter</a></li> | |
25 | <li><div class="g-plusone" data-size="medium"></div></li> | |
26 | </ul> | |
27 | </aside> | |
28 | <p><?php echo category_description( get_category_by_slug( 'agenda' )->term_id ); ?></p> | |
29 | </header> | |
30 | <nav class="filters clearfix"> | |
31 | <ul> | |
32 | <li>Filtrez les news par catégorie</li> | |
33 | <li><a href="<?php echo get_category_link( get_category_by_slug( 'agenda' )->term_id ); ?>" title="" <?php if( is_category( 'agenda' )): ?>class="active"<?php endif; ?>>Tout<span class="status"></span></a></li> | |
34 | <?php $categories = get_categories( array( 'orderby' => 'id', | |
35 | 'order' => 'ASC', | |
36 | 'child_of' => get_category_by_slug( 'agenda' )->term_id, | |
37 | 'hide_empty' => 0 )); ?> | |
38 | <?php foreach( $categories as $category ) : ?> | |
39 | <li><a href="<?php echo get_category_link( $category->term_id ); ?>" title="<?php sprintf( __( "View all posts in %s" ), $category->name ); ?>" <?php if( is_category( $category->term_id )): ?>class="active"<?php endif; ?>><?php echo $category->name; ?><span class="status"></span></a></li> | |
40 | <?php endforeach; ?> | |
41 | </ul> | |
42 | </nav> | |
43 | <?php | |
44 | /**/ | |
45 | $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
46 | $posts_per_page = get_option('posts_per_page'); | |
47 | // LHE : Gestion des plages de dates | |
48 | switch( getCurrentCatID() ) { | |
49 | ||
50 | - | $agenda = new WP_Query( array( 'category__in' => array( get_category_by_slug( 'concerts' )->term_id, |
50 | + | |
51 | // Appeler les articles futurs pour les catégories "Concerts", "Masterclasses" et "Stages" | |
52 | $args = array( 'category__in' => array( get_category_by_slug( 'concerts' )->term_id, | |
53 | get_category_by_slug( 'masterclass-agenda' )->term_id, | |
54 | get_category_by_slug( 'stages' )->term_id ), | |
55 | 'meta_key' => 'date', | |
56 | 'meta_value' => getDateWithTol(), | |
57 | 'meta_compare' => '>=', | |
58 | 'orderby' => 'meta_value_num', | |
59 | - | 'posts_per_page' => get_option('posts_per_page'), |
59 | + | |
60 | - | 'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1 )); |
60 | + | |
61 | 'posts_per_page' => $posts_per_page, | |
62 | 'paged' => $paged ); | |
63 | break; | |
64 | ||
65 | case get_category_by_slug( 'concerts' )->term_id: | |
66 | case get_category_by_slug( 'masterclass-agenda' )->term_id: | |
67 | - | $agenda = new WP_Query( array( 'cat' => getCurrentCatID(), |
67 | + | |
68 | // Appeler les articles futurs pour la catégorie sélectionnée | |
69 | $args = array( 'cat' => getCurrentCatID(), | |
70 | 'meta_key' => 'date', | |
71 | 'meta_value' => getDateWithTol(), | |
72 | 'meta_compare' => '>=', | |
73 | 'orderby' => 'meta_value_num', | |
74 | - | 'posts_per_page' => get_option('posts_per_page'), |
74 | + | |
75 | - | 'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1 )); |
75 | + | |
76 | 'posts_per_page' => $posts_per_page, | |
77 | 'paged' => $paged ); | |
78 | break; | |
79 | ||
80 | - | $agenda = new WP_Query( array( 'cat' => getCurrentCatID(), |
80 | + | |
81 | // Appeler les articles d'actualité dans la période de tolérance | |
82 | $args = array( 'cat' => getCurrentCatID(), | |
83 | 'meta_key' => 'date', | |
84 | 'meta_value' => getDateWithTol(get_field('duree_vie_actualite', 'option')), | |
85 | 'meta_compare' => '>=', | |
86 | 'orderby' => 'meta_value_num', | |
87 | - | 'posts_per_page' => get_option('posts_per_page'), |
87 | + | |
88 | - | 'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1 )); |
88 | + | |
89 | 'posts_per_page' => $posts_per_page, | |
90 | 'paged' => $paged ); | |
91 | break; | |
92 | ||
93 | // Archives | |
94 | - | $agenda = new WP_Query( array( 'cat' => getCurrentCatID(), |
94 | + | |
95 | // Appeler les articles toutes catégories passés | |
96 | $args = array( 'cat' => getCurrentCatID(), | |
97 | 'meta_key' => 'date', | |
98 | 'meta_value' => getDateWithTol(), | |
99 | 'meta_compare' => '<', | |
100 | 'orderby' => 'meta_value_num', | |
101 | - | 'posts_per_page' => get_option('posts_per_page'), |
101 | + | |
102 | - | 'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1 )); |
102 | + | |
103 | 'posts_per_page' => $posts_per_page, | |
104 | 'paged' => $paged ); | |
105 | break; | |
106 | ||
107 | default: | |
108 | } // endswitch; | |
109 | - | <?php if( $agenda->have_posts() ) : while ( $agenda->have_posts() ) : $agenda->the_post(); ?> |
109 | + | |
110 | // $agenda = new WP_Query($args); | |
111 | $temp = $wp_query; | |
112 | $wp_query= null; | |
113 | $wp_query = new WP_Query(); | |
114 | $wp_query->query($args); | |
115 | ?> | |
116 | <?php if( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> | |
117 | <?php $date = DateTime::createFromFormat('Ymd', get_field( 'date' )); ?> | |
118 | <article id="post-<?php the_ID(); ?>" class="large clearfix"> | |
119 | <div><?php if(has_post_thumbnail()): the_post_thumbnail('thumb-agenda',array('title' => "")); endif; ?></div> | |
120 | <section class="content"> | |
121 | <aside><?php echo( getUsefulCats( ' / ' )); // the_category(', '); ?></aside> | |
122 | <time datetime="<?php echo $date->format('Y-m-d'); ?>" pubdate="<?php the_time('Y-m-d'); ?>"><?php echo $date->format('d/m/Y'); ?></time> | |
123 | <h2><?php the_title(); ?></h2> | |
124 | <?php // LHE Ajout des balises spécifiques pour les évènements ?> | |
125 | <h5><?php if( get_field( 'date_fin' )) : $dateFin = DateTime::createFromFormat('Ymd', get_field( 'date_fin' )); ?>Du <?php echo getFrenchDate( $date ); ?> au <?php echo getFrenchDate( $dateFin ); ?> – <?php endif; ?><?php $heure='heure'; if( intval( get_field( 'durée' )) > 1 ) $heure .= 's'; ?>Durée <?php echo get_field( 'durée' ) . ' ' . $heure; ?></h5> | |
126 | <?php if( get_field( 'horaires' )) : ?><h6>Horaires : <?php echo get_field( 'horaires' ); ?></h6><?php endif; ?> | |
127 | <?php the_content(); ?> | |
128 | <?php // LHE : Gestion du rattachement des intervenants à l'évènement | |
129 | if( get_field( 'intervenants_rattaches' )) : | |
130 | echo( '<p><u>Intervenant(s) :</u></p><ul>' ); // | |
131 | // Parcourir chaque élément | |
132 | while( has_sub_field( 'intervenants_rattaches' )) : | |
133 | // Pour chaque enseignant afficher le lien ?> | |
134 | <li><a href="<?php echo get_sub_field( 'intervenant' ); ?>" target="_blank"><?php echo get_sub_field( 'libellé' ); ?></a></li> | |
135 | <?php endwhile; ?></ul> | |
136 | <?php endif; /**/ ?> | |
137 | <h7>Tarif : <?php echo get_field( 'tarif' ); ?> €</h7> | |
138 | <?php if( get_field('intitulé_du_bouton' )) : ?> | |
139 | - | <?php wp_reset_postdata(); wp_reset_query(); ?> |
139 | + | |
140 | <?php endif; ?> | |
141 | </section> | |
142 | </article> | |
143 | <?php endwhile; else: ?> | |
144 | <?php _e('Désolé, il n\'y a pas d\'évènement dans cette catégorie.'); ?> | |
145 | <?php endif; ?> | |
146 | ||
147 | <footer> | |
148 | <?php if(function_exists('wp_paginate')) wp_paginate(); ?> | |
149 | </footer> | |
150 | <?php wp_reset_postdata(); ?> | |
151 | <?php $wp_query = null; $wp_query = $temp; ?> | |
152 | </section> | |
153 | <div class="breadcrumbs bottom"> | |
154 | <aside>Vous êtes ici:</aside> | |
155 | <ul> | |
156 | <li><a href="<?php bloginfo('url') ?>" title="">Accueil</a></li> | |
157 | <li class="current">Agenda</li> | |
158 | </ul> | |
159 | </div> | |
160 | </section> | |
161 | <?php get_footer(); ?> |