lundi 2 mars 2015

Facebook share sharing frontpage on Wordpress website with Ajax Loader

I'm experiencing problems with my Facebook Share function in Wordpress. Up until the latest update everything worked fine but now, when a new post is added to the website, Facebook Share always wants the share the frontpage - Untill I run the Facebook Debugger.


The current setup uses Wordpress Ajax Loader to load the different pages and posts. Twitter share, Google Plus share and Pinterest work fine.


In my header.php i load following FB javascript straight after the tag:



<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/nl_NL/sdk.js#xfbml=1&appId=390609237745022&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


In the post I use following code to load the share button:



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


The issue can be viewed here: http://ift.tt/1GI29ob when clicking the Facebook "F".


I tried FB.XFBML.parse(); to reload the content, but that doesn't seem to be the issue here. I searched for different solutions, but to no avail.


Aucun commentaire:

Enregistrer un commentaire