• I have just installed and configured the plugin ‘Facebook’, using it solely to get the ‘Comment using Facebook’ feature. I know I could do this with other plugins, but I would like to use this specific one, not only because it is official, but also because it provides Insights that the other ‘Facebook comment’ plugins don’t.

    The problem I am facing is that the comment box appears at the end of the post, instead of appearing at the comment section that is there specifically for articles.

    Article structure example (with the plugin enabled):

    Article Title
    --------------------------
    Article Body
    ...
    ...
    ...
    --------------------------
    Facebook Comments
    --------------------------
    Share box
    --------------------------
    Comment area (empty)
    --------------------------
    <- Previous [Post] Next ->

    I’am quite a rookie when it comes to wordpress plugins, I would be able to change the comment location if I found out how the hooks work and I realise that it’s as easy as changing code from one div to another.

    How can I move the ‘Facebook Comment’ interface to the comment area?

    Thanks in advance 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • +1 for this. I’ve been trying to use remove_filter(); and add_filter(); for the better part of the last hour to move everything but it simply isn’t working. Some help?

    Nevermind, I figured it out.

    In functions.php:

    /**
     * Move FB Comments to own DIV.
     */
    
    add_action('init', 'move_fb_comments');
    
    function move_fb_comments() {
        remove_filter( 'the_content', 'fb_comments_automatic', 30 );
        add_filter( 'comment_form_before', 'fb_comments_automatic', 30);
    }

    Then, where-ever you want to put the comment form:
    <?php echo apply_filters('comment_form_before', $post->post_content); ?>

    I have no idea if this is even slightly-sane WordPress code, but it works for me.

    Apparently the code I posted an hour ago causes the content to repeat twice. Try this instead:

    /**
     * Move FB Comments to own DIV.
     */
    
    add_action('init', 'move_fb_comments');
    
    function hook_fb_comments_form() {
        do_action('the_fb_comment_form');
    }
    
    function move_fb_comments() {
        remove_filter( 'the_content', 'fb_comments_automatic', 30 );
        add_filter( 'the_fb_comment_form', 'fb_comments_automatic', 30);
    }

    And then, where you want the box:

    <?php echo apply_filters('the_fb_comment_form', NULL); ?>

    Hope this saves somebody the several frustrating hours I just had…

    The filters changed last update; the above code should now be:


    /**
    * Move FB Comments to own DIV.
    */

    add_action('wp', 'move_fb_comments', 999999);

    function hook_fb_comments_form() {
    do_action('the_fb_comment_form');
    }

    function move_fb_comments() {
    $priority = apply_filters( 'facebook_content_filter_priority', 30 );
    remove_filter( 'the_content', 'Facebook_Comments::the_content_comments_box', $priority);
    add_filter( 'the_fb_comment_form', 'Facebook_Comments::the_content_comments_box', 30);
    }

    awesome! only still repeats with the last update of your script

    change the remove_filter to:
    remove_filter( 'the_content', array( 'Facebook_Comments', 'the_content_comments_box' ), $priority );

    i am trying to use this code but I have
    Fatal error: Call to undefined function add_action() in /data/var/www/localhost/htdocs/blague/wp-includes/functions.php on line 3849

    What I am doing wrong ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Facebook] Moving the comment box’ is closed to new replies.