Rick Smith
Rick Smith

Reputation: 1241

How do I get Facebook Open graph / social (like box) to work correctly on my site?

I thought I had everything set up correctly with my open graph / facebook app settings on my site, but it looks like there are still problems. I just ran my site through the debugger and here is what I'm getting. I can't figure out what is causing these errors.

/* ------------------------- Actions --------------------------- */

add_action('wp_head', 'wpse_43672_wp_head', 0);
/**
 * Hooks into the `wp_head` action.
 * @link http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
*/
function wpse_43672_wp_head(){ 
?> 

<script type='text/javascript'> 
(function(){ 
var bsa = document.createElement('script'); 
bsa.type = 'text/javascript'; 
bsa.async = true; 
bsa.src = '//cdn.beaconads.com/ac/beaconads.js'; 
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa); 
})(); 

</script> 

<div id="fb-root"></div>

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'Y 11111111', // App ID
      channelUrl : '//WWW.url.com/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>

<?php 
            }

Upvotes: 1

Views: 282

Answers (1)

Yan Berk
Yan Berk

Reputation: 14428

You have two </head> tags in the HTML.

Upvotes: 1

Related Questions