$category,
'echo' => 0,
);
$html .= wp_dropdown_categories( $args );
$html .= '
';
$html .= '
';
list( $daysToDisplay, $rangestart_utime, $rangeend_utime ) = wp_statistics_date_range_calculator(
$daysToDisplay,
$rangestart,
$rangeend
);
wp_statistics_date_range_selector(
WP_Statistics::$page['categories'],
$daysToDisplay,
null,
null,
'&precat=' . $category,
$html
);
$args = array(
'category' => $category,
);
$posts = get_posts( $args );
$visit_total = 0;
$daysInThePast = (int) ( ( time() - $rangeend_utime ) / 86400 );
$posts_stats = array();
$visits = array();
// Setup the array, otherwise PHP may throw an error.
foreach ( $posts as $post ) {
$posts_stats[ $post->ID ] = 0;
}
for ( $i = $daysToDisplay; $i >= 0; $i -- ) {
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
$stat = 0;
foreach ( $posts as $post ) {
$temp_stat = wp_statistics_pages( '-' . (int) ( $i + $daysInThePast ), null, $post->ID );
$posts_stats[ $post->ID ] += $temp_stat;
$stat = $temp_stat;
}
$visits[] = $stat;
$visit_total += $stat;
}
?>