Quantcast
Channel: WordPress.org Forums » [Jetpack - WP Security, Backup, Speed, & Growth] Support
Viewing all articles
Browse latest Browse all 37457

aparentdesign on "[Plugin: Jetpack by WordPress.com] Using WP-Stats functions with Jetpack?"

$
0
0

I forgot, there is also this script that is put in the functions.php file:

//This function works in conjunction with the Wordpress.com Stats plugin.
//You need it for the Most Popular widget.
function get_stats_exclude_home($numDays,$numPosts) {
$numPostsPlus = $numPosts + 1;
$blnHasHome = false;
$intRowsLoop = 0;
$intRowFound;
$intRowsCount;
$most_read_posts;

$strArgs = 'days=' . $numDays . '&limit=' . $numPostsPlus;

if (function_exists('stats_get_csv')) {
$most_read_posts = stats_get_csv('postviews', $strArgs);
}

foreach ($most_read_posts as $single_post) {
$postTitle = $single_post['post_title'];
if($postTitle == 'Home page') {
$blnHasHome = true;
$intRowFound = $intRowsLoop;
}
$intRowsLoop = $intRowsLoop + 1;
}

$intRowsCount = $intRowsLoop + 1;

if($blnHasHome) {
unset($most_read_posts[$intRowFound]);
} else {
if($intRowsCount > $numPosts){
unset($most_read_posts[$numPosts]);
}
}
return $most_read_posts;
}
?>


Viewing all articles
Browse latest Browse all 37457

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>