WordPress.org

Ready to get started?Download WordPress

Forums

Facebook
Version 1.1.5 custom positioning of comments box does not work (6 posts)

  1. jbx
    Member
    Posted 1 year ago #

    On 1.0.2 I used to include the comments box where I wanted in the template with:

    if (comments_open() && isset($fb_ver) && ($fb_options = get_option('fb_options')) && isset($fb_options['comments']['enabled']))
                     echo fb_comments_automatic(''); ?>

    Now this does not work any more, and it only works if I explicitly choose the post or page checkbox, which displays it in the incorrect place.

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

  2. Niall Kennedy
    Member
    Plugin Author

    Posted 1 year ago #

    $fb_ver is gone. $facebook_loader exists as a global after the init action and may be used as an indicator the plugin has loaded. The comments box is considered "enabled" if it is selected for one or more post types. You may also interact with the facebook_comments_enabled option.

    The default behavior of comments box inclusion is as a filter to the_content, insertion of a div with HTML5 data-* attributes to be interpreted by the Facebook JavaScript SDK on initialization, and a noscript fallback. If you are writing custom code make sure the Facebook JavaScript SDK is still loaded so it may interpret the comments box element and your preferences.

    See Facebook_Comments::the_content_comments_box() and the Facebook_Comments class in general.

  3. jbx
    Member
    Posted 1 year ago #

    So whats the correct version of the code to include in a template if we want it to be where we want it rather than when Facebook thought it should be?!

    Please just include the replacement code rather than a lot of gibberish explanations. Its already bad enough that the latest changes are not backward compatible and not included in the release notes (apart from the hickups of the 1.1 updates!)

  4. Niall Kennedy
    Member
    Plugin Author

    Posted 1 year ago #

  5. jbx
    Member
    Posted 1 year ago #

    Yeah, but being Facebook, you could have at least documented that the change is not backward compatible any more with users who are using it in a certain way (which is how Facebook suggests btw)! Its the least you could have put in the release notes.

  6. jbx
    Member
    Posted 1 year ago #

    Can you at least confirm that this is the way to go if I have to put the comments box where I want (rather than exactly at the end of the article content)?

    $options = get_option( 'facebook_comments' );
     if (is_array( $options ) && !empty($options))
     {
         $url = apply_filters( 'facebook_rel_canonical', get_permalink() );
         if ($url)
            $options['href'] = $url;
         echo Facebook_Comments::js_sdk_markup( $options );
     }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags