107 lines
3.5 KiB
PHP
107 lines
3.5 KiB
PHP
<?php
|
|
$currentPostType = get_post_type();
|
|
$post_id = get_the_ID();
|
|
|
|
$postTitle = get_the_title($post_id);
|
|
$hasNumerotation = hasPostTypeNumerotation($post_id);
|
|
$hasThumbnail = has_post_thumbnail();
|
|
|
|
$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';
|
|
$has_thumbnail_overlay = $args['has_thumbnail_overlay'] ?? false;
|
|
|
|
$likes_count = get_post_likes_count($post_id);
|
|
$citeReference = get_field('cite_reference', $post_id);
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
<?php if ($hasNumerotation) : ?>
|
|
<?php
|
|
$numerotation = get_post_meta($current_post_id, 'post_numerotation', true); ?>
|
|
<p class="content-meta__revue-issue content-meta__revue-issue--green">
|
|
<span class="revue-issue-number revue-meta__label sr-only">Numéro</span>
|
|
<?php echo $numerotation; ?>
|
|
</p>
|
|
<?php endif; ?>
|
|
|
|
<section class="post-header post-header--<?php echo $post_type; ?> ">
|
|
<div class="post-header__inner post-header__inner--<?php echo $hasThumbnail ? 'has-thumbnail post-header__inner--thumbnail-' . $thumbnail_position : 'no-thumbnail'; ?> ">
|
|
|
|
<?php if ($hasThumbnail) : ?>
|
|
<div class="thumbnail-wrapper">
|
|
<?php
|
|
$focal_position = safe_get_thumbnail_focal_point_css();
|
|
the_post_thumbnail('full', [
|
|
'class' => 'thumbnail',
|
|
'style' => 'object-fit: cover; object-position: ' . esc_attr($focal_position) . ';'
|
|
]);
|
|
?>
|
|
<?php if ($has_thumbnail_overlay) : ?>
|
|
<div class="thumbnail-overlay"></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="content">
|
|
<?php get_template_part('template-parts/components/content-meta', null, array(
|
|
'current_post_id' => $post_id,
|
|
'current_post_type' => $post_type
|
|
)); ?>
|
|
|
|
<h1 class="post-header__title"> <?php echo $postTitle; ?></h1>
|
|
|
|
|
|
<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">
|
|
|
|
|
|
|
|
<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', $post_id); ?>"><?php echo get_the_date('d F Y', $post_id); ?></time>
|
|
</div>
|
|
</div>
|
|
<?php get_template_part('template-parts/components/posts/social-buttons', null, array()); ?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</section>
|