I have been searching the web for ways to make a custom share button for my wordpress site posts.
1 – So I have my own image “share” file.
2 – Pasted this code in the tag:
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'myNumber',
xfbml : true,
version : 'v2.0'
});
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$('.btnShare').click(function(){
elem = $(this);
postToFeed(elem.data('title'), elem.data('desc'), elem.prop('href'), elem.data('image'));
return false;
});
</script>
3 – on my single.php page I added this line:
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" title="Share on Facebook." target="_blank">SHARE</a>
The problem is that it opens a normal window and not the regular small pop-up window that facebook usually has.
Can someone help me fix this?
If you have any good tutorials how to add a custom Facebook button without any trouble I’ll be happy to start all over.
(no wordpress plugins pls..)
TNX,
Hatzil666.
Try this:
Modify the width, height, scrollbars etc within the options