-
AuthorPosts
-
January 13, 2014 at 5:18 pm #209049
Hi,
If I want to use facebook’s social media plug in that puts a comment box on my blog pages [of the site http://www.indiatrail.org] – how do I do that?
I have generated the code using facebook’s developer page and that’s ready. That asks me to insert that in to the page where I want the comments – not sure how to do that.
I’ve seen that you ask people to remove the following code from the Single.php page – can I just replace that text with the facebook code?
//wordpress function that loads the comments template “comments.php”
comments_template( ‘/includes/comments.php’);Thanks again!
Rohan
January 13, 2014 at 6:06 pm #209075Hey Rohan!
What is the facebook plugin that you use? Do the plugin use shortcodes? You can replace the comments code on single.php.
Regards,
IsmaelJanuary 13, 2014 at 6:08 pm #209076Hi Ismael,
I have two options:
1. Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.
<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_GB/all.js#xfbml=1&appId=526220487494071″;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>and
2. Place the code for your plugin wherever you want the plugin to appear on your page.
<div class=”fb-comments” data-href=”http://www.indiatrail.org/blog/” data-numposts=”5″ data-colorscheme=”light”></div>Which one shall I paste there?
Rohan
January 13, 2014 at 6:22 pm #209086Hey!
Edit header.php, find this code on line 117:
<body id="top" <?php body_class($style." ".$avia_config['font_stack']); ?>>
Below, add this code:
<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_GB/all.js#xfbml=1&appId=526220487494071"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
Edit single.php, find this code:
//wordpress function that loads the comments template "comments.php" comments_template( '/includes/comments.php');
Replace it with:
echo '<div class="fb-comments" data-href="http://www.indiatrail.org/blog/" data-numposts="5" data-colorscheme="light"></div>';
Best regards,
IsmaelJanuary 13, 2014 at 6:32 pm #209089Thanks Ismael,
However I can’t seem to find that line in the header.php file. The closest is:
<body id=”top” <?php body_class($style.” “.$avia_config[‘font_stack’].” “.$blank); avia_markup_helper(array(‘context’ => ‘body’)); ?>>
Do I paste it under that one?
Rohan
January 14, 2014 at 1:19 am #209261Hi Rohan!
Yes, after the body tag should do it.
Cheers!
JosueMarch 17, 2014 at 3:54 pm #238763Guys, I haven’t been able to figure out how to add a comments box after a post where the user can log in with his/ her facebook account and post comments.
March 19, 2014 at 3:36 am #239809 -
AuthorPosts
- The topic ‘Facebook Comment Box’ is closed to new replies.