Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Social Sharing
- function social_share_buttons($postid, $facebook, $twitter, $linkedin, $googleplus, $pinterest) {
- $twitteraccount = 'Username';
- $postlink = get_permalink($postid);
- $posttitle = get_the_title($postid);
- $postimageid = get_post_thumbnail_id($postid);
- $postimage = wp_get_attachment_image_src($postimageid, 'full');
- /* Facebook Like Button */
- if ($facebook && $facebook == true) : ?>
- <div class="facebook-share-button">
- <iframe src="http://www.facebook.com/plugins/like.php?app_id=179762912095902&href=<?php echo $postlink; ?>&send=false&layout=button_count&width=120&show_faces=false&action=like&locale=<?php echo get_locale(); ?>&colorscheme=light&font=arial&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>
- </div>
- <?php endif;
- /* Tweet Button */
- if ($twitter && $twitter == true) : ?>
- <div class="twitter-share-button">
- <a class="twitter-share-button" href="http://twitter.com/share" data-url="<?php echo $postlink; ?>" data-text="<?php echo $posttitle; ?>" data-count="horizontal" <?php if($twitteraccount) { ?> data-via="<?php echo $twitteraccount ?>" <?php } ?>>Tweet</a>
- <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
- </div>
- <?php endif;
- /* Linkedin Share Button */
- if ($linkedin && $linkedin == true) : ?>
- <div class="linkedin-share-button">
- <script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
- <script type="IN/Share" data-url="<?php echo $postlink; ?>" data-counter="right" data-showzero="true"></script>
- </div>
- <?php endif;
- /* Google Plus One Button */
- if ($googleplus && $googleplus == true) : ?>
- <div class="plusone-button">
- <!-- Place this tag where you want the +1 button to render. -->
- <div class="g-plusone" data-size="medium" data-href="<?php echo $postlink; ?>"></div>
- <!-- Place this tag after the last +1 button tag. -->
- <script type="text/javascript">
- (function() {
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
- po.src = 'https://apis.google.com/js/plusone.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
- })();
- </script>
- </div>
- <?php endif;
- /* Pinterest Pin Button */
- if ($pinterest && $pinterest == true) : ?>
- <div class="pin-it-button">
- <a href="http://pinterest.com/pin/create/button/?url=<?php echo $postlink; ?>&media=<?php echo $postimage[0]; ?>&description=<?php echo $posttitle; ?>" class="pin-it-button" count-layout="horizontal" always-show-count="1"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
- <script type="text/JavaScript" src="http://assets.pinterest.com/js/pinit.js"></script>
- </div>
- <?php endif;
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement