Adding A Stats Column For Jetpack
A feature that I feel is missing from JetPack, is an easy way to view stats for each post.
The data is available there, so we only have to link to it.
Here’s an example for post ID 549:
We can use the chart bar dashicon to display it:
There are other icons available, like the chart line and chart area icons.
Here’s a plugin to achieve this (PHP 5.4+):
where we can adjust the [ 'post', 'page' ] part to our needs.
Thanks, your tutorial helped me to add the state column for Jetpack. Nice job!
Are there some syntax errors in your code?
Thanks Douglas for noticing. These are some formatting issues in the site editor.
The code is now available on github here:
How about showing post/page views counter data from Jetpack instead of stats icon?
The stats data is stored externally at JetPack’s servers, so one would need to fetch it for each post to display it.
I’ve not looked at the stats API but maybe it’s possible to fetch it in bulk (i.e. for a list of post IDs).