function ssba_pinterest($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShareCount) { // if using featured images for Pinteres if ($arrSettings['ssba_pinterest_featured'] == 'Y') { // if this post has a featured image if (has_post_thumbnail($arrSettings['post_id'])) { // get the featured image $urlPostThumb = wp_get_attachment_image_src(get_post_thumbnail_id($arrSettings['post_id']), 'full'); $urlPostThumb = $urlPostThumb[0]; } else { // use the pinterest default $urlPostThumb = $arrSettings['ssba_default_pinterest']; } // pinterest share link $htmlShareButtons = '<a data-site="pinterest-featured" href="http://pinterest.com/pin/create/bookmarklet/?is_video=false&url=' . $urlCurrentPage . '&media=' . $urlPostThumb . '&description=' . $strPageTitle . '" class="ssba_pinterest_share ssba_share_link" ' . ($arrSettings['ssba_share_new_window'] == 'Y' ? ' target="_blank" ' : NULL) . ($arrSettings['ssba_rel_nofollow'] == 'Y' ? ' rel="nofollow" ' : NULL) . '>'; } else { // use the choice of pinnable images approach $htmlShareButtons = "<a data-site='pinterest' class='ssba_pinterest_share' href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'>"; } // if image set is not custom if ($arrSettings['ssba_image_set'] != 'custom') { // show ssba image $htmlShareButtons .= '<img src="' . plugins_url() . '/simple-share-buttons-adder/buttons/' . $arrSettings['ssba_image_set'] . '/pinterest.png" title="Pinterest" class="ssba ssba-img" alt="Pin on Pinterest" />'; } else { // show custom image $htmlShareButtons .= '<img title="Pinterest" class="ssba ssba-img" src="' . $arrSettings['ssba_custom_pinterest'] . '" alt="Pin on Pinterest" />'; } // close href $htmlShareButtons .= '</a>'; // if show share count is set to Y if ($arrSettings['ssba_show_share_count'] == 'Y' && $booShowShareCount == true) { $htmlShareButtons .= '<span class="ssba_sharecount">' . getPinterestShareCount($urlCurrentPage) . '</span>'; // add to our db updateSharedCount('pinterest', $urlCurrentPage); } // return share buttons return $htmlShareButtons; }
/** * Create Pinterest Share Button **/ function sssp_pinterest($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShareCount) { $var_btn_cls = $booShowShareCount ? 's3d pinterest' : 's3d pinterest no-counter'; // if using featured images for Pinteres if ($arrSettings['sssp_pinterest_featured'] == 'yes') { if (has_post_thumbnail($arrSettings['post_id'])) { // if this post has a featured image // get the featured image $urlPostThumb = wp_get_attachment_image_src(get_post_thumbnail_id($arrSettings['post_id']), 'full'); $urlPostThumb = $urlPostThumb[0]; } else { // no featured image set // use the pinterest default $urlPostThumb = $arrSettings['sssp_default_pinterest']; } } if (!empty($urlPostThumb)) { // pinterest share link $htmlShareButtons = '<a href="http://pinterest.com/pin/create/bookmarklet/?is_video=false&url=' . $urlCurrentPage . '&media=' . $urlPostThumb . '&description=' . $strPageTitle . '" class="' . $var_btn_cls . '" ' . ($arrSettings['sssp_share_new_window'] == 'yes' ? ' target="_blank" ' : NULL) . ($arrSettings['sssp_rel_nofollow'] == 'yes' ? ' rel="nofollow" ' : NULL) . '>'; } else { // not using featured images for pinterest // use the choice of pinnable images approach $htmlShareButtons = "<a class='" . $var_btn_cls . "' href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'>"; } $htmlShareButtons .= '<span><i class="fa fa-pinterest"></i></span>'; if ($booShowShareCount) { $htmlShareButtons .= '<span class="counter">' . number_format(getPinterestShareCount($urlCurrentPage)) . '</span>'; } $htmlShareButtons .= '</a>'; return $htmlShareButtons; }
function ssba_pinterest($arrSettings, $urlCurrentPage, $strPageTitle, $booShowShareCount) { // pinterest share link $htmlShareButtons = "<a class='ssba_pinterest_share' href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'>"; // if image set is not custom if ($arrSettings['ssba_image_set'] != 'custom') { // show ssba image $htmlShareButtons .= '<img src="' . WP_PLUGIN_URL . '/simple-share-buttons-adder/buttons/' . $arrSettings['ssba_image_set'] . '/pinterest.png" title="Pinterest" class="ssba" alt="Pin on Pinterest" />'; } else { // show custom image $htmlShareButtons .= '<img title="Pinterest" class="ssba" src="' . $arrSettings['ssba_custom_pinterest'] . '" alt="Pin on Pinterest" />'; } // close href $htmlShareButtons .= '</a>'; // if show share count is set to Y if ($arrSettings['ssba_show_share_count'] == 'Y' && $booShowShareCount == true) { $htmlShareButtons .= '<span class="ssba_sharecount">' . number_format(getPinterestShareCount($urlCurrentPage)) . '</span>'; } // return share buttons return $htmlShareButtons; }
} ?> <?php } ?> </div> <h1 class="story-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h1> <ul class="nav nav-align-right nav-interative-social"> <li class="hidden-xs social-share-count"><span><?php echo getRedditShareCount(get_permalink()) + getPinterestShareCount(get_permalink()) + getTwitterShareCount(get_permalink()) + getFacebookShareCount(get_permalink()); ?> </span> <b>Shares</b></li> <li class="social-fb"><a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?> " target='_blank'><span class="fa fa-facebook"></span><span class="hidden-xs"> like</span></a></li> <li class="social-twitter"><a href="https://twitter.com/intent/tweet?url=<?php the_permalink(); ?> " target='_blank'><span class="fa fa-twitter"></span><span class="hidden-xs"> tweet</span></a></li> <li class="social-reddit"><a href="http://www.reddit.com/submit?url=<?php the_permalink(); ?> " target='_blank'><span class="fa fa-reddit"></span><span class="hidden-xs"> submit</span></a></li> <li class="social-pinterest"><a href="http://www.pinterest.com/pin/create/button/?url=<?php