48 lines
1.6 KiB
PHP
48 lines
1.6 KiB
PHP
<?php
|
|
$postID = $args['postID'];
|
|
$published = $args['published'] ?? null;
|
|
$modified = $args['modified'] ?? null;
|
|
|
|
|
|
|
|
function build_share_urls($postID)
|
|
{
|
|
$postUrl = get_permalink($postID);
|
|
$postTitle = get_the_title($postID);
|
|
$facebookUrl = 'https://www.facebook.com/sharer.php?u=' . $postUrl;
|
|
$twitterUrl = 'https://www.facebook.com/sharer.php?u=' . $postUrl;
|
|
$linkedInUrl = 'https://www.linkedin.com/feed/?shareActive=true&text=' . $postTitle . ' ' . $postUrl;
|
|
|
|
return array(
|
|
'facebook' => $facebookUrl,
|
|
'twitter-x' => $twitterUrl,
|
|
'linkedin' => $linkedInUrl
|
|
);
|
|
}
|
|
|
|
$shareUrls = build_share_urls($postID);
|
|
|
|
|
|
?>
|
|
|
|
<div class="post-infos-capsule">
|
|
<div class="post-infos-capsule__share">
|
|
Partager sur
|
|
<?php foreach ($shareUrls as $key => $shareUrl) : ?>
|
|
<a class="share-button share-button--<?php echo $key ?>" href='<?php echo $shareUrl ?>' target="_blank" title="<?php echo __("Partager ce contenu sur", "homegrade-theme__texte-fonctionnel") . $key ?>">
|
|
<?php if ($key) : ?>
|
|
<!-- <img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/icone-social-' . $key . '.svg' ?>" /> -->
|
|
<?php endif; ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php if ($published) : ?>
|
|
<div class="post-infos-capsule__publication-date">
|
|
|
|
<time><?php echo __("Publié le ", "homegrade-theme__texte-fonctionnel") . $published ?></time>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($modified) : ?>
|
|
<time class="post-infos-capsule__publication-date"><?php echo __("Publié le ", "homegrade-theme__texte-fonctionnel") . $modified ?></time>
|
|
<?php endif; ?>
|
|
</div>
|