ceinture-culturelle/template-parts/events-display.php
2024-11-25 16:43:13 +01:00

47 lines
2.0 KiB
PHP

<?php
// WP_Query arguments
$args = array(
'post_type' => 'evenements',
);
// The Query
$query = new WP_Query( $args );
?>
<section>
<div class="relative flex flex-col w-full h-full overflow-scroll text-gray-700 bg-white shadow-md rounded-xl bg-clip-border">
<table class="w-full text-left table-auto min-w-max">
<thead>
<tr>
<th class="p-4 border-b border-slate-300 bg-slate-200">Début</th>
<th class="p-4 border-b border-slate-300 bg-slate-200">Fin</th>
<th class="p-4 border-b border-slate-300 bg-slate-200">CP</th>
<th class="p-4 border-b border-slate-300 bg-slate-200">Organisme</th>
<th class="p-4 border-b border-slate-300 bg-slate-200">Titre</th>
</tr>
</thead>
<tbody>
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<?php
$date_debut = get_field('date_debut');
$date_fin = get_field('date_fin');
$code_postal = get_field('code_postal');
$organisme = get_field('organisme');
$lien_de_levenement = get_field('lien_de_levenement');
?>
<tr>
<td class="p-4 border-b border-slate-300"><?php echo $date_debut; ?></td>
<td class="p-4 border-b border-slate-300"><?php echo $date_fin; ?></td>
<td class="p-4 border-b border-slate-300"><?php echo $code_postal; ?></td>
<td class="p-4 border-b border-slate-300"><?php echo $organisme; ?></td>
<td class="p-4 border-b border-slate-300"><a href="<?php echo $lien_de_levenement; ?>" target="_blank"><?php the_title(); ?></a></td>
</tr>
<?php endwhile; else : ?>
<p><?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</tbody>
</table>
</div>
</section>