Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Tie share count into WordPress and RRSSB
// 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="<?php echo $url; ?>" target="_new" class="facebook" onclick="'<?php echo $url; ?>', 'newwindow', 'width=400, height=250')"><span class="fui-facebook"></span><span> Share <?php echo $obj->get_fb(); ?></span></a>
<a href="<?php echo $url; ?>%20<?php echo $clean_title; ?>%20via%20@johnbhartley" target="_new" onclick="'<?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="<?php echo $url; ?>&title=<?php echo $site_name; ?>&summary=<?php echo $clean_title; ?>&source=<?php echo $site_name; ?>" target="_new" class="linkedin" onclick="'<?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="<?php echo $url; ?>" target="_new" class="googleplus" onclick="'<?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>

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.