From 2c718160a3fe167908a58ef29e08ee62ca285972 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Thu, 31 Aug 2023 16:50:13 -0400 Subject: [PATCH] Stretch goal: refactoring content-single.php ** Why are these changes being introduced: * As we are now using content-single.php (and discovering that it was unused before), we are discovering that there is a pretty significant amount of debt in the template - unused conditionals, references to fields that no longer exist, etc. That made working with this template a bit trickier than needed because it wasn't clear what was needed. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/pw-55 ** How does this address that need: * This refactors the template, removing unused variables, unused conditionals, etc. Full details are below. * The mark_as_new field no longer exists, so that check is removed. * The article category is not shown, and the old logic never actually displayed it - so we remove it entirely. * There are no "features" or "updates" post types on the network, and the "exhibits" post type is not used on the News site - so those checks are also removed. * The bespoke handling of event date and time information is removed in favor an existing partial that is used elsewhere in the theme. While we don't anticipate any event information to be displayed using this template (The DSpace@MIT tag has always been news articles written by our staf, and not event records imported from the central MIT calendar), this will protect us in the future if that changes. * Whitespace is cleaned up, and references to $subtitle and $type variables that are never used are removed. ** Document any side effects to this change: * None, unless I've missed a path somewhere in the theme where this partial is loaded somewhere other than tag.php. If that is the case, then there will likely be an impact in how content is rendered that I have not seen or considered. --- web/app/themes/mitlib-news/content-single.php | 79 +++---------------- 1 file changed, 12 insertions(+), 67 deletions(-) diff --git a/web/app/themes/mitlib-news/content-single.php b/web/app/themes/mitlib-news/content-single.php index 0f863a21..9a91768d 100644 --- a/web/app/themes/mitlib-news/content-single.php +++ b/web/app/themes/mitlib-news/content-single.php @@ -8,85 +8,30 @@ namespace Mitlib\News; - $category = get_the_category(); - $type_post = get_post_type(); - $subtitle; - $type; +$category = get_the_category(); +$type_post = get_post_type(); ?>
data-category="slug ); ?>"> -
- - New! - +
', '' ); ?> - -
- - - Start date is ' . esc_html( $date_start ) . '
'; - echo '
End date is ' . esc_html( $date_end ) . '
'; - } - ?> - - - format('d-m-Y'); - // Check for events. - if ( 'post' == $type_post && 1 == get_field( 'is_event' ) ) { - ?> - -
Event date format( 'F, j Y' ) ); ?> starting at - - and ending at
- - - - - -
- + +