Shortcodes
WP Statistics supports shortcodes in WordPress. These can be used in either a post or a page body and an HTML widget.
The general shortcode format is:
[wpstatistics stat=xxx time=xxxx provider=xxxx format=xxxxxx id=xxx]
Where:
Item |
Description |
stat |
The statistics you want, see the next table for available options. |
time | Is the time frame (time periods) for the statistic. This value uses the strtotime() PHP function (http://php.net/manual/en/datetime.formats.php) format, some acceptable values include:
|
provider |
The search provider to get stats on (ask/bing/clearch/duckduckgo/google/yahoo/yandex). |
format |
The format for numbers, the options are i18n (uses the format of the current country as set in WordPress), English (uses 1,000.00 style formats), or none (the default will return n number without any formatting) |
Id |
The page/post ID to get statistics on. Only used on page visits. |
The Stat field can be any of the followings:
Stat |
Description |
usersonline |
The number of users online right now. |
visits |
The number of hits to the site. |
visitors |
The number of visitors to the site. |
pagevisits |
The number of times the current page has been visited |
searches |
The number of search engine referrals. |
postcount |
The total number of posts on the site. |
pagecount |
The total number of pages on the site. |
commentcount |
The total number of comments on the site. |
spamcount |
The total number of spam comments on the site. |
usercount |
The total number of users on the site. |
postaverage |
The average posts per user on the site. |
commentaverage |
The average comments per user on the site. |
useraverage |
The average number of users on the site. |
lpd |
The last post date for the site. |
Examples:
[[wpstatistics stat=usersonline]]
[[wpstatistics stat=visitors time=today]]
[[wpstatistics stat=visits time=today]]
[[wpstatistics stat=visitors time=yesterday]]
[[wpstatistics stat=visits time=yesterday]]
[[wpstatistics stat=visitors time=total]]
[[wpstatistics stat=visits time=total]]