Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMS-972: Pagination fix for exhibition archive #163

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.9.2] - 2023-09-04

### Fixed

- TMS-972: Pagination fix for past exhibitions in exhibition-archive

## [1.9.1] - 2023-04-27

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion models/archive-exhibition.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

$args = [
'post_type' => Exhibition::SLUG,
'posts_per_page' => self::ONGOING_ITEMS_PER_PAGE,

Check warning on line 79 in models/archive-exhibition.php

View workflow job for this annotation

GitHub Actions / phpcs-check

Detected high pagination limit, `posts_per_page` is set to `self::ONGOING_ITEMS_PER_PAGE`
'post_status' => 'publish',
'orderby' => [ 'start_date' => 'ASC', 'title' => 'ASC' ],
'meta_key' => 'start_date',
Expand Down Expand Up @@ -294,7 +294,7 @@
$is_past_archive = $this->is_past_archive();
$is_upcoming_archive = $this->is_upcoming_archive();
$is_ongoing_archive = ! $is_past_archive && ! $is_upcoming_archive;
$per_page = ( $is_past_archive ) ? self::PAST_ITEMS_PER_PAGE : ( ( $is_upcoming_archive ) ? self::UPCOMING_ITEMS_PER_PAGE : self::ONGOING_ITEMS_PER_PAGE );

Check warning on line 297 in models/archive-exhibition.php

View workflow job for this annotation

GitHub Actions / phpcs-check

Line exceeds 120 characters; contains 174 characters

$current_exhibitions = array_filter( $this->results->all, [ $this, 'is_current' ] );
$upcoming_exhibitions = $this->results->upcoming;
Expand All @@ -303,7 +303,7 @@
$past_exhibitions = $wp_query->posts;
$this->results->past = $past_exhibitions;

$results = $is_past_archive ? $past_exhibitions : $upcoming_exhibitions;
$results = $is_past_archive ? $unfiltered_past_exhibitions : $upcoming_exhibitions;
$this->set_pagination_data( count( $results ), $per_page );

return [
Expand Down Expand Up @@ -414,7 +414,7 @@
for ( $i = 0; $i <= $length; $i++ ) {
// Check if item dates exists
if ( ! empty( $items[ $i ]->dates ) ) {
// Compare main exhibitions dates with each normal exhibitions dates and get the first matches position

Check warning on line 417 in models/archive-exhibition.php

View workflow job for this annotation

GitHub Actions / phpcs-check

Line exceeds 120 characters; contains 127 characters
if ( array_intersect( $items[ $i ]->dates, $main->dates ) && $items[ $i ]->ID !== $main->ID
&& ( empty( $items[ $i ]->main_exhibition ) || $items[ $i ]->main_exhibition === '0' ) ) {
// Set the position as a variable for the main exhibition and break the loop
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.1
* Version: 1.9.2
* Author: Geniem
* Author URI: https://geniem.fi
* Template: tms-theme-base
Expand Down
Loading