Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #25939

    Hello,

    I’ve searched the forum, but I haven’t found an answer so far. I have the Facebook comments plugin on my website and it shows all the replies and likes. However, I would like the comment counter beneath the blog title to show the number of Facebook comments.

    Is that possible?

    Thanks in advance!!

    #128732

    It depends on the plugin. Enfold does not support the facebook comments counter and will just use the default wordpress function. However if the plugin comes with a function which allows you to display the facebook comments you can replace/modify following code in includes/loop-index.php:

    if ( get_comments_number() != "0" || comments_open() ){

    echo "<span class='comment-container minor-meta'>";
    comments_popup_link( "0 ".__('Comments','avia_framework'),
    "1 ".__('Comment' ,'avia_framework'),
    "% ".__('Comments','avia_framework'),'comments-link',
    "".__('Comments Disabled','avia_framework'));
    echo "</span>";
    echo "<span class='text-sep'>/</span>";
    }

    to display the facebook comments counter.

    #128733

    Hey Dude,

    thanks for your reply. I found the following code, which I tried to put in the above lines of code, but it keeps breaking. I don’t know too much of php, so I was hoping if you could tell me how to modify the code with the code below.

    <fb:comments-count href=”<?php echo get_permalink($post->ID); ?>”></fb:comments-count> Comments

    I’m really hoping you can help me out!!!! Thanks in advance!!

    #128734

    Hi,

    What is the name of the plugin you’re using? Where did you get the code?

    Regards,

    Ismael

    #128735

    Hello Ismael,

    the name of the plugin is “Facebook Comments”

    I got the code from the file “facebook-comments-plugin/class-frontend.php” See below:

    <?php

    //ADD XFBML

    add_filter('language_attributes', 'fbcomments_schema');

    function fbcomments_schema($attr) {

    $options = get_option('fbcomments');

    if (!isset($options)) {$options = "";}

    if (!isset($options)) {$options = "";}

    if ($options == 'on') {$attr .= "n xmlns:og="http://ogp.me/ns#"";}

    if ($options == 'on') {$attr .= "n xmlns:fb="http://ogp.me/ns/fb#"";}

    return $attr;

    }

    //ADD OPEN GRAPH META

    function fbgraphinfo() {

    $options = get_option('fbcomments'); ?>

    <meta property="fb:app_id" content="<?php echo $options; ?>"/>

    <meta property="fb:admins" content="<?php echo $options; ?>"/>

    <?php

    }

    add_action('wp_head', 'fbgraphinfo');

    function fbmlsetup() {

    $options = get_option('fbcomments');

    if (!isset($options)) {$options = "";}

    if ($options == 'on') {

    ?>

    <!-- Facebook Comments for WordPress: http://3doordigital.com/wordpress/plugins/facebook-comments/ -->

    <div id="fb-root"></div>

    <script>(function(d, s, id) {

    var js, fjs = d.getElementsByTagName(s)[0];

    if (d.getElementById(id)) return;

    js = d.createElement(s); js.id = id;

    js.src = "//connect.facebook.net/<?php echo $options; ?>/all.js#xfbml=1&appId=<?php echo $options; ?>";

    fjs.parentNode.insertBefore(js, fjs);

    }(document, 'script', 'facebook-jssdk'));</script>

    <?php }}

    add_action('wp_footer', 'fbmlsetup', 100);

    //COMMENT BOX

    function fbcommentbox($content) {

    $options = get_option('fbcomments');

    if (!isset($options)) {$options = "off";}

    if (!isset($options)) {$options = "off";}

    if (!isset($options)) {$options = "off";}

    if (!isset($options)) {$options = "off";}

    if (!isset($options)) {$options = "off";}

    if (!isset($options)) {$options = "off";}

    if (

    (is_single() && $options == 'on') ||

    (is_page() && $options == 'on') ||

    ((is_home() || is_front_page()) && $options == 'on')) {

    if ($options == 'on') {

    if ($options == '') {

    $commentcount = "<p>";

    } else {

    $commentcount = "<p class="".$options."">";

    }

    $commentcount .= "<fb:comments-count href=".get_permalink()."></fb:comments-count> ".$options."</p>";

    }

    if ($options != '') {

    if ($options == '') {

    $commenttitle = "<h3>";

    } else {

    $commenttitle = "<h3 class="".$options."">";

    }

    $commenttitle .= $options."</h3>";

    }

    $content .= "<!-- Facebook Comments for WordPress: http://3doordigital.com/wordpress/plugins/facebook-comments/ -->".$commenttitle.$commentcount;

    if ($options == 'on') {

    $content .= "<div class="fb-comments" data-href="".get_permalink()."" data-num-posts="".$options."" data-width="".$options."" data-colorscheme="".$options.""></div>";

    } else {

    $content .= "<fb:comments href="".get_permalink()."" num_posts="".$options."" width="".$options."" colorscheme="".$options.""></fb:comments>";

    }

    if ($options != 'no') {

    if ($options != 'off') {

    if (empty($fbcomments[linklove])) {

    $content .= '<p>Powered by Facebook Comments</p>';

    }}}

    }

    return $content;

    }

    add_filter ('the_content', 'fbcommentbox', 100);

    function fbcommentshortcode($fbatts) {

    extract(shortcode_atts(array(

    "fbcomments" => get_option('fbcomments'),

    "url" => get_permalink(),

    ), $fbatts));

    if (!empty($fbatts)) {

    foreach ($fbatts as $key => $option)

    $fbcomments[$key] = $option;

    }

    if ($fbcomments[count] == 'on') {

    if ($fbcomments[countstyle] == '') {

    $commentcount = "<p>";

    } else {

    $commentcount = "<p class="".$fbcomments[countstyle]."">";

    }

    $commentcount .= "<fb:comments-count href=".$url."></fb:comments-count> ".$fbcomments[countmsg]."</p>";

    }

    if ($fbcomments[title] != '') {

    if ($fbcomments[titleclass] == '') {

    $commenttitle = "<h3>";

    } else {

    $commenttitle = "<h3 class="".$fbcomments[titleclass]."">";

    }

    $commenttitle .= $fbcomments[title]."</h3>";

    }

    $fbcommentbox = "<!-- Facebook Comments for WordPress: http://3doordigital.com/wordpress/plugins/facebook-comments/ -->".$commenttitle.$commentcount;

    if ($fbcomments[html5] == 'on') {

    $fbcommentbox .= "<div class="fb-comments" data-href="".$url."" data-num-posts="".$fbcomments[num]."" data-width="".$fbcomments[width]."" data-colorscheme="".$fbcomments[scheme].""></div>";

    } else {

    $fbcommentbox .= "<fb:comments href="".$url."" num_posts="".$fbcomments[num]."" width="".$fbcomments[width]."" colorscheme="".$fbcomments[scheme].""></fb:comments>";

    }

    if (!empty($fbcomments[linklove])) {

    $fbcommentbox .= '<p>Powered by Facebook Comments</p>';

    }

    return $fbcommentbox;

    }

    add_filter('widget_text', 'do_shortcode');

    add_shortcode('fbcomments', 'fbcommentshortcode');

    ?>

    #128736

    Hi connepon,

    The best point of contact would be the plugin author. Being not familiar with the code and how it works there isn’t much we can do other than pointing to where the plugin code could be inserted into the theme files.

    If there was a bug with the plugin or a specific integration method we would just have no idea and can’t really offer support on third party plugins/code.

    Regards,

    Devin

    #128737

    Hey guys,

    I found the solution! I added:

    echo “<span><fb:comments-count href=”.get_permalink().”></fb:comments-count> Reacties</span>”;

    However, I’m now looking to add the number of Facebook comments to the blog slider, but I’m not sure which file I need to edit? It’s the div “slide-meta-comments”

    Thanks in advance!

    #128738

    Hi,

    You can find that on wp-contentthemesenfoldconfig-templatebuilderavia-shortcodes > postslider.php.

    Regards,

    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘FB comments count 0’ is closed to new replies.