• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Display Combined WordPress and Facebook Comment Count

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Display Combined WordPress and Facebook Comment Count

This topic is: not resolved

Tagged: comment number, comments, filter, post comments

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 7 months ago by Johann Kratzik.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • February 16, 2015 at 6:07 pm #141056
    spout
    Member

    I need to display the combined WordPress and Facebook comment count in the comments link. I found the following code from https://wordpress.org/support/topic/how-to-combine-wordpress-and-facebook-comments-counts.

    In functions.php:

    function full_comment_count() {
    global $post;
    $url = get_permalink($post->ID);
    $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url);
    $json = json_decode($filecontent);
    $count = $json->$url->comments;
    $wpCount = get_comments_number();
    $realCount = $count + $wpCount;
    if ($realCount == 0 || !isset($realCount)) {
        $realCount = 0;
    }
    return $realCount;
    }

    and in the template:

    <?php if (full_comment_count()==0) { ?>
    <?php } else { ?>
    <?php echo full_comment_count(); ?>
    <?php } ?>

    or <?php echo full_comment_count(); ?>

    The first part is fine. But how do I edit the comment number in Genesis? It doesn't appear I can add a filter in the genesis_post_comments_shortcode() for the number.

    The genesis_comments_link_filter()doesn't contain the comment number either. Does anyone know how I can edit it?

    May 7, 2015 at 10:24 am #150716
    Johann Kratzik
    Member

    You posted this a while ago and so I hope you were able to get your issue resolved. If it is resolved, please mark this thread as “resolved”, so it can be closed.

    If you are still having issues, report back here, and I will try to help.


    Offering customization work for FREE – Read more

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble