Created
February 4, 2012 08:45
-
-
Save msng/1736439 to your computer and use it in GitHub Desktop.
WordPress の個別記事にはてブと Google+ と Twitter と Facebook「いいね!」のボタンを出すサンプル
This file contains hidden or 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
<!-- | |
・できれば <body> タグの直後に置く | |
・日本語ボタンを出すなら en_US を ja_JP にする | |
・アプリケーションIDをつける場合は、xfbml=1 の後に | |
&appId=[Facebookで取得するアプリケーションID: https://developers.facebook.com/apps ] | |
をつける | |
--> | |
<div id="fb-root"></div> | |
<script>(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; | |
js = d.createElement(s); js.id = id; | |
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk'));</script> | |
<!-- ボタンを表示させたい場所に置く --> | |
<div style="overflow: hidden;"> | |
<div style="float: left;"><a href="http://b.hatena.ne.jp/entry/<?php echo get_permalink(); ?>" class="hatena-bookmark-button" data-hatena-bookmark-title="<?php echo htmlspecialchars(the_title('', '', false)); ?>" data-hatena-bookmark-layout="vertical" title="このエントリーをはてなブックマークに追加"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" /></a></div> | |
<div style="float: left; margin-left: 15px;"><g:plusone size="tall" href="<?php echo get_permalink(); ?>"></g:plusone></div> | |
<div style="float: left; margin-left: 15px;"><a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-text="<?php echo htmlspecialchars(the_title('', '', false)); ?>" data-count="vertical" data-via="【ここに Twitter のスクリーンネーム】" data-lang="en">Tweet</a></div> | |
<div style="float: left; margin-left: 15px;" class="fb-like" data-href="<?php echo get_permalink(); ?>" data-send="false" data-layout="box_count" data-show-faces="false"></div> | |
</div> | |
<!-- </body> タグの直前に置く --> | |
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> | |
<script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script> | |
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment