JANUARY SALE: Directory Theme Now Only $49 -- Learn More

Ask the community

This is a community support forum where you can ask
questions and interact with other PremiumPress Customers.

How to display total number of coupons added

  • Praveen
    Praveen
    Senior Member 216 points
    September 26, 2013 at 7:44 am

    Hi,

    How can we display total number of coupons added. I mean total coupons not individual stores.

    And total registered users

  • Lisette
    Lisette
    Senior Member 178 points
    September 26, 2013 at 8:45 am

    I don’t think that Couponpress offers such statistics being displayed at this moment. Therefore I suggest adding this idea in the “Feature request Board.”

  • Praveen
    Praveen
    Senior Member 216 points
    September 26, 2013 at 6:28 pm

    @Lisette, hope there is some trick on this.

    If you click the blank search button, you get the results with “We have found 10 items matching your search.’

    So that 10 is nothing but the total number of coupons. We can use that code, but are you aware where exactly that code file is called? So that we can try some tricks :)

  • Richard Bonk
    Richard Bonk
    Super Guru 2,739 points
    September 26, 2013 at 7:35 pm

    There is a WordPress function called wp_count_posts() – http://codex.wordpress.org/Function_Reference/wp_count_posts

    You can use that.

    Kind regards,

    Richard
    _____________________________________________________________________
    Wide range of PremiumPress and WordPress Plugins and add-ons
    PremiumPress customisation services and Website Design
    Selection of PremiumPress Child Themes

  • Lisette
    Lisette
    Senior Member 178 points
    September 26, 2013 at 7:53 pm

    Not quite. “We have found 10 items matching your search.” basically means 10 entries matches your search string (keyword). It doesn’t have anything to do with statistics.

    Correct me if I’m wrong but with statistics we mean something like this:
    40 new coupons added this week
    358 new coupons added this month
    Total number of coupons in our database: 11547

    In couponpress7 we could use this code in our header:
    %a = count // example: %a coupons and counting!
    But I don’t know if this option is in the responsive theme. I haven’t really looked for it. ^^;;

  • Praveen
    Praveen
    Senior Member 216 points
    September 26, 2013 at 10:21 pm

    @Richard, hope coupons are not considered as posts in responsive theme.

    @Lisette, yes I’m exactly looking as above statistics daily, week, month & total coupons.

    No its not working on responsive theme :(

  • Richard Bonk
    Richard Bonk
    Super Guru 2,739 points
    September 26, 2013 at 11:15 pm

    @Praveen – the function I mentioned can be used on any type of post type like posts, pages, custom post types etc.

  • Lisette
    Lisette
    Senior Member 178 points
    September 27, 2013 at 9:07 pm

    Use this code inside a widget that support php

    <?php
    $totalcoupons = wp_count_posts('coupon_type')->publish;
    ?>

    Total number of coupons: <? echo $totalcoupons; ?>

  • David
    David
    Senior Member 107 points
    September 28, 2013 at 2:58 am

    You can use this wp plugin: php code widget
    It’s free…and the code worked perfectly. TY Lisette!

  • Mark Fail
    Mark Fail
    Super Guru 12,899 points
    September 28, 2013 at 8:36 am

    :)

  • Praveen
    Praveen
    Senior Member 216 points
    September 30, 2013 at 6:58 am

    @Lisette,

    You’re awesome, worked without any issues :)

    What about the Coupons submitted today, weeks and month? Can that be displayed?

  • Richard Bonk
    Richard Bonk
    Super Guru 2,739 points
    September 30, 2013 at 8:13 am

    What about the Coupons submitted today, weeks and month? Can that be displayed?

    For that you would need to have have some custom function created.

  • Lisette
    Lisette
    Senior Member 178 points
    September 30, 2013 at 7:51 pm

    I wish I could be of more help… I’m a beginner at php, so creating a post count by date range is bit difficult for me at this point. It’s not extremely hard to do though. Someone with more php knowlegde should be able to do it with ease.

    If you want to add a ‘total number of stores’ you can use this code:

    <?php
    $count_posts = wp_count_posts('coupon_type');
    $totalcoupons = $count_posts->publish;
    $taxonomystore = wp_count_terms( 'store' );
    echo 'Total number of coupons: '.$totalcoupons;
    echo '<br />Total number of stores: '.$taxonomystore;
    ?>
  • Praveen
    Praveen
    Senior Member 216 points
    October 1, 2013 at 12:35 pm

    @Lisette, that’s working like a charm again :)

    You are not a beginner :) you are expert at php programming :)

  • Richard Bonk
    Richard Bonk
    Super Guru 2,739 points
    March 8, 2014 at 2:59 am

    I have created a plugin that will add a shortcode that can be used in most places on the site which will display the following:

    count listings added today
    count listings added this week
    count listings added this month
    count listings in total
    count total categories
    count total stores (when this taxonomy is present)

    http://premiumwebservices.co.uk/shop/responsive-themes-plugins/show-count-shortcode/

    Hope this will be of use.

    Kind regards,

    Richard
    ____________________________________________________________________
    Wide range of WordPress Plugins
    Premium and Free PremiumPress plugins and add-ons
    Newly released collection of Responsive Themes plugins
    PremiumPress customisation services and Website Design
    Selection of PremiumPress Child Themes

Viewing 15 posts - 1 through 15 (of 16 total)