Integrate Facebook comments

  • Anonymous

    #6264

    Hello everyone!

    After testing several plugins I decided to manually integrate the Facebook comments on my site (even though I know I’ll have to edit each new Graphene release).

    I modified the file header.php

    <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/it_IT/all.js#xfbml=1&appId=myFacebookAPPid";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <meta property="fb:admins" content="myFacebookID">

    Then I modified comments.php before <?php if ( have_comments() ) : ?> I entered:

    <div class="fb-comments" <?php echo get_permalink($post->ID); ?> data-num-posts="5" data-width="620"></div>

    It doesn’t work.

    “Warning: this plugin for comments is running in compatibility mode, but it still contains post. Try to specify an “href” explicit”

    If I insert href provided by Facebook (the address of my site) the comment is duplicated in all post.

    Can you help me?

    Maybe I should enter the second code somewhere else? (I tried to put it in single.php but the error remains the same).

    Thanks.

    (Sorry for my not perfect english).

    Mod

    Kenneth John Odle

    #33858

    Facebook code is tricky to integrate, and as soon as you figure it out, they change it on you.

    That said, you can probably achieve what you are trying to by using Graphene’s built-in options, rather than editing theme code. For example, there is an option to add code to the <head> portion of each page. There are also a number of action hook widget areas (including in the comment area, although you may want to add it elsewhere) that allow you to add code without hacking the theme.

    http://blog.kjodle.net/2011/11/04/graphene-action-hook-widgets-an-easy-way-to-modify-your-blog/

    If you hack the code, you may get where you want to be, but you may not understand why. Then, when the theme is updated, you won’t be able to reproduce the results. (This happened to Dr. Jekyll, and it has happened to me.)

    Try to see if you can integrate this code that way, and if it works any better for you.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.