• I’m trying to display a few statistics on my website through a widget with the following 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;
    ?>

    This works just fine but I was wondering how can I improve my code so it also displays: Total number of coupons today/this week/this month/this year?

    Any help is much appreciated.

  • The topic ‘wp_count_posts’ is closed to new replies.