Site logo

Archived topic

Embedding facebook image posts

14 replies · Started by Anonymous on October 26, 2015

Viewing posts 1–15 of 15

Using the Embed Post button, I got the code to an image post I want to embed on my site. However, when I put the code on a page, only the text shows up, not the image. Is there a global setting that is preventing this in the theme?
Code of image post
Outcome on page

Hmm, nothing in the theme preventing this, but the WP editor may be stripping something important.

Can you link me to the page where the image isn't showing up?

What if you add this code to the wp_footer hook in GP Hooks?

<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/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

Then add this part to your post:

<div class="fb-post" data-href="YOUR_URL_HERE"></div>

Sometimes the WP editor strips out <script> tags.

Let me know :)

Hi Tom,

Having issues with this same problem, Ive copied, then edited the html (below) from the facebook developer page to footer widget 5 , which is where i want the feed to be.

<div class="fb-page"><blockquote cite="https://www.facebook.com/facebook"><a href="https://www.facebook.com/facebook">Facebook</a></blockquote></div>

Then copied the JS SDK script into wp_footer as you have sugested . Its not presenting anything so a little confused, can you help please?

Cheers

Hi there,

Did you add that code into a HTML widget?

Any console errors if you right click + inspect the page?

Hi Tom,

Yes i added the custom HTML code to footer widget 5 (can it go there?). I cannot see any errors but nothing comes up unless it is either hidden or.

No console errors.

Where am i going wrong?

Can you link me to your site?

Hmm, nothing is standing out to me really.

What's the script you pasted into wp_footer?

Hi Tom,

Ive pulled the script from https://developers.facebook.com/docs/plugins/page-plugin/

<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 = 'https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v3.0';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Would this be correct?

Thanks

Hi Stefan, i can't see any issue with the code but there is definitely no HTML in that widget.
Can you test the HTML code somewhere else on the page? Try adding it via an Elementor HTML Widget in the page.

Hi David/Tom

Ive nailed the issue, seems that it could be something wrong with the Facebook page. Ive put in some other random Facebook companies and it works fine in the footer widgets, also using the elementor html widget. So its a specific issue to the one i want to use.

Frustrating.. very sorry!

Cheers
Stefan

Hi Stefan, glad you found out what the problem is.

This archived topic is closed to new replies.