Facebook comments box on front page

Fast ‘n’ Hacky

The problem can be solved by changing line 319 in facebook.php to the following:

if (is_home()) {

This way, the front page is not treated as a home page but as a regular page, for which the facebook feature settings can be applied (and will be handled correctly).


More Elegant/Complex

Here is a non-hackish version. Put the following in your functions.php:

add_action('template_redirect', 'force_facebook_comments');
function force_facebook_comments() {
    if (is_front_page()) {
        $features = get_option('facebook_home_features');
        $features['comments'] = true;
        update_option('facebook_home_features', $features);
        add_filter('comments_template', array('Facebook_Comments', 'comments_template'));
    }
    // If you want to handle the 'home' page differently, undo the above stuff
    // elseif (is_home()) {
        // $features = get_option('facebook_home_features');
        // $features['comments'] = false;
        // update_option('facebook_home_features', $features);
        // remove_filter('comments_template', array('Facebook_Comments', 'comments_template'));
    // }
}

Leave a Comment