WordPress Share Article Widget

Posted on Oct 23, 2024

by Jimmy

Last updated on February 28, 2025


This code creates a set of social media sharing links that allow users to share the current page or post on social media.

PHP
        
            <div class="share__links">
    <?php /* LinkedIn */ ?>
    <a href="https://www.linkedin.com/sharing/share-offsite/?url=<?php the_permalink(); ?>" target="_blank">LinkedIn</a>

    <?php /* X (Twitter) */ ?>
    <a href="https://twitter.com/intent/tweet?text=<?= the_title(); ?>&url=<?php the_permalink(); ?>" target="_blank">Twitter (X)</a>

    <?php /* Facebook */ ?>
    <a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" target="_blank">Facebook</a>
</div>        
    

Back to Snippets