From 91a25bf3e0b27daca308810f052e4a5b304c9888 Mon Sep 17 00:00:00 2001 From: Fellan-91 Date: Fri, 5 Jul 2024 16:10:00 +0300 Subject: [PATCH 1/2] fixed sorted by date --- classes/class-get-portfolio.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/class-get-portfolio.php b/classes/class-get-portfolio.php index 24eb883c..41edc455 100644 --- a/classes/class-get-portfolio.php +++ b/classes/class-get-portfolio.php @@ -1432,6 +1432,10 @@ public static function get_query_params( $options, $for_filter = false, $layout_ * Now images with filled values ​​will be sorted first. * And empty images will be inserted later at the very end of the array. */ + if ( 'date' === $custom_order ) { + $custom_order = 'published_time'; + } + $images = self::sort_array_by_field( $images, $custom_order, $custom_order_direction ); break; case 'rand': From 7237f25b3f122d27a4d48d3bccc4c60d5fb9335f Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 10 Jul 2024 17:27:52 +0300 Subject: [PATCH 2/2] Update class-get-portfolio.php --- classes/class-get-portfolio.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/class-get-portfolio.php b/classes/class-get-portfolio.php index 41edc455..ab1ad149 100644 --- a/classes/class-get-portfolio.php +++ b/classes/class-get-portfolio.php @@ -1427,15 +1427,15 @@ public static function get_query_params( $options, $for_filter = false, $layout_ case 'image_caption': case 'image_alt': case 'image_description': + if ( 'date' === $custom_order ) { + $custom_order = 'published_time'; + } + /** * We've reworked this code to work correctly with empty sortable values. * Now images with filled values ​​will be sorted first. * And empty images will be inserted later at the very end of the array. */ - if ( 'date' === $custom_order ) { - $custom_order = 'published_time'; - } - $images = self::sort_array_by_field( $images, $custom_order, $custom_order_direction ); break; case 'rand':