APSW Template tags ( Free & Pro Versions )

You can use these template tags add statistic information directly in template files.


The APSW PRO version is more customizable.
You can pass array of arguments to functions below to make it more flexible!
 <?php if (function_exists('apsw_pu_widget')) { apsw_pu_widget($last = -1) } ?> 

Displays Post author statistic and Popular posts widget

Options:
  • set $last = 1 to display popular posts for yesterday
  • set $last = 7 to display popular posts for past week
  • set $last = 30 to display popular posts for past month
  • set $last = 0 to display popular posts for current day
  • set $last = -1 or empty to display popular posts for all time
 <?php if (function_exists('apsw_pp_dynamic_date_widget')) { apsw_pp_dynamic_date_widget($last = -1) } ?> 

Display popular posts list for last X days

Options:
  • set $last = 1 to display popular posts for yesterday
  • set $last = 7 to display popular posts for past week
  • set $last = 30 to display popular posts for past month
  • set $last = 0 to display popular posts for current day
  • set $last = -1 or empty to display popular posts for all time
 <?php if (function_exists('apsw_pa_dynamic_date_widget')) { apsw_pa_dynamic_date_widget($last = -1) } ?> 

Displays popular authors list for last X days

Options:
  • set $last = 1 to display popular authors for yesterday
  • set $last = 7 to display popular authors for past week
  • set $last = 30 to display popular authors for past month
  • set $last = 0 to display popular authors for current day
  • set $last = -1 or empty to display popular authors for all time
 
    add_filter('apsw_post_thumbnail', 'change_thumb_for_post_type', 2, 2); 

    function change_thumb_for_post_type($t, $id) {
        $p = get_post($id);
        if ($p && $p->post_type == 'post') {
            $t = '...image url here...';
        } else if ($p && $p->post_type == 'page') {
            $t = '...image url here...';
        } else {
            $t = '...image url here...';
        }
        return $t;
    } 
                    

Filter for posts default thumbnail by post types ( works only if the post default thumbnail not set in options page! )

Put this code in your active theme functions.php file

 
        //Example - Author and Post Widget (set for last 45 days)
        add_filter('apsw_author_and_post_last', 'custom_author_and_post_last');
        function custom_author_and_post_last($last) {
            $last = 45;
            return $last;
        }

        //Example - Popular Posts Widget (set for last 20 days)
        add_filter('apsw_popular_posts_last', 'custom_popular_posts_last');
        function custom_popular_posts_last($last) {
            $last = 20;
            return $last;
        }
        
        //Example - Popular Users Widget (set for last 730 days)
        add_filter('apsw_popular_users_last', 'custom_popular_users_last');
        function custom_popular_users_last($last) {
            $last = 730;
            return $last;
        }
                    

Filters for widgets custom last X days

Now you can set custom time interval for stat widgets. Put according code in current active theme's functions.php file.

             
    // Hide category taxonomy from author and post widget
    add_filter('apsw_taxonomy_category', 'apsw_taxonomy_category');
    if (!function_exists('apsw_taxonomy_category')) {
        function apsw_taxonomy_category($categoryList) {
            return null;
        }
    }

    // Hide post_tag taxonomy from author and post widget
    add_filter('apsw_taxonomy_post_tag', 'apsw_taxonomy_post_tag');
    if (!function_exists('apsw_taxonomy_post_tag')) {
        function apsw_taxonomy_post_tag($tagList) {
            return null;
        }
    }

    // Hide custom taxonomies from author and post widget
    add_filter('apsw_taxonomy_custom', 'apsw_taxonomy_custom');
    if (!function_exists('apsw_taxonomy_custom')) {
        function apsw_taxonomy_custom($taxonomyList) {
            return null;
        }
    }
                    

Hide taxonomies

You can hide taxonomies from author and post statistic widget using code above. Put according code in current active theme's functions.php file.


APSW Shortcodes ( Pro Version )

You can use these shortcodes to display different statistic information directly on posts and pages.

 [apsw_postviews last="7" user="21" post_types="post,page" width="400" height="300"] 

Displays post views of certain user for certain date period.

"last" - the number of past days
If this attribute is not set, it displays post views for all time.
If this attribute is set "0", it displays post views for current day.
"user" - user id
If this attribute is not set this shortcode displays current logged in users' post views statistic
"post_types" - comma separated post types(post,page, etc...)
If this attribute is not set, then default post types will be applied (post, page)
"width" - the width of chart in pixels
If this attribute is not set, then default value will be applied (400px)
"height" - the height of chart in pixels
If this attribute is not set, then default value will be applied (300px)
 [apsw_postcount last="7" user="21" post_types="post,page" width="400" height="300"] 

Displays posts count of certain user for certain date period.

"last" - the number of past days
If this attribute is not set, it displays posts count for all time.
If this attribute is set "0", it displays posts count for current day.
"user" - user id
If this attribute is not set this shortcode displays current logged in users' posts count statistic
"post_types" - comma separated post types(post,page, etc...)
If this attribute is not set, then default post types will be applied (post, page)
"width" - the width of chart in pixels
If this attribute is not set, then default value will be applied (400px)
"height" - the height of chart in pixels
If this attribute is not set, then default value will be applied (300px)
 [apsw_popularposts last="7" user="21" by="comments" post_types="post,page" width="400", "300"] 

Displays popular posts of certain user for certain date period based on post comments or views.

"last" - the number of past days
If this attribute is not set, it displays popular posts for all time.
If this attribute is set "0", it displays popular posts for current day.
"user" - user id
If this attribute is not set, it displays current logged in users' popular posts statistic
"by" - the base for counting and choosing popular posts ( values: "comments" or "views" )
If this attribute is not set, it takes "comments" as a base.
"post_types" - comma separated post types(post,page, etc...)
If this attribute is not set, then default post types will be applied (post, page)
"width" - the width of chart in pixels
If this attribute is not set, then default value will be applied (400px)
"height" - the height of chart in pixels
If this attribute is not set, then default value will be applied (300px)
 [apsw_activeusers last="7" user="21" by="posts" post_types="post,page" width="400" height="300"] 

Displays most popular users statistic for certain date period based on users' posts, comments, or posts' views.

"last" - the number of past days
If this attribute is not set, it displays popular users for all time.
If this attribute is set "0", it displays popular users for current day.
"by" - the base for counting and choosing popular users ( values: "comments", "post counts" or "views" )
If this attribute is not set, it takes "comments" as a base.
"post_types" - comma separated post types(post,page, etc...)
If this attribute is not set, then default post types will be applied (post, page)
"width" - the width of chart in pixels
If this attribute is not set, then default value will be applied (400px)
"height" - the height of chart in pixels
If this attribute is not set, then default value will be applied (300px)
 [apsw_visitors last="7" user="21" post_types="post,page" width="400" height="300"] 

Displays number of posts visitors (with countries) for certain users posts.

"last" - the number of past days
If this attribute is not set, it displays visitors for all time.
If this attribute is set "0", it displays visitors for current day.
"user" - user id
If this attribute is not set, it displays current logged in users' posts visitors statistic
"post_types" - comma separated post types(post,page, etc...)
If this attribute is not set, then default post types will be applied (post, page)
"width" - the width of chart in pixels
If this attribute is not set, then default value will be applied (400px)
"height" - the height of chart in pixels
If this attribute is not set, then default value will be applied (300px)

Need Help?

If you need help with this plugin or if you want to make a suggestion, then please visit to our support Q&A forum. gVectors Support Forum