?AlkantarClanX12
| Current Path : /home/rankinh/saintgilleslesbains-bis/wp-content/themes/divi-child/ |
| Current File : /home/rankinh/saintgilleslesbains-bis/wp-content/themes/divi-child/single-sglb_event.php |
<?php
get_header();
$post_id = get_the_ID();
// 1. Récupération des dates et heures
$date_start = get_post_meta($post_id, '_sglb_event_date_start', true);
$time_start = get_post_meta($post_id, '_sglb_event_time_start', true);
// 2. Récupération du lieu via l'annuaire lié
$linked_listing_id = get_post_meta($post_id, '_sglb_event_linked_listing', true);
$location_name = '';
$location_addr = '';
if ( $linked_listing_id ) {
$location_name = get_the_title($linked_listing_id);
// On récupère l'adresse stockée dans la fiche annuaire
$location_addr = get_post_meta($linked_listing_id, 'sglb_address', true);
}
// 3. Gestion du Tarif
$tarif_type = get_post_meta($post_id, '_sglb_event_tarif_type', true);
$tarif_prix = get_post_meta($post_id, '_sglb_event_tarif_prix', true);
$display_price = ($tarif_type === 'gratuit') ? 'Gratuit' : $tarif_prix . ' €';
// 4. Lien de réservation
$booking_url = get_post_meta($post_id, '_sglb_event_url', true);
$categories = get_the_terms($post_id, 'sglb_event_cat');
?>
<div id="main-content">
<div class="sglb-container-event">
<?php if ( has_post_thumbnail() ) : ?>
<header class="event-hero-banner">
<?php the_post_thumbnail('full'); ?>
</header>
<?php endif; ?>
<nav class="sglb-breadcrumb">
<a href="<?php echo home_url(); ?>">Accueil</a> ›
<a href="<?php echo get_post_type_archive_link('sglb_event'); ?>">Évènements</a> ›
<?php
// Récupération de la catégorie d'événement
$categories = get_the_terms(get_the_ID(), 'sglb_event_cat');
if($categories && !is_wp_error($categories)) {
echo esc_html($categories[0]->name) . ' › ';
}
?>
<span><?php the_title(); ?></span>
</nav>
<div class="event-content-layout">
<div class="event-main-col">
<h1 class="event-page-title"><?php the_title(); ?></h1>
<?php if ($categories) : ?>
<p class="event-cat-label">Catégorie : <span><?php echo esc_html($categories[0]->name); ?></span></p>
<?php endif; ?>
<div class="event-entry-content">
<?php the_content(); ?>
</div>
</div>
<aside class="event-sidebar-info">
<div class="info-row">
<div class="info-icon blue-dark"><span class="dashicons dashicons-location"></span></div>
<div class="info-text">
<strong>Lieu</strong>
<p>
<?php if ($location_name) : ?>
<strong><?php echo esc_html($location_name); ?></strong><br>
<?php echo esc_html($location_addr); ?>
<?php else : ?>
Lieu non défini
<?php endif; ?>
</p>
</div>
</div>
<div class="info-row">
<div class="info-icon blue-dark"><span class="dashicons dashicons-calendar-alt"></span></div>
<div class="info-text">
<strong>Date</strong>
<p>
<?php
if ($date_start) {
echo 'Le ' . date_i18n('j F Y', strtotime($date_start));
if ($time_start) echo '<br>' . esc_html($time_start);
}
?>
</p>
</div>
</div>
<div class="info-row">
<div class="info-icon blue-dark"><span class="dashicons dashicons-tickets-alt"></span></div>
<div class="info-text">
<strong>Tarif</strong>
<p><?php echo esc_html($display_price); ?></p>
</div>
</div>
<?php if ($booking_url) : ?>
<a href="<?php echo esc_url($booking_url); ?>" class="btn-event-booking" target="_blank">Réservation</a>
<?php endif; ?>
</aside>
</div>
</div>
</div>
<?php get_footer(); ?>