public_html/wp-content/plugins/wp-statistics/includes/functions/functions.php
// Alternatively if $days is set to true it returns the average number of days between posts on your site.
Alternatively if $days is set to true it returns the average number of days between posts on your site.
Alternatively if $days is set to true it returns the average number of days between posts on your site .
function wp_statistics_average_post( $days = false ) {
		global $wpdb;
		$get_first_post = $wpdb->get_var( "SELECT post_date FROM {$wpdb->posts} WHERE post_status = 'publish' ORDER BY post_date LIMIT 1" );
		$get_total_post = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post'" );
		$days_spend = intval( ( time() - strtotime( $get_first_post ) ) / 86400 ); 
		if( $days == true ) {
			if( $get_total_post == 0 ) { $get_total_post = 1; } 
			return round( $days_spend / $get_total_post, 0 );
		}
		else {
			if( $days_spend == 0 ) { $days_spend = 1; } 
			return round( $get_total_post / $days_spend, 2 );
		}
	}
function wp_statistics_average_post ( $ days = false ) { global $ wpdb ; $ get_first_post = $ wpdb -> get_var ( " SELECT post_date FROM  { $ wpdb -> posts }  WHERE post_status = 'publish' ORDER BY post_date LIMIT 1 " ) ; $ get_total_post = $ wpdb -> get_var ( " SELECT COUNT(*) FROM  { $ wpdb -> posts }  WHERE post_status = 'publish' AND post_type = 'post' " ) ; $ days_spend = intval ( ( time ( ) - strtotime ( $ get_first_post ) ) / 86400 ) ; if ( $ days == true ) { if ( $ get_total_post == 0 ) { $ get_total_post = 1 ; } return round ( $ days_spend / $ get_total_post , 0 ) ; } else { if ( $ days_spend == 0 ) { $ days_spend = 1 ; } return round ( $ get_total_post / $ days_spend , 2 ) ; } }
Alternatively if $days is set to true it returns the average number of days between posts on your site.
Alternatively if $days is set to true it returns the average number of days between posts on your site .
// 86400 = 60 * 60 * 24 = number of seconds in a day // Avoid divide by zero errors. // Avoid divide by zero errors.