updating component to handle post query

This commit is contained in:
Antoine M 2023-11-30 13:11:29 +01:00
parent 7048d8aabe
commit ef774fddcc

View File

@ -1,26 +1,34 @@
<?php <?php
$videosWebinairesDatas = $args['videosWebinairesDatas']; $videosWebinairesPosts = $args['videosWebinairesPosts'];
?> ?>
<?php foreach ($videosWebinairesDatas as $videoData) : ?> <?php if ($videosWebinairesPosts->have_posts()) : while ($videosWebinairesPosts->have_posts()) : $videosWebinairesPosts->the_post(); ?>
<?php
<li class="publications-grid__row publications-grid--webinaires__row"> $thematique = get_the_terms(get_the_ID(), 'thematiques')[0] ?? null;
$mainThematique = getParentThematique($thematique) ?? null;
<img class="publications-grid__video-thumbnail" src="<?php echo $videoData['thumbnail']['url'] ?>" /> $mainThematiqueIcon = get_field('taxonomy_pictures', "thematiques_" . $rootThematic->term_id)['icon'] ?? null;
$publicationDate = get_field("date", get_the_ID());
<h2 class="publications-grid__title"><?php echo $videoData['title'] ?></h2>
<?php if ($videoData['thematique']) : ?>
<p class="publications-grid__thematique thematique-tag thematique-tag--<?php echo $videoData['thematique']->slug ?>"><?php echo $videoData['thematique']->name ?></p>
<?php endif; ?>
<?php if (!$videoData['thematique']) : ?>
<p class="publications-grid__thematique thematique-tag thematique-tag--general"><?php echo __("Général", "homegrade-theme_texte-fonctionnel") ?></p>
<?php endif; ?>
<p class="publications-grid__edition"><?php echo $videoData['date'] ?></p>
<div class="publications-grid__button"> ?>
<a href="<?php echo $videoData['url'] ?>" class=" cta cta--secondary cta--button" target="_blank"><?php echo __("Voir la vidéo", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a> <li class="publications-grid__row publications-grid--webinaires__row">
</div>
</li>
<?php endforeach; ?> <img class="publications-grid__video-thumbnail" src="<?php echo the_post_thumbnail_url() ?>" />
<h2 class="publications-grid__title"><?php echo get_the_title() ?></h2>
<?php if ($mainThematique) : ?>
<p class="publications-grid__thematique thematique-tag thematique-tag--<?php echo $mainThematique->slug ?>"><?php echo $mainThematique->name ?></p>
<?php endif; ?>
<?php if (!$mainThematique) : ?>
<p class="publications-grid__thematique thematique-tag thematique-tag--general"><?php echo __("Général", "homegrade-theme_texte-fonctionnel") ?></p>
<?php endif; ?>
<p class="publications-grid__edition"><?php echo $publicationDate ?></p>
<div class="publications-grid__button">
<a href="<?php echo $videoData['url'] ?>" class=" cta cta--secondary cta--button" target="_blank"><?php echo __("Voir la vidéo", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
</div>
</li>
<?php endwhile ?>
<?php endif; ?>