-
AuthorPosts
-
May 2, 2014 at 10:29 am #259284
Dear all,
I tried to add the code snippet (provided by fb), into comments.php. It works, but unfortunately I can’t find the proper location in order not to show facebook comments WHEN the comment function ist set to “closed” for individual posts or pages.
Can anybody help? Guess, it should be possible.
Best regards
FrankMay 2, 2014 at 4:53 pm #259487Hi omnyss!
Unfortunately that isn’t something that we can help you from theme support. It would be up to the plugin or maybe some custom code to do a conditional check on if the theme comments are open or closed and then to output or not the plugins comments.
Regards,
DevinMay 2, 2014 at 7:43 pm #259530Hi Devin,
Actually I guess the only thing I need to do is to find the proper location in comments.php where the standard comments are shown or not, depending on the settings for the particular post. There the fb snippet needs to be added. It works fine with other themes. I just can’t identify the place where to insert. :-)
FrankMay 2, 2014 at 10:45 pm #259557Hey Frank!
Check includes/comments.php.
Best regards,
JosueMay 3, 2014 at 2:17 pm #259682Hey Josue!
I did :-) My problem is where shall I add the facebook snippet for fb-comments?
I can’t find the proper location.BR Frank
May 4, 2014 at 6:08 am #259875Hi!
Thank you for using the theme.
As Devin stated, we can’t help you with third party scripts or snippets because that is beyond the scope of support as stated on our policy but if you can provide the reference link for the facebook snippet and the actual code itself. It will be easier for us to direct you on where to place the code. In other words, please help us to help you. :)
Cheers!
IsmaelMay 4, 2014 at 8:51 am #259899Let’s make it simple. :-) but not short.
What I want is this:
If comments are enabled for a post the standard comment area will added at the end of the post.
If comments are disabled for a post the standard comment area will not be added at the end of the post.
This is a standard WordPress function. Right?But what, if I want to use Facebook comments as well and not instead of standard comments?
Then it should be handled like this:
If comments are enabled for a post I want to show the facebook comment box as well (snippet see below).
If comments are disabled for a post I don’t want to show the facebook comment box.It makes sence, because once the author disables comments for one post, this should also disable the FB comments. Right?
This works fine with many of our blogs, using other themes.
So what we need to do – as defined by facebook – is to add the following snippets:
1st snippet:
<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/de_DE/sdk.js#xfbml=1&appId=xxxxxxxxxxxxxxxx&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
This is added in header.php. It works fine.
A 2nd snippet needs to be placed at the place where we want to show the fb-comment box. And that’s now my question: WHERE?
<div class="fb-comments" data-href="<?php the_permalink(); ?>" data-width data-mobile=”auto-detect” data-numposts="20" data-colorscheme="light"></div>
This I also tried with enfold theme at different locations in /includes/comments.php. The fb comments will be shown. It works in general, but not like I want ist (see above). If I disable comments for post, the fb comments are still shown. As mentioned above: this is not what I want. :-)
So, I’m looking just for the proper location in /includes/comments.php wher to add the snippet in order to fulfill my demand. And that question seems to be related to the theme. My idea works fine for example with avada theme and twentyfourteen.
That’s all I want.
Best regards
FrankMay 4, 2014 at 10:35 pm #260016Hi Frank!
Try putting the fb code right here (includes/comments.php):
Worked for me on my local install.
Cheers!
JosueMay 5, 2014 at 1:05 pm #260211Premium theme. Premium support. I like it! :-)
Thanks a lot.BR Frank
-
AuthorPosts
- The topic ‘Facebook Comments – don't show if comments are closed for individual posts’ is closed to new replies.