homegrade_theme_production/template-components/archives/fiche-info-rows.php

53 lines
2.2 KiB
PHP

<?php
$fichesInfosPosts = $args['fichesInfosPosts'];
?>
<?php if ($fichesInfosPosts->have_posts()) : while ($fichesInfosPosts->have_posts()) : $fichesInfosPosts->the_post(); ?>
<?php
$ficheInfoPdf = get_field('brochure_pdf', get_the_ID()) ?? null;;
$ficheInfoEdition = get_field('brochure_edition', get_the_ID()) ?? null;
$thematiques = get_the_terms(get_the_ID(), 'thematiques');
$mainThematique = get_the_terms(get_the_ID(), 'thematiques')[0] ?? null;
$rootThematic = getMainThematique($mainThematique) ?? null;
$rootThematicIcon = get_field('taxonomy_pictures', "thematiques_" . $rootThematic->term_id)['icon'] ?? null;
?>
<li class="publications-grid__row">
<?php if ($rootThematicIcon) : ?>
<img class="publications-grid__icon" src="<?php echo $rootThematicIcon['url'] ?>" alt="" />
<?php endif; ?>
<h3 class="publications-grid__title"><?php echo get_the_title() ?></h3>
<div class="publications-grid__thematiques-tags">
<?php foreach ($thematiques as $thematique) : ?>
<?php
$rootThematic = getMainThematique($thematique) ?? null;
$rootThematicIcon = get_field('taxonomy_pictures', "thematiques_" . $rootThematic->term_id)['icon'] ?? null;
?>
<p class="publications-grid__thematique thematique-tag thematique-tag--<?php echo $rootThematic->slug ?>"><?php echo $rootThematic->name ?></p>
<?php endforeach; ?>
</div>
<?php if ($ficheInfoEdition) : ?>
<p class="publications-grid__edition"><?php echo $ficheInfoEdition ?></p>
<?php endif; ?>
<div class="publications-grid__button">
<?php if ($ficheInfoPdf) : ?>
<a href="<?php echo $ficheInfoPdf['url'] ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le PDF", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
<?php endif; ?>
</div>
</li>
<?php endwhile ?>
<?php endif; ?>
<?php if (!$fichesInfosPosts->have_posts()) : ?>
<p class="publications-grid__no-results filters-no-results"><?php echo __("Aucune fiche-info n'a été trouvée", "homegrade-theme__texte-fonctionnel__publications-archive") ?></p>
<?php endif ?>