Skip to content

Commit

Permalink
TMS-972: Increase exhibition archive querys posts_per_page value (#16)
Browse files Browse the repository at this point in the history
* TMS-972: exhibition-archive changes

* phpcs fix

* phpcs fix

* TMS-972: Pagination fix for exhibition archive

* 1.0.4

* TMS-972: Increase exhibition archive querys posts_per_page value

* TMS-972: Fix lobby-display query & exhibition archive year-filter dropdown

* Update changelog
  • Loading branch information
eebbi authored Sep 12, 2023
1 parent d070a65 commit 2dd0007
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.0.5] - 2023-09-05

- TMS-972:
- Increase exhibition archive querys posts_per_page value to prevent exhibitions not showing
- Fix lobby-display exhibition query
- Fix exhibition archive year-filter dropdown

## [1.0.4] - 2023-09-04

- TMS-972:
Expand Down
14 changes: 10 additions & 4 deletions models/archive-exhibition.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class ArchiveExhibition extends BaseModel {
/**
* Number of ongoing items to show per page.
*/
const ONGOING_ITEMS_PER_PAGE = '100';
const ONGOING_ITEMS_PER_PAGE = '600';

/**
* Number of upcoming items to show per page.
*/
const UPCOMING_ITEMS_PER_PAGE = '100';
const UPCOMING_ITEMS_PER_PAGE = '600';

/**
* Pagination data.
Expand Down Expand Up @@ -357,13 +357,19 @@ public function results() {

$unfiltered_past_exhibitions = array_filter( $this->results->all, [ $this, 'is_past' ] );
$past_exhibitions = array_filter( $wp_query->posts, [ $this, 'is_past' ] );
$this->results->past = $past_exhibitions;
$this->results->past = $unfiltered_past_exhibitions;

$digital_exhibitions = Settings::get_setting( 'digital_exhibitions' ) ?: [];

$results = $is_past_archive ? $unfiltered_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() ) {
$this->set_pagination_data( $found_posts, $per_page );
}

return [
'result_count' => count( $current_exhibitions ),
'past_results_count' => count( $unfiltered_past_exhibitions ),
Expand All @@ -378,7 +384,7 @@ public function results() {
'posts' => $this->reorder_main_exhibitions( $this->format_posts( $past_exhibitions ) ),
'digital_exhibition_pages' => $this->digital_exhibitions_pages( $digital_exhibitions ),
'digital_exhibitions' => $this->format_digital_exhibitions( $digital_exhibitions ),
'summary' => $this->results_summary( count( $past_exhibitions ) ),
'summary' => $this->results_summary( $found_posts ),
'have_posts' => ! empty( $results ) || ! empty( $current_exhibitions ),
'partial' => 'shared/exhibition-item',
'digital_exhibitions_partial' => 'shared/exhibition-item-digital',
Expand Down
14 changes: 9 additions & 5 deletions models/page-lobby-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ public function language_versions() {
* @return array|array[]|false
*/
public function lobby_exhibitions() {
/**
* Redipress is disabled in this query for tax_query to exclude terms properly
*/
$args = [
'post_type' => 'exhibition',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'tax_query' => [
'post_type' => 'exhibition',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'disable_redipress' => true,
'tax_query' => [
[
'taxonomy' => 'exhibition-status',
'field' => 'slug',
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 Vapriikki
* Description: Tampere Multisite Vapriikki Theme
* Version: 1.0.4
* Version: 1.0.5
* Author: Geniem
* Author URI: https://geniem.fi
* Template: tms-theme-base
Expand Down

0 comments on commit 2dd0007

Please sign in to comment.