Question

I've created a Facebook share button using the auto generated code from https://developers.facebook.com/docs/plugins/share-button

I'm trying to make it share pages from a WordPress page I'm working on. For some reason, when I try to share the website's homepage, I just get a blank popup box and nothing loads. If I try to share any page from the site other than the homepage the popup works and I can share the page. I've also checked the home page in the Facebook debugger and it scrapes all of the data from the page fine.

I'm thinking that it might be some issue with the way WordPress handles the url of static front pages but I can't be sure. Any insight on this issue would be very helpful.

Was it helpful?

Solution 2

Upon later inspection and chance circumstances, I found an extremely easy solution to this problem. In the code for the share button I used:

<div class="fb-share-button" data-href="http://mywebsite.org/index.php" data-type="button">

Changing the data-href link to my website's homepage to include "/index.php" did the trick. I had tried webpage.com/index but not index.php but it is working now. If anyone has the same problem I would suggest trying that.

OTHER TIPS

I could not understand you much but i am assuming that when you try to share your home page in Facebook then it is showing only blank box.

If this is the problem then it might be possible that you do not have a meta description and title for your homepage.

- Using this you can set the image that will be shown in the Facebook. Beside this for Title:

and use this tools https://developers.facebook.com/tools/debug

Hope this help.

Edit:

<div class="fb-share-button" data-href="<?php the_permalink(); ?>" data-type="button_count"></div>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top