• Before I get started, I have to say thanks to Aaron for doing such a great job with this plugin over the past few years, and thank you.

    So as a feature suggestion, maybe for a future version, it would be nice if we could be able to capture and use the review count (number of reviews) anywhere necessary.

    For instance if you have a link in your main nav to the reviews page you’ve set up, it would be decent to be able to place, even a short-code snippet that would display the review count.

    Here’s an example of which I’ve added the review count statically:
    https://i.imgur.com/hngUzpO.jpg

    So Aaron does this look a feature you’d considering adding in the future?

    Others: if you’ve hacked this in yourself just for the sake of it, let me know.

    Thanks everyone!

    https://www.ads-software.com/plugins/wp-customer-reviews/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Dave Lauretti

    (@345ad)

    This is a quick working fix, but once the plugin is updated, you’ll have to go into wp-customer-reviews.php, until you see the following on line 394:

    $total_reviews = $row[0]->total;

    underneath that line add:

    $_SESSION[‘approved_count’] = $row[0]->total;

    Anywhere you want to use the review count in your theme, just add the following:

    $approved_count = $_SESSION[‘approved_count’];
    echo $approved_count;

    Thread Starter Dave Lauretti

    (@345ad)

    Update, forget about my code above. If you’ve already added the session variable in wp-customer-reviews.php just revert back to your previous version – delete it.

    Simply add the following into functions.php

    function show_review_count() {
    global $wpdb;
    $dbtable = $wpdb->prefix . ‘wpcreviews’;
    $pageID = 4745;
    $row = $wpdb->get_results(“SELECT COUNT(*) AS total FROM $dbtable WHERE page_id=$pageID AND status=1″);
    echo $row[0]->total;
    }

    and wherever you want the review count to display on your site simply add into the HTML:

    <?php if (function_exists(‘show_review_count’)) show_review_count(); ?>

    Enjoy!

    Hi 345AD — I tried this but it’s showing as zero (0). My ratings are on a custom post type — could this be the problem?

    Thread Starter Dave Lauretti

    (@345ad)

    Hey Jimbo, so have you kept trying? Have you got it to work? Were you able to get the right page ID?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Feature Suggestion – Review Count’ is closed to new replies.