From 31e41ae4ff5f770b8946a4d35e96e198614eec6a Mon Sep 17 00:00:00 2001 From: Nikola Date: Thu, 5 Oct 2017 19:02:16 +0200 Subject: [PATCH] Fix sermons preached before 09/09/2001 not showing up --- includes/class-sm-api.php | 2 +- includes/shortcodes.php | 2 +- readme.txt | 1 + sermons.php | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/class-sm-api.php b/includes/class-sm-api.php index 5ec785c..c94db35 100644 --- a/includes/class-sm-api.php +++ b/includes/class-sm-api.php @@ -76,7 +76,7 @@ public function fix_ordering( $args ) { if ( $args['orderby'] === 'date' ) { $args['orderby'] = 'meta_value_num'; $args['meta_key'] = 'sermon_date'; - $args['meta_value'] = time(); + $args['meta_value_num'] = time(); $args['meta_compare'] = '<='; } elseif ( $args['orderby'] === 'wpdate' ) { $args['orderby'] = 'date'; diff --git a/includes/shortcodes.php b/includes/shortcodes.php index a1c10df..b0a8914 100755 --- a/includes/shortcodes.php +++ b/includes/shortcodes.php @@ -106,7 +106,7 @@ public function displaySermonsList( $atts ) { $query_args['orderby'] = 'meta_value_num'; $query_args['meta_key'] = 'sermon_date'; $query_args['meta_compare'] = '<='; - $query_args['meta_value'] = time(); + $query_args['meta_value_num'] = time(); } // get items diff --git a/readme.txt b/readme.txt index 00e59c1..17b976f 100755 --- a/readme.txt +++ b/readme.txt @@ -96,6 +96,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ### 2.9 ### * Fix a PHP notice on new sermon creation * Fix sermon date not saving on first save +* Fix sermons preached before 09/09/2001 not showing up ### 2.8 ### * Add better support for templating plugins (Elementor and Visual Composer, to mention some) diff --git a/sermons.php b/sermons.php index 602be70..41ac9e3 100755 --- a/sermons.php +++ b/sermons.php @@ -177,7 +177,7 @@ public static function fix_sermons_ordering( $query ) { is_tax( 'wpfc_bible_book' ) ) { $query->set( 'meta_key', 'sermon_date' ); - $query->set( 'meta_value', time() ); + $query->set( 'meta_value_num', time() ); $query->set( 'meta_compare', '<=' ); $query->set( 'orderby', 'meta_value_num' ); }