FEATURE Hiding authors and references if no values encoded

This commit is contained in:
Nonimart 2025-08-21 16:18:18 +02:00
parent c897e2e656
commit 23edc2b1f4

View File

@ -1,4 +1,11 @@
<?php
$id = get_the_ID();
$reference = get_field('references', $id);
$hasReferences = isset($reference) && is_array($reference) && count($reference) > 0;
$authors = get_field('authors', $id);
$hasAuthors = isset($authors) && is_array($authors) && count($authors) > 0;
?>
@ -8,15 +15,18 @@
<img class="icon" src="<?php echo get_stylesheet_directory_uri(); ?>/resources/img/icons/carhop-document.svg" alt="">
Article
</button>
<button id="tab-2" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-2" tabindex="-1" data-tab="authors">
<img class="icon" src="<?php echo get_stylesheet_directory_uri(); ?>/resources/img/icons/carhop-plume.svg" alt="">
Auteur·e·s
</button>
<button id="tab-3" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-3" tabindex="-1" data-tab="references">
<img class="icon" src="<?php echo get_stylesheet_directory_uri(); ?>/resources/img/icons/carhop-lien.svg" alt="">
Références
</button>
<?php if ($hasAuthors) : ?>
<button id="tab-2" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-2" tabindex="-1" data-tab="authors">
<img class="icon" src="<?php echo get_stylesheet_directory_uri(); ?>/resources/img/icons/carhop-plume.svg" alt="">
Auteur·e·s
</button>
<?php endif; ?>
<?php if ($hasReferences) : ?>
<button id="tab-3" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-3" tabindex="-1" data-tab="references">
<img class="icon" src="<?php echo get_stylesheet_directory_uri(); ?>/resources/img/icons/carhop-lien.svg" alt="">
Références
</button>
<?php endif; ?>
<button id="tab-4" type="button" role="tab" aria-selected="false" aria-controls="tabpanel-4" tabindex="-1" data-tab="table-of-contents">
<img class="icon" src="<?php echo get_stylesheet_directory_uri(); ?>/resources/img/icons/carhop-plan.svg" alt="">
Table des matières