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
$currentPostType = get_post_type();
$post_id = get_the_ID();
if ($currentPostType === 'revues') {
$currentRevueID = get_the_ID();
}
if ($currentPostType === 'articles') {
$currentRevueID = get_field('related_revue', get_the_ID());
$currentRevueID = get_field('related_revue', $post_id);
}
if (!$currentRevueID) return;
@ -14,7 +15,9 @@ $issueNumber = get_field('issue_number', $currentRevueID);
$post_type = get_post_type();
$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="">
Citer
</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="">
J'aime
<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">
<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="">
Partager
</button>
@ -83,3 +88,29 @@ $citeReference = get_field('cite_reference', get_the_ID());
</div>
</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>