119 lines
5.1 KiB
PHP
119 lines
5.1 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', $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';
|
|
$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>
|
|
|
|
<?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; ?>
|
|
|
|
<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', $currentRevueID); ?>"><?php echo get_the_date('d F Y', $currentRevueID); ?></time>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="socials-buttons">
|
|
<?php
|
|
$shareUrls = build_share_urls();
|
|
?>
|
|
<button class="socials-buttons__button socials-buttons__button--cite" <?php echo empty($citeReference) ? 'disabled' : ''; ?> title="<?php echo empty($citeReference) ? 'Citation non disponible' : 'Copier la citation'; ?>">
|
|
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-citer-article.svg" alt="">
|
|
Citer
|
|
</button>
|
|
<button class="socials-buttons__button socials-buttons__button--like is-disabled" data-likes-count="<?php echo $likes_count; ?>">
|
|
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-soutenir.svg" alt="">
|
|
<span class="likes-count"><?php echo $likes_count; ?></span>
|
|
<span class="button-action-text">J'aime</span>
|
|
|
|
</button>
|
|
<button class="socials-buttons__button socials-buttons__button--share" data-share-url="<?php echo get_the_permalink(); ?>">
|
|
<img class="share-icon" src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-partager-social.svg" alt="">
|
|
Partager
|
|
<ul class="socials-buttons__share-links">
|
|
<li class="share-button share-button--facebook">
|
|
<a href='<?php echo $shareUrls['Facebook'] ?>' class="share-link" target="_blank" title="<?php echo __("Partager ce contenu sur ", "dynamiques") . "Facebook" ?>">
|
|
<img class="social-icon" src="<?php echo get_template_directory_uri() . '/resources/img/icons/carhop-social-facebook.svg' ?>" alt="">
|
|
</a>
|
|
</li>
|
|
|
|
<li class="share-button share-button--linkedin">
|
|
<a href='<?php echo $shareUrls['Linkedin'] ?>' class="share-link" target="_blank" title="<?php echo __("Partager ce contenu sur ", "dynamiques") . "LinkedIn" ?>">
|
|
<img class="social-icon" src="<?php echo get_template_directory_uri() . '/resources/img/icons/carhop-social-linkedin.svg' ?>" alt="">
|
|
</a>
|
|
</li>
|
|
<li class="share-button share-button--copy-link">
|
|
<a class="share-link share-link--copy" data-url="<?php echo get_the_permalink(); ?>" title="<?php echo __("Copier le lien", "dynamiques") ?>">
|
|
<img class="social-icon" src="<?php echo get_template_directory_uri() . '/resources/img/icons/carhop-social-lien.svg' ?>" alt="">
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</section>
|