Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Page de catégories : Agenda (category-agenda.php)
- * Category Agenda du thème
- *
- * @package WordPress
- */
- ?>
- <?php get_header(); ?>
- <section id="main-area" class="wrap breadcrumbs clearfix" role="main">
- <div class="breadcrumbs top clearfix">
- <aside>Vous êtes ici:</aside>
- <ul>
- <li><a href="<?php bloginfo('url') ?>" title="">Accueil</a></li>
- <li class="current">Agenda</li>
- </ul>
- </div>
- <section id="agenda" class="clearfix">
- <header class="clearfix">
- <h1>L'agenda</h1>
- <aside>
- <ul id="social-buttons">
- <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>
- <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>
- <li><div class="g-plusone" data-size="medium"></div></li>
- </ul>
- </aside>
- <p><?php echo category_description( get_category_by_slug( 'agenda' )->term_id ); ?></p>
- </header>
- <nav class="filters clearfix">
- <ul>
- <li>Filtrez les news par catégorie</li>
- <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>
- <?php $categories = get_categories( array( 'orderby' => 'id',
- 'order' => 'ASC',
- 'child_of' => get_category_by_slug( 'agenda' )->term_id,
- 'hide_empty' => 0 )); ?>
- <?php foreach( $categories as $category ) : ?>
- <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>
- <?php endforeach; ?>
- </ul>
- </nav>
- <?php
- /**/
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
- $posts_per_page = get_option('posts_per_page');
- // LHE : Gestion des plages de dates
- switch( getCurrentCatID() ) {
- case get_category_by_slug( 'agenda' )->term_id:
- // Appeler les articles futurs pour les catégories "Concerts", "Masterclasses" et "Stages"
- $args = array( 'category__in' => array( get_category_by_slug( 'concerts' )->term_id,
- get_category_by_slug( 'masterclass-agenda' )->term_id,
- get_category_by_slug( 'stages' )->term_id ),
- 'meta_key' => 'date',
- 'meta_value' => getDateWithTol(),
- 'meta_compare' => '>=',
- 'orderby' => 'meta_value_num',
- 'order' => 'ASC',
- 'post_status' => 'publish',
- 'posts_per_page' => $posts_per_page,
- 'paged' => $paged );
- break;
- case get_category_by_slug( 'concerts' )->term_id:
- case get_category_by_slug( 'masterclass-agenda' )->term_id:
- case get_category_by_slug( 'stages' )->term_id:
- // Appeler les articles futurs pour la catégorie sélectionnée
- $args = array( 'cat' => getCurrentCatID(),
- 'meta_key' => 'date',
- 'meta_value' => getDateWithTol(),
- 'meta_compare' => '>=',
- 'orderby' => 'meta_value_num',
- 'order' => 'ASC',
- 'post_status' => 'publish',
- 'posts_per_page' => $posts_per_page,
- 'paged' => $paged );
- break;
- case get_category_by_slug( 'actualites' )->term_id:
- // Appeler les articles d'actualité dans la période de tolérance
- $args = array( 'cat' => getCurrentCatID(),
- 'meta_key' => 'date',
- 'meta_value' => getDateWithTol(get_field('duree_vie_actualite', 'option')),
- 'meta_compare' => '>=',
- 'orderby' => 'meta_value_num',
- 'order' => 'ASC',
- 'post_status' => 'publish',
- 'posts_per_page' => $posts_per_page,
- 'paged' => $paged );
- break;
- // Archives
- case get_category_by_slug( 'archives' )->term_id:
- // Appeler les articles toutes catégories passés
- $args = array( 'cat' => getCurrentCatID(),
- 'meta_key' => 'date',
- 'meta_value' => getDateWithTol(),
- 'meta_compare' => '<',
- 'orderby' => 'meta_value_num',
- 'order' => 'ASC',
- 'post_status' => 'publish',
- 'posts_per_page' => $posts_per_page,
- 'paged' => $paged );
- break;
- default:
- } // endswitch;
- /**/
- // $agenda = new WP_Query($args);
- $temp = $wp_query;
- $wp_query= null;
- $wp_query = new WP_Query();
- $wp_query->query($args);
- ?>
- <?php if( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
- <?php $date = DateTime::createFromFormat('Ymd', get_field( 'date' )); ?>
- <article id="post-<?php the_ID(); ?>" class="large clearfix">
- <div><?php if(has_post_thumbnail()): the_post_thumbnail('thumb-agenda',array('title' => "")); endif; ?></div>
- <section class="content">
- <aside><?php echo( getUsefulCats( ' / ' )); // the_category(', '); ?></aside>
- <time datetime="<?php echo $date->format('Y-m-d'); ?>" pubdate="<?php the_time('Y-m-d'); ?>"><?php echo $date->format('d/m/Y'); ?></time>
- <h2><?php the_title(); ?></h2>
- <?php // LHE Ajout des balises spécifiques pour les évènements ?>
- <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>
- <?php if( get_field( 'horaires' )) : ?><h6>Horaires : <?php echo get_field( 'horaires' ); ?></h6><?php endif; ?>
- <?php the_content(); ?>
- <?php // LHE : Gestion du rattachement des intervenants à l'évènement
- if( get_field( 'intervenants_rattaches' )) :
- echo( '<p><u>Intervenant(s) :</u></p><ul>' ); //
- // Parcourir chaque élément
- while( has_sub_field( 'intervenants_rattaches' )) :
- // Pour chaque enseignant afficher le lien ?>
- <li><a href="<?php echo get_sub_field( 'intervenant' ); ?>" target="_blank"><?php echo get_sub_field( 'libellé' ); ?></a></li>
- <?php endwhile; ?></ul>
- <?php endif; /**/ ?>
- <h7>Tarif : <?php echo get_field( 'tarif' ); ?> €</h7>
- <?php if( get_field('intitulé_du_bouton' )) : ?>
- <a href="<?php the_field( 'bouton' ); ?>" title="" class="button"><?php the_field('intitulé_du_bouton'); ?></a>
- <?php endif; ?>
- </section>
- </article>
- <?php endwhile; else: ?>
- <?php _e('Désolé, il n\'y a pas d\'évènement dans cette catégorie.'); ?>
- <?php endif; ?>
- <footer>
- <?php if(function_exists('wp_paginate')) wp_paginate(); ?>
- </footer>
- <?php wp_reset_postdata(); ?>
- <?php $wp_query = null; $wp_query = $temp; ?>
- </section>
- <div class="breadcrumbs bottom">
- <aside>Vous êtes ici:</aside>
- <ul>
- <li><a href="<?php bloginfo('url') ?>" title="">Accueil</a></li>
- <li class="current">Agenda</li>
- </ul>
- </div>
- </section>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement