我正在尝试添加facebook share
my的功能wordpress
职位。在我的wp loop
我有一个共享按钮
<a class="action_button" href="javascript:void(0)" id="share_button" target="_blank"> share this</a>
我不想post title ,post thumpnail
等等。我的代码有什么问题。在开始循环之前,我有如下javascript代码
<script>
window.fbAsyncInit = function() {
FB.init({appId: \'myappid\', status: false, cookie: false, xfbml: false});
};
(function() {
var e = document.createElement(\'script\'); e.async = true;
e.src = document.location.protocol + \'//connect.facebook.net/en_US/all.js\';
document.getElementById(\'fb-root\').appendChild(e);
}());
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(\'#share_button\').click(function(e){
e.preventDefault();
FB.ui(
{
method: \'feed\',
name: \' <?php echo get_the_title(); ?>\',
link: \' <?php echo get_permalink(); ?>\',
picture: \'<?php echo get_the_post_thumbnail();?>\',
caption: \'This is the content of the "caption" field.\',
description: \'This is the content of the "description" field, below the caption.\',
message: \'\'
});
});
});
</script>