From 4366a7c8b9a7e106932e3553c5cf1bc752742d39 Mon Sep 17 00:00:00 2001 From: EarthlingDavey <15802017+EarthlingDavey@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:05:13 +0000 Subject: [PATCH 1/2] Set production config. --- deploy/production/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/deploy/production/config.yml b/deploy/production/config.yml index ad6e931e2..8ae418654 100644 --- a/deploy/production/config.yml +++ b/deploy/production/config.yml @@ -12,5 +12,3 @@ data: # The following IDs are not private, they form part of the publicly visible oauth login url. OAUTH_CLIENT_ID: "ffb808d2-312b-4ffe-a6e5-d6eacfd9f06f" OAUTH_TENANT_ID: "c6874728-71e6-41fe-a9e1-2e8c36776ad8" - WP_REDIS_DISABLED: "true" - EWWW_IMAGE_OPTIMIZER_NOAUTO: "true" From 595d041e5962284dfd49f310d585f2bdf8774b4d Mon Sep 17 00:00:00 2001 From: Damien Wilson Date: Thu, 31 Oct 2024 14:50:13 +0000 Subject: [PATCH 2/2] Blog name isse (#765) * Apply author name to blog posts * Remove duplicate code * Minor change * Update search result listing --- .../clarity/inc/content-filter/search.php | 18 +++++++++--------- .../c-article-item/view-blog-feed.php | 12 ++++-------- .../c-article-item/view-news-feed.php | 4 ++-- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/public/app/themes/clarity/inc/content-filter/search.php b/public/app/themes/clarity/inc/content-filter/search.php index 275145421..874cfd8c4 100644 --- a/public/app/themes/clarity/inc/content-filter/search.php +++ b/public/app/themes/clarity/inc/content-filter/search.php @@ -19,7 +19,6 @@ class Search { - /** * FilterSearch constructor. * @@ -51,7 +50,7 @@ public function hooks(): void * @return void */ - public function loadEventSearchResults() + public function loadEventSearchResults(): void { if (!wp_verify_nonce($_POST['_nonce'], 'search_filter_nonce')) { exit('Access not allowed.'); @@ -76,7 +75,7 @@ public function loadEventSearchResults() $events = $events_helper->get_events($agency_term_id, $filter_options) ?? []; - return wp_send_json([ + wp_send_json([ 'aggregates' => [ 'totalResults' => count($events), 'resultsPerPage' => -1, @@ -85,7 +84,7 @@ public function loadEventSearchResults() 'results' => [ 'templateName' => "c-events-item-list", 'posts' => array_map([$this, 'mapEventResult'], $events), - ], + ] ]); } @@ -143,12 +142,13 @@ public function mapPostResult(\WP_Post $post) $thumbnail = get_the_post_thumbnail_url($post->ID, 'user-thumb'); $thumbnail_alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true); - $author = $post->post_author; - $author_display_name = $author ? get_the_author_meta('display_name', $author) : ''; + $authors = new Authors(); + $authors = $authors->getAuthorInfo($post->ID); + $author = $authors[0] ?? false; + $author_display_name = $author['name'] ?? false; if (!$thumbnail) { - // Mutate thumbnail with author image. - $thumbnail = $author ? get_the_author_meta('thumbnail_avatar', $author) : false; + $thumbnail = $author['thumbnail_url'] ?? false; $thumbnail_alt = $author_display_name; } @@ -161,7 +161,7 @@ public function mapPostResult(\WP_Post $post) 'permalink' => get_permalink($post->ID), 'post_thumbnail' => $thumbnail, 'post_thumbnail_alt' => $thumbnail_alt, - 'author_display_name' => $author ? get_the_author_meta('display_name', $author) : '', + 'author_display_name' => $author_display_name, ]; } diff --git a/public/app/themes/clarity/src/components/c-article-item/view-blog-feed.php b/public/app/themes/clarity/src/components/c-article-item/view-blog-feed.php index 92d230eed..f57838861 100644 --- a/public/app/themes/clarity/src/components/c-article-item/view-blog-feed.php +++ b/public/app/themes/clarity/src/components/c-article-item/view-blog-feed.php @@ -10,23 +10,19 @@ use MOJ\Intranet\Authors; // Parse template args. -$show_excerpt = isset($args['show_excerpt']) ? $args['show_excerpt'] : true; +$show_excerpt = !isset($args['show_excerpt']) || $args['show_excerpt']; $id = $post->ID; $thumbnail = get_the_post_thumbnail_url($id, 'user-thumb'); $thumbnail_alt = get_post_meta(get_post_thumbnail_id($id), '_wp_attachment_image_alt', true); -// TODO: Why is this here? It's not used. -// If it should be here, make sure to update `Search->mapPostResult()` $oAuthor = new Authors(); $authors = $oAuthor->getAuthorInfo($id); - -$author = $post->post_author; -$author_display_name = $author ? get_the_author_meta('display_name', $author) : ''; +$author = $authors[0] ?? false; +$author_display_name = $author['name'] ?? false; if (!$thumbnail) { - // Mutate thumbnail with author image. - $thumbnail = $author ? get_the_author_meta('thumbnail_avatar', $author) : false; + $thumbnail = $author['thumbnail_url'] ?? false; $thumbnail_alt = $author_display_name; } diff --git a/public/app/themes/clarity/src/components/c-article-item/view-news-feed.php b/public/app/themes/clarity/src/components/c-article-item/view-news-feed.php index 7e07fbfec..79319383f 100644 --- a/public/app/themes/clarity/src/components/c-article-item/view-news-feed.php +++ b/public/app/themes/clarity/src/components/c-article-item/view-news-feed.php @@ -7,14 +7,14 @@ */ // Parse template args. -$show_excerpt = isset($args['show_excerpt']) ? $args['show_excerpt'] : true; +$show_excerpt = !isset($args['show_excerpt']) || $args['show_excerpt']; $id = $post->ID; $thumbnail = get_the_post_thumbnail_url($id, 'user-thumb'); $thumbnail_alt = get_post_meta(get_post_thumbnail_id($id), '_wp_attachment_image_alt', true); $link = get_the_permalink($post->ID); -// This component sometimes requires `$set_cpt` depending where this component gets called. +// This component sometimes requires `$set_cpt` depending on where this component gets called. if (! isset($set_cpt)) { $set_cpt = ''; }