Merge pull request #1144 from GeertDD/year_dropdown
Made first year retrieval more robust
This commit is contained in:
commit
1464ba7a94
|
@ -678,7 +678,7 @@ function woocommerce_monthly_sales() {
|
||||||
|
|
||||||
global $start_date, $end_date, $woocommerce, $wpdb;
|
global $start_date, $end_date, $woocommerce, $wpdb;
|
||||||
|
|
||||||
$first_year = $wpdb->get_var("SELECT post_date FROM $wpdb->posts ORDER BY post_date ASC LIMIT 1;");
|
$first_year = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_date != 0 ORDER BY post_date ASC LIMIT 1;");
|
||||||
if ($first_year) $first_year = date('Y', strtotime($first_year)); else $first_year = date('Y');
|
if ($first_year) $first_year = date('Y', strtotime($first_year)); else $first_year = date('Y');
|
||||||
|
|
||||||
$current_year = (isset($_POST['show_year'])) ? $_POST['show_year'] : date('Y', current_time('timestamp'));
|
$current_year = (isset($_POST['show_year'])) ? $_POST['show_year'] : date('Y', current_time('timestamp'));
|
||||||
|
|
Loading…
Reference in New Issue