handling empty value + removing unecessary icon query

This commit is contained in:
Antoine M 2023-12-06 16:22:09 +01:00
parent 9afefea23a
commit de17871391

View File

@ -6,7 +6,12 @@ $brochuresPosts = $args['brochuresPosts'];
<?php if ($brochuresPosts->have_posts()) : while ($brochuresPosts->have_posts()) : $brochuresPosts->the_post(); ?> <?php if ($brochuresPosts->have_posts()) : while ($brochuresPosts->have_posts()) : $brochuresPosts->the_post(); ?>
<?php <?php
$brochurePdf = get_field('brochure_pdf', get_the_id()) ?? null; $brochurePdf = get_field('brochure_pdf', get_the_id()) ?? null;
$brochureCover = get_field('brochure_cover_image', $brochurePdf['ID']) ?? null;
// RETURN IF NO PDF
if (!$brochurePdf) continue;
$brochureCover = $brochurePdf['ID'] ? get_field('brochure_cover_image', $brochurePdf['ID']) : null;
$brochureEdition = get_field('brochure_edition', get_the_id()) ?? null; $brochureEdition = get_field('brochure_edition', get_the_id()) ?? null;
$thematique = get_the_terms(get_the_id(), 'thematiques')[0] ?? null; $thematique = get_the_terms(get_the_id(), 'thematiques')[0] ?? null;
$rootThematic = getParentThematique($thematique) ?? null; $rootThematic = getParentThematique($thematique) ?? null;
@ -29,3 +34,7 @@ $brochuresPosts = $args['brochuresPosts'];
<?php endwhile ?> <?php endwhile ?>
<?php endif; ?> <?php endif; ?>
<?php if (!$brochuresPosts->have_posts()) : ?>
<p class="publications-grid__no-results filters-no-results"><?php echo __("Aucune brochure n'a été trouvée", "homegrade-theme__texte-fonctionnel__publications-archive") ?></p>
<?php endif ?>