Can I Change Ultimate Facebook Code Placement Please?

I have had a few issues today with the Ultimate Facebook plugin, so I went to work on figuring out why some things weren't working the way they should. Having developed countless Facebook websites and blogs that exchange data with Facebook so reading Facebook documentation has become a regular habit.

When I started scanning the coding for Ultimate Facebook plugin I discovered that the plugin does 2 things that go against Facebook guidelines and recommendation.

1. The call for the all.js (javascript) in the header but it should be right down at the bottom of the code.

2. The inclusion of the all.js and the APP ID number (etc) is being used prior to 'get_footer' but it should be the last bit of code before </body>

I included the code in the right place and a few of my issues resolved themselves (I'll post about outstanding issues in a separate post) so I thought I would draw your attention to what Facebook say is the correct way this should be done.

While my 'workaround' works in a bit of a hacked way, is it possible to move the location of these bits of code in your plugin code? I'm not afraid to dive in and get my hands dirty with the code but I don't want to mess anything up.

Thanks.

Martin

  • DavidM
    • DEV MAN’s Mascot

    Hi Martin,

    Many thanks for all your detailed feedback on this. I'm not really sure if maybe things were done specifically this way due to the way WordPress works. The developer would know that best though. I'll ask him to take a look at this.

    Cheers,
    David

  • Vladislav
    • Dead Eye Dev

    Hi,

    Thank you very much for the input about this. As far as I know, placement of "all.js" shouldn't matter at all (the script is just loaded, but not initialized until the FB.init call). However, I do see your point about fb-root div and FB.init call. The reason we're binding this output to "get_footer" hook specifically is that this particular hook will most likely be implemented in most themes, whereas some other hooks that come later in the execution cycle may not be.

    Also, I would love to learn more about the issues you encountered with the default setup that got solved with your approach. The more different experiences and approaches I learn about, the better :slight_smile:

  • Martin Koss
    • The Incredible Code Injector

    Not sure. I stopped using it on multisites for now.
    It does work, but another snippet of code needs adding to themes manually in order for it to be consistent with FB guidelines.

    I keep coming back to it and trying to work out how to move the position of the code added by the plugin and then it would be perfect.

    Martin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.