Reputation: 3288
This is how I render my button:
function fb_share() {
$permalink = get_permalink();
echo '<div class="fb-share-button" data-href="'.$permalink.'" data-layout="button_count"></div>';
}
I include the scripts right after tag opens. However, what it does when you click share is:
Any thoughts?
Upvotes: 0
Views: 1996
Reputation: 3288
The problem arises because I have been testing my theme using MAMP and having the string "localhost" in the browser URL. As @dustincaruso mentioned:
<div class="fb-share-button" data-href="<?php the_permalink(); ?>" data-layout="button_count"></div>
works perfectly. Thanks.
Upvotes: 0
Reputation: 109
Try this code directly in the PHP/HTML markup of your theme. It will create a link to the current page/URL in the "data-href" attribute.
<div class="fb-share-button" data-href="<?php the_permalink(); ?>" data-layout="button_count"></div>
Upvotes: 1