将一些代码挂在body标签后面


Hook some code after body tags

我正在写一个wp插件,我试图在正文后挂钩一些代码。我的代码在最顶端钩住,而不是在body标签之后。

我也试着回显下面所有的代码,但什么也没发生。

我代码:

<div id="fb-root"></div>
<script>
      window.fbAsyncInit = function() {
        FB.init({
          appId  : 'xxxxxx',
          status : true, 
          cookie : true, 
          xfbml  : true  
        });
      };
      (function() {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
    </script>
<script type="text/javascript">
FB.init({appId: "xxxxxxxx", status: true, cookie: true});
  function share_me() {
    FB.ui({
      method: 'feed',
      app_id: 'xxxxxxxxx',
      link: 'http://www.thesite.com',
      picture: 'http://www.thesite.com/image.gif',
      name: 'Pynchon''s Edge',
      caption: 'Amazing',
      description: 'The novel is due Fall 2013'
    },
    function(response){
      if(response && response.post_id) {
      }
      else {
      }
    });
  }
</script>
<?  
}
add_action('after_body', 'sb_fb');
do_action('after_body', 'sb_fb');

有什么建议吗?

replace

add_action('after_body', 'sb_fb');
do_action('after_body', 'sb_fb');

add_action('wp_footer', 'sb_fb');