FEATURE Refining behaviour & introducing share buttons & urls
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nonimart 2025-09-17 14:18:56 +02:00
parent 33be80f6fa
commit fe22d158c9

View File

@ -1,11 +1,12 @@
<?php <?php
$currentPostType = get_post_type(); $currentPostType = get_post_type();
$post_id = get_the_ID();
if ($currentPostType === 'revues') { if ($currentPostType === 'revues') {
$currentRevueID = get_the_ID(); $currentRevueID = get_the_ID();
} }
if ($currentPostType === 'articles') { if ($currentPostType === 'articles') {
$currentRevueID = get_field('related_revue', get_the_ID()); $currentRevueID = get_field('related_revue', $post_id);
} }
if (!$currentRevueID) return; if (!$currentRevueID) return;
@ -14,7 +15,9 @@ $issueNumber = get_field('issue_number', $currentRevueID);
$post_type = get_post_type(); $post_type = get_post_type();
$hasThumbnail = has_post_thumbnail(); $hasThumbnail = has_post_thumbnail();
$citeReference = get_field('cite_reference', get_the_ID()); $citeReference = get_field('cite_reference', $post_id);
$likes_count = get_post_likes_count($post_id);
?> ?>
@ -69,11 +72,13 @@ $citeReference = get_field('cite_reference', get_the_ID());
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-citer-article.svg" alt=""> <img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-citer-article.svg" alt="">
Citer Citer
</button> </button>
<button class="socials-buttons__button socials-buttons__button--like"> <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=""> <img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-soutenir.svg" alt="">
J'aime <span class="likes-count"><?php echo $likes_count; ?></span>
<span class="button-action-text">J'aime</span>
</button> </button>
<button class="socials-buttons__button socials-buttons__button--share"> <button class="socials-buttons__button socials-buttons__button--share" data-share-url="<?php echo get_the_permalink(); ?>">
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-partager-social.svg" alt=""> <img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-partager-social.svg" alt="">
Partager Partager
</button> </button>
@ -82,4 +87,30 @@ $citeReference = get_field('cite_reference', get_the_ID());
</div> </div>
</div> </div>
</section> </section>
<?php
$published = $args['published'] ?? null;
$modified = $args['modified'] ?? null;
$shareUrls = build_share_urls();
write_log($shareUrls);
?>
<div class="post-infos-capsule">
<ul class="post-infos-capsule__share">
<?php foreach ($shareUrls as $key => $shareUrl) : ?>
<li class="share-button share-button--<?php echo $key ?>">
<a href='<?php echo $shareUrl ?>' class="share-link" target="_blank" title="<?php echo __("Partager ce contenu sur ", "homegrade-theme__texte-fonctionnel") . $key ?>">
</a>
</li>
<?php endforeach; ?>
</ul>
</div>