Skip to content

Instantly share code, notes, and snippets.

@purzlbaum
Created January 17, 2014 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purzlbaum/8479583 to your computer and use it in GitHub Desktop.
Save purzlbaum/8479583 to your computer and use it in GitHub Desktop.
HTML and PHP to include the share functions of Facebook, Twitter, Google+ and Pinterest (without counter)
<?php
$largeImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
?>
<div class="sharebuttons">
<div class="sharing">
<h3>Sharen</h3>
<ul>
<li class="facebook">
<a title="Bei Facebook empfehlen" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode(get_permalink($post->ID)); ?>&t=<?php echo rawurlencode(strip_tags(get_the_title())) ?>" target="blank" rel="nofollow"><span class="genericon genericon-facebook"></span><span class="network">Facebook</span><span class="count">(<?php echo get_likes(urlencode(get_permalink($post->ID))); ?>)</span></a>
</li>
<li class="twitter">
<a href="https://twitter.com/intent/tweet?source=webclient&text=<?php echo get_the_title(); ?>%20:%20<?php echo urlencode(get_permalink($post->ID)); ?>%20via%20%40purzlbaum" target="blank" title="Bei Twitter empfehlen" rel="nofollow"><span class="genericon genericon-twitter"></span><span class="network">Twitter</span><span class="count">(<?php echo get_tweets(urlencode(get_permalink($post->ID))); ?>)</span></a>
</li>
<li class="pinterest">
<a title="Bei Google+ empfehlen" href="https://plusone.google.com/_/+1/confirm?hl=de&url=<?php echo urlencode(get_permalink($post->ID)); ?>&title=<?php echo rawurlencode(strip_tags(get_the_title())) ?>" target="blank" rel="nofollow"><span class="genericon genericon-googleplus"></span><span class="network">Google+</span><span class="count">(<?php echo get_plusones(urlencode(get_permalink($post->ID))); ?>)</span></a>
</li>
<li class="googleplus">
<a title="Bei Pinterest pinnen" href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;media=<?php echo $largeImageUrl[0]; ?>" target="blank" rel="nofollow"><span class="genericon genericon-pinterest-alt"></span><span class="network">Pinterest</span></a>
</li>
</ul>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment