Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2018 12:57
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Dan0sz/c311fa5d35322c6e9e55ed06658d4743 to your computer and use it in GitHub Desktop.
Pure PHP template for Facebook, Twitter and Google+ Share Buttons
/* Social Share Buttons template for Wordpress
* By Daan van den Bergh
$postUrl = 'http' . ( isset( $_SERVER['HTTPS'] ) ? 's' : '' ) . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; ?>
<section class="sharing-box content-margin content-background clearfix">
<h5 class="sharing-box-name">Don't be selfish. Share the knowledge!</h5>
<div class="share-button-wrapper">
<a target="_blank" class="share-button share-twitter" href="<?php echo $postUrl; ?>&text=<?php echo the_title(); ?>&via=<?php the_author_meta( 'twitter' ); ?>" title="Tweet this">Tweet this</a>
<a target="_blank" class="share-button share-facebook" href="<?php echo $postUrl; ?>" title="Share on Facebook">Share on Facebook</a>
<a target="_blank" class="share-button share-googleplus" href="<?php echo $postUrl; ?>" title="Share on Google+">Share on Google+</a>
Copy link

Is there associated CSS that should accompany this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment