I do not know if its possible with the plugin itself. But i made this code to do it:
Place it in your themes functions.php file and then use the shortcode [postviewcounter_total_counts] where you want to display it.
It refreshes the count every 24 hours (so it wont take too many resources from the server)
I have made a test page on one of my sites with this code on: https://folkemoedeovernatning.dk/test/ (If you get a 404, i took down the page)
add_shortcode( 'postviewcounter_total_counts', 'postviewcounter_total_counts_function' );
function postviewcounter_total_counts_function( $atts ) {
global $wpdb;
// Get stored value (cache)
$count = get_transient( 'postviewcounter_total_counts' ); // Site Transient
// If no transient (cache) available, then count again.
if ( false === $count ) {
// Query
$query = "SELECT sum(count) AS count FROM " . $wpdb->prefix . "post_views";
$results = $wpdb->get_results( $query );
set_transient( 'postviewcounter_total_counts', $results["0"]->count, DAY_IN_SECONDS );
}
// Return the count
return $count;
}
-
This reply was modified 2 years, 10 months ago by Kim Vinberg.