Skip to content

Commit

Permalink
Merge branch 'TMS-982' into stage
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbi committed Oct 10, 2023
2 parents b0a15b1 + ede2fe9 commit c95dc42
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions models/archive-exhibition.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit c95dc42

Please sign in to comment.