There are advantages of installing Facebook comments manually rather than simply installing a plugin.
Some of these benefits are:
- Use of theme specific and WordPress hooks to determine the exact position you want the FB comment form to display.
- Customization of the Facebook comments plugin code.
There’s a few steps involved including:
- Create a Facebook Developers App
- Get code snippets
- Enqueue and hook in script
Once you’ve created a new app, you can then grab the code.
The first code snippet goes in a new .js file which i named fb-comments.js and placed in a new folder named js in the child themes root directory.
The second snippet is added to a custom function and hooked into place using the WordPress comments_form hook or a theme specific hook position like genesis_comments_form.
You’ll also need to enqueue the script which you can see in the code snippets below.
Here’s all the code:
The 2nd code block contains 2 snippets. The 1st to enqueue the fb-comments.js script and the 2nd to hook in the Facebook comments form.
Here’s a few links which enable you to install Facebook comments using plugins or code in themes like Genesis which provide boxes for scripts.
Leave a Reply
You must be logged in to post a comment.