WordPress.org

Ready to get started?Download WordPress

Forums

Facebook
[resolved] [closed] Comments outside the_content (14 posts)

  1. lonchbox
    Member
    Posted 1 year ago #

    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/

  2. lonchbox
    Member
    Posted 1 year ago #

  3. buymylife
    Member
    Posted 1 year ago #

    AMAZING!!! Thank you thank you thank you

  4. lonchbox
    Member
    Posted 1 year ago #

    @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 :P

  5. lonchbox
    Member
    Posted 1 year ago #

    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 :(

  6. sc456a
    Member
    Posted 1 year ago #

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

  7. nickd32
    Member
    Posted 1 year ago #

    @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(''); ?>

  8. lonchbox
    Member
    Posted 1 year ago #

    hey @nickd32, I give a try, thanx :)

  9. nickd32
    Member
    Posted 1 year ago #

    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.

  10. nickd32
    Member
    Posted 1 year ago #

    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();
    } ?>
  11. artabria
    Member
    Posted 1 year ago #

    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

  12. lonchbox
    Member
    Posted 1 year ago #

    @rickd32 thanx for the new code for the update fo the plugin :) I give a try soon.

  13. tatof
    Member
    Posted 1 year ago #

    got the same error! what to do :(?

  14. Andrew Nevins
    Spam zapper & Volunteer Moderator
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic