Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tie share count into WordPress and RRSSB
<?php
require("share-count.php");
// grab current url by site, then inner page
$url = site_url() . $_SERVER['REQUEST_URI'];
// get page title and sanitize
$title = get_the_title();
$clean_title = str_replace(' ', '%20', $title);
$site_name = get_bloginfo('name');
$obj=new shareCount($url);
?>
<section class="content-36 bg-light-gray">
<div class="container social-share">
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>" target="_new" class="facebook" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>', 'newwindow', 'width=400, height=250')"><span class="fui-facebook"></span><span> Share <?php echo $obj->get_fb(); ?></span></a>
<a href="https://twitter.com/home?status=<?php echo $url; ?>%20<?php echo $clean_title; ?>%20via%20@johnbhartley" target="_new" onclick="window.open('https://twitter.com/home?status=<?php echo $clean_title; ?>%20<?php echo $url; ?>%20via%20@johnbhartley', 'newwindow', 'width=400, height=250')" class="twitter"><span class="fui-twitter"></span><span> Tweet <?php echo $obj->get_tweets(); ?></span></a>
<a href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo $site_name; ?>&summary=<?php echo $clean_title; ?>&source=<?php echo $site_name; ?>" target="_new" class="linkedin" onclick="window.open('http://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo $site_name; ?>%20Network&summary=My%20favorite%20developer%20program&source=<?php echo $site_name; ?>', 'newwindow', 'width=500, height=500')"><span class="fui-linkedin"></span><span> Share <?php echo $obj->get_linkedin(); ?></span></a>
<a href="https://plus.google.com/share?url=<?php echo $url; ?>" target="_new" class="googleplus" onclick="window.open('https://plus.google.com/share?url=<?php echo $url; ?>', 'newwindow', 'width=500, height=500')"><span class="fui-googleplus"></span><span> Share <?php echo $obj->get_plusones(); ?></span></a>
<a href="mailto:?subject=<?php echo $title; ?>&body=<?php echo $url; ?>" class="email"><span class="fui-mail"></span><span> Email</span></a>
</div>
</section>
@robspangler

This comment has been minimized.

Copy link

robspangler commented Mar 5, 2015

Wait, are you serious... This looks great. Is it working well for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.