MITLibraries / MITLibraries-child

A Wordpress child theme that descends from MITLibraries-parent
GNU General Public License v3.0
1 stars 1 forks source link

Adds generic "Location index" page template, other exhibit display changes #163

Closed matt-bernhardt closed 2 years ago

matt-bernhardt commented 2 years ago

Why are these changes being introduced:

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/uxws-1396

How does this address that need:

This PR does several things in order:

  1. Any file that is edited during this work is cleaned of legacy problems as flagged by PHPCS. This should result in our linter having no issues with the affected lines (or at least to make any issues more easily reviewable as exceptions).
  2. Introduces a new Exhibits | Location Index page template, derived from the existing Maihaugen and Rotch templates. Instead of having a hard-coded location value, however, it loads the targeted location from the post's Category assignments.
  3. The new template, as well as one legacy template which loads all exhibits across locations, are updated to anticipate that the end date for Exhibits is now optional.
  4. A small bit of code cleanup for the "show all exhibits" template, which somehow wasn't flagged before step 3.
  5. A new helper function is added to functions.php, allowing page templates to look up location information according to the new data model. The need for this helper function is driven by the fact that some exhibits will be placed in a catchall category, with the actual name of the location stored in a separate field. Additionally, some exhibits may be placed into multiple locations. Navigating all these conditionals seems like something for a helper function, rather than repeated logic across multiple page templates.

Document any side effects to this change:

How can a reviewer manually see the effects of these changes?

This branch has been deployed to the staging server.

Todo:

Requires new or updated plugins, themes, or libraries?

YES - there's a coordinated PR for the Custom Child Post Types plugin, which has also been deployed. MITLibraries/Custom-Child-Theme-Post-Types#5

Requires change to deploy process?

NO

matt-bernhardt commented 2 years ago

(This thread of comments may get deleted prior to code review)

The first commit results in the following diff between the two bespoke page templates:

% diff page-exhibits-maihaugen-gallery.php page-exhibits-rotch-library.php                                       
3c3
<  * Template Name: Exhibits |  Maihaugen Gallery
---
>  * Template Name: Exhibits |  Rotch Library
47c47
<                           'value'   => 'Maihaugen Gallery',  // Value for comparison.
---
>                           'value'   => 'Rotch Library',  // Value for comparison.
63d62
< 
101c100
<                       'value'   => 'Maihaugen Gallery',  // Value for comparison.
---
>                       'value'   => 'Rotch Library',  // Value for comparison.
117d115
< 
155c153
<                       'value'   => 'Maihaugen Gallery',  // Value for comparison.
---
>                       'value'   => 'Rotch Library',  // Value for comparison.