<?php $url = get_the_permalink(); ?> <tooltiped text="Partager sur facebook"> <?php echo '<a href="https://www.facebook.com/sharer/sharer.php?u=' . $url . '" target="_blank"><span class="byl-icon-facebook social-share"> </span></a>'; ?> </tooltiped> <tooltiped text="Partager sur twitter"> <?php echo '<a href="https://twitter.com/intent/tweet?text=À lire sur @indignation_l ' . $url . '" target="_blank"><span class="byl-icon-twitter social-share"></span></a>';?> </tooltiped> <input class="byl-hidden" type="text" value="<?php echo $url ?>" id="permalinkUrl"> <div class="byl-tooltiped"> <span class="byl-tooltip-text">Copier le lien</span> <span onclick="copy2clipboard()" class="byl-icon-link social-share"></span> </div> <script> function copy2clipboard() { var copyText = document.getElementById("permalinkUrl"); copyText.select(); console.log("check"); console.log(copyText); copyText.setSelectionRange(0, 99999) document.execCommand("copy"); alert("Le lien a été copié dans votre presse-papier!\nVous pouvez le coller en appuyant sur Ctrl+V pour le partager."); } </script>