FEATURE enhancing post authors main authors and director publications handling
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2026-03-24 15:28:14 +01:00
parent d292fdd51b
commit 4264f17a59

View File

@ -6,10 +6,12 @@ $postTitle = get_the_title($post_id);
$hasNumerotation = hasPostTypeNumerotation($post_id);
$hasThumbnail = has_post_thumbnail();
$authors = get_field('authors', $ID);
$has_main_author = get_field('has_main_author', $ID);
$main_author = get_field('main_author', $ID);
$authors = get_field('authors', $post_id);
$has_main_author = get_field('has_main_author', $post_id);
$main_author = get_field('main_author', $post_id);
$has_publication_direction = get_field('has_publication_direction', $post_id);
$publication_directors = get_field('publication_directors', $post_id);
$post_date_info_label = $args['post_date_info_label'] ?? 'Parution';
$thumbnail_position = $args['thumbnail_position'] ?? 'left';
@ -54,15 +56,33 @@ $citeReference = get_field('cite_reference', $post_id);
<h1 class="post-header__title"> <?php echo $postTitle; ?></h1>
<?php if ($has_main_author && $main_author) : ?>
<a class="post-header__main-author" href="<?php echo get_the_permalink($main_author->ID); ?>">
<?php echo $main_author->post_title; ?>
</a>
<?php elseif ($authors && is_array($authors) && count($authors) > 0) : ?>
<a class="post-header__first-author" href="<?php echo get_the_permalink($authors[0]->ID); ?>">
<?php echo $authors[0]->post_title; ?>
</a>
<?php endif; ?>
<ul class="post-header__authors-list">
<?php if ($has_main_author && $main_author) : ?>
<li>
<a class="post-header__main-author" href="<?php echo get_the_permalink($main_author->ID); ?>">
<?php echo $main_author->post_title; ?>
</a>
</li>
<?php elseif ($authors && is_array($authors) && count($authors) > 0) : ?>
<li>
<a class="post-header__first-author" href="<?php echo get_the_permalink($authors[0]->ID); ?>">
<?php echo $authors[0]->post_title; ?>
</a>
</li>
<?php endif; ?>
<?php if ($has_publication_direction && $publication_directors) : ?>
<?php foreach ($publication_directors as $publication_director) : ?>
<li>
<a class="post-header__publication-director" href="<?php echo get_the_permalink($publication_director->ID); ?>">
<?php echo $publication_director->post_title; ?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<div class="post-details">
@ -71,7 +91,7 @@ $citeReference = get_field('cite_reference', $post_id);
<div class="post-meta">
<div class="post-date-info">
<p class="post-details__label"><?php echo $post_date_info_label; ?></p>
<time class="post-details__value" datetime="<?php echo get_the_date('Y-m-d', $currentRevueID); ?>"><?php echo get_the_date('d F Y', $currentRevueID); ?></time>
<time class="post-details__value" datetime="<?php echo get_the_date('Y-m-d', $post_id); ?>"><?php echo get_the_date('d F Y', $post_id); ?></time>
</div>
</div>