FEATURE Handling main author
This commit is contained in:
parent
ea5e3b13cd
commit
8c5dd8cb02
|
|
@ -5,7 +5,12 @@ $post_id = get_the_ID();
|
||||||
$postTitle = get_the_title($post_id);
|
$postTitle = get_the_title($post_id);
|
||||||
$hasNumerotation = hasPostTypeNumerotation($post_id);
|
$hasNumerotation = hasPostTypeNumerotation($post_id);
|
||||||
$hasThumbnail = has_post_thumbnail();
|
$hasThumbnail = has_post_thumbnail();
|
||||||
|
|
||||||
$authors = get_field('authors', $ID);
|
$authors = get_field('authors', $ID);
|
||||||
|
$has_main_author = get_field('has_main_author', $ID);
|
||||||
|
$main_author = get_field('main_author', $ID);
|
||||||
|
|
||||||
|
|
||||||
$post_date_info_label = $args['post_date_info_label'] ?? 'Parution';
|
$post_date_info_label = $args['post_date_info_label'] ?? 'Parution';
|
||||||
$thumbnail_position = $args['thumbnail_position'] ?? 'left';
|
$thumbnail_position = $args['thumbnail_position'] ?? 'left';
|
||||||
$has_thumbnail_overlay = $args['has_thumbnail_overlay'] ?? false;
|
$has_thumbnail_overlay = $args['has_thumbnail_overlay'] ?? false;
|
||||||
|
|
@ -45,8 +50,13 @@ $has_thumbnail_overlay = $args['has_thumbnail_overlay'] ?? false;
|
||||||
)); ?>
|
)); ?>
|
||||||
|
|
||||||
<h1 class="post-header__title"> <?php echo $postTitle; ?></h1>
|
<h1 class="post-header__title"> <?php echo $postTitle; ?></h1>
|
||||||
<?php if ($authors && is_array($authors) && count($authors) > 0) : ?>
|
|
||||||
<a class="post-header__main-author" href="<?php echo get_the_permalink($authors[0]->ID); ?>">
|
<?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; ?>
|
<?php echo $authors[0]->post_title; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user