Created
July 25, 2016 14:41
-
-
Save pj-dave/21937c994bf33445bad3b3bfdb7ebe1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', function() { | |
global $wpdb; | |
if ( empty( $_GET['pageviews-pvc-export'] ) ) | |
return; | |
$config = get_option( 'pageviews_config' ); | |
echo $config['account'] . PHP_EOL; | |
$data = $wpdb->get_results( "SELECT `id`, `count` FROM {$wpdb->prefix}post_views WHERE `period` = 'total';", ARRAY_A ); | |
foreach ( $data as $entry ) | |
printf( "%d:%d\n", $entry['id'], $entry['count'] ); | |
die(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment