diff --git a/CHANGELOG.MD b/CHANGELOG.MD index d0af0eb..419234c 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- TMS-982: Fix exhibition-archive year-filters & search + +## [1.9.2] - 2023-09-04 + +### Fixed + +- TMS-972: Pagination fix for past exhibitions in exhibition-archive + +## [1.9.1] - 2023-04-27 + +### Fixed + +- PIEN-8524: Display API images #162 + ## [1.9.0] - 2023-04-11 - PIEN-8157: PHP 8.1 diff --git a/models/archive-exhibition.php b/models/archive-exhibition.php index 350dbfb..22e82f8 100644 --- a/models/archive-exhibition.php +++ b/models/archive-exhibition.php @@ -300,12 +300,19 @@ public function results() { $upcoming_exhibitions = $this->results->upcoming; $unfiltered_past_exhibitions = array_filter( $this->results->all, [ $this, 'is_past' ] ); - $past_exhibitions = $wp_query->posts; - $this->results->past = $past_exhibitions; + $past_exhibitions = array_filter( $wp_query->posts, [ $this, 'is_past' ] ); + $this->results->past = $unfiltered_past_exhibitions; $results = $is_past_archive ? $past_exhibitions : $upcoming_exhibitions; $this->set_pagination_data( count( $results ), $per_page ); + // Use past exhibitions pagination data when archive search is used + $found_posts = $wp_query->found_posts; + if ( ( self::get_search_query_var() || self::get_year_query_var() ) && $is_past_archive ) { + $this->set_pagination_data( $found_posts, $per_page ); + $results = $past_exhibitions; + } + return [ 'result_count' => count( $current_exhibitions ), 'past_results_count' => count( $unfiltered_past_exhibitions ), @@ -375,8 +382,8 @@ public function years() { */ protected function reorder_main_exhibitions( $items ) { - // Return original $items array if search or year filter is used - if ( self::get_search_query_var() || self::get_year_query_var() ) { + // Return original $items array if search or year filter is used, or if page is past archive + if ( self::get_search_query_var() || self::get_year_query_var() || self::is_past_archive() ) { return $items; } diff --git a/style.css b/style.css index cb7bc54..5c477d7 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,7 @@ /* * Theme Name: TMS Theme Taidemuseo * Description: Tampere Multisite Taidemuseo Theme - * Version: 1.9.0 + * Version: 1.9.2 * Author: Geniem * Author URI: https://geniem.fi * Template: tms-theme-base