Last active
October 2, 2017 06:48
-
-
Save mypacecreator/e8e3cd1bb0e8b30a6b394882a7556bb2 to your computer and use it in GitHub Desktop.
シェア系ボタンを自作し、数値はSNS Count Cacheプラグインから出力&自力でHTTP時のいいね数を合算
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if( function_exists( 'scc_get_share_facebook' ) ){ | |
$https_count = scc_get_share_facebook(); | |
$http_count = get_post_meta( get_the_ID(), 'scc_http_count_facebook', true ); | |
$total_count = $https_count + $http_count; | |
} ?> | |
<div class="social-buttons"> | |
<a href="https://twitter.com/share?url=<?php echo esc_url( get_the_permalink() ); ?>&text=<?php echo urlencode( get_the_title() . ' | ' . get_bloginfo( 'name' ) ); ?>" rel="nofollow" onclick="window.open(this.href, 'tweetwindow', 'width=650, height=470, personalbar=0, toolbar=0, scrollbars=1, sizable=1'); return false;" class="social-btn twitter"> | |
<i class="fa fa-twitter"></i>ツイート | |
</a> | |
<a href="https://plus.google.com/share?url=<?php echo esc_url( get_the_permalink() ); ?>" rel="nofollow" class="social-btn gplus"> | |
<i class="fa fa-google-plus"></i> | |
</a> | |
<a href="https://b.hatena.ne.jp/add?mode=confirm&url=<?php echo esc_url( get_the_permalink() ); ?>" rel="nofollow" class="social-btn hatebu"> | |
<strong>B!</strong> <?php if( function_exists( 'scc_get_share_hatebu' ) ){ echo scc_get_share_hatebu(); } ?> | |
</a> | |
<a href="https://getpocket.com/edit?url=<?php echo esc_url( get_the_permalink() ); ?>&title=<?php echo urlencode( get_the_title() ); ?> | <?php bloginfo('name'); ?>" rel="nofollow" onclick="javascript:window.open( encodeURI( decodeURI( this.href ) ), 'pkwindow', 'width=600, height=600, personalbar=0, toolbar=0, scrollbars=1' );return false;" class="social-btn pocket"> | |
<i class="fa fa-get-pocket"></i>Pocket <?php if( function_exists('scc_get_share_pocket')){ echo scc_get_share_pocket(); } ?> | |
</a> | |
<a href="https://line.me/R/msg/text/?<?php echo urlencode( get_the_title() ); ?> | <?php bloginfo( 'name' ); ?> <?php echo esc_url( get_the_permalink() ); ?>" rel="nofollow" class="social-btn line"> | |
<strong>LINEで送る</strong> | |
</a> | |
<a href="https://www.facebook.com/sharer.php?src=bm&u=<?php echo esc_url( get_the_permalink() ); ?>" rel="nofollow" class="social-btn fb-share"> | |
<i class="fa fa-facebook"></i>シェア <?php if( function_exists( 'scc_get_share_facebook' ) ){ echo esc_html( $total_count ); } ?> | |
</a> | |
<div class="fb-like" data-href="<?php echo esc_url( get_the_permalink() ); ?>" data-layout="button" data-action="like" data-size="small" data-show-faces="false" data-share="false"></div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment