Support » Plugin: Facebook » [Plugin: Facebook] Comments outside the_content

  • Resolved Pancho Perez

    (@lonchbox)


    Hi,

    Thanx for develop this plugin, but have something very annoying the comments only show under the_content, inserted.
    Itยดs posible to take them out? In my design I want the comments in the side fo the content not under and donยดt like to move them with css, preferred something like
    <?php facebook_comments() ?>

    ๐Ÿ™‚

    http://wordpress.org/extend/plugins/facebook/

Viewing 13 replies - 1 through 13 (of 13 total)
  • I found a good solutions here:

    Just copy to your functions.php this:
    remove_action( 'init', 'fb_apply_filters' )

    And can show the comments using this other in any part of the theme:
    <?php if (comments_open() && isset($fb_ver) && isset($options['comments']['enabled'])) echo fb_comments_automatic(''); ?>

    In my personal case the full code not work so I only use this:
    <?php echo fb_comments_automatic(''); ?>
    And works

    Good luck ๐Ÿ™‚

    AMAZING!!! Thank you thank you thank you

    @buymylife Good this help you ๐Ÿ™‚

    But now Iยดm having a problem related to this hack, removing the action of fb_apply_filters also affects the like button, and now I have to find a way to keep that hack and show the like button ๐Ÿ˜›

    hey I find a way, just insert this in your single.php:

    <?php echo fb_like_button_automatic(''); ?>

    And then is possible to add like button in the position you want ๐Ÿ™‚ but seams the options for the like button doesnยดt work at all when it insert the like button with this call ๐Ÿ™

    Thanks for posting this, Pancho. It was exactly what I was looking for.

    @lonchbox – I found a cleaner way that only affects the FB comments (and doesn’t disturb the other elements… like buttons, etc.)

    First, from the Codex…

    It is also worth noting that you may need to prioritise the removal of the filter to a hook that occurs after the filter is added. You cannot successfully remove the filter before it has been added.

    The trick is to add a new action hook that occurs after init — so I just chose wp_head, but there is a list of other action hooks you could use.

    Here is my code.

    add_action( 'wp_head', 'fix_fb_comment_placement' );
    function fix_fb_comment_placement() {
    	remove_filter('the_content', 'fb_comments_automatic', 30);
    }

    Then, in your comments.php file (or wherever you want the comments to show up, include this line of code:
    <?php echo fb_comments_automatic(''); ?>

    hey @nickd32, I give a try, thanx ๐Ÿ™‚

    nickd32

    (@nickd32)

    Note that this solution doesn’t work in the new version (1.1.8) of the plugin, as the ‘fb_comments_automatic’ filter has been removed from the plugin.

    nickd32

    (@nickd32)

    OK, here’s my new fix. This gets a little more tricky, since now the comment code is in a separate PHP class.

    Place this in your functions.php file:

    add_action( 'wp_head', 'fix_fb_comment_placement' );
    function fix_fb_comment_placement() {
    	$priority = apply_filters( 'facebook_content_filter_priority', 30 );
    	remove_filter( 'the_content', array( 'Facebook_Comments', 'the_content_comments_box' ), $priority );
    }

    Place this inside your comments.php file (or wherever you want the FB comments box to go…)

    <?php //Added for Official FB plugin
        $fb_comments = new Facebook_Comments();
        echo $fb_comments->the_content_comments_box();
    ?>

    I decided to turn comments on/off based on whether regular WP comments were on for a particular post:

    <?php if ( comments_open() ) {
        //Added for Official FB plugin
        $fb_comments = new Facebook_Comments();
        echo $fb_comments->the_content_comments_box();
    } ?>

    artabria

    (@artabria)

    Trying your code in my blog; this is WordPress’ response ->

    Warning: Missing argument 1 for Facebook_Comments::the_content_comments_box(), called in /wp-content/themes/Web-Site-Name-2012-01-18-235702/single.php on line 79 and defined in /wp-content/plugins/facebook/social-plugins/class-facebook-comments.php on line 438

    @rickd32 thanx for the new code for the update fo the plugin ๐Ÿ™‚ I give a try soon.

    got the same error! what to do :(?

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Create your own thread on the issue, Tatof. Otherwise it’s difficult for forum volunteers to track down who’s having which problem.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Plugin: Facebook] Comments outside the_content’ is closed to new replies.