diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 651057a9..4937be8c 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.54.6] - 2024-03-18 + +- TMS-996: Change bold image-caption text to normal +- TMS-1009: Fix error when fetching Eventz response with languages other than fi & en +- TMS-1015: Header accessibility fixes +- TMS-1017: Add image alt-text to imported news - TMS-1018: Remove external-link icons from imported news image links ## [1.54.5] - 2024-02-01 diff --git a/lib/ACF/DynamicEventGroup.php b/lib/ACF/DynamicEventGroup.php index 97cc5ab0..6ecf3cc1 100644 --- a/lib/ACF/DynamicEventGroup.php +++ b/lib/ACF/DynamicEventGroup.php @@ -284,12 +284,19 @@ protected function get_choices_by_name( string $name, array $field ) : array { return $field; } - $cache_key = 'events-' . $name; - $response = wp_cache_get( $cache_key ); + $cache_key = 'events-' . $name; + $response = wp_cache_get( $cache_key ); + $lang_key = Localization::get_current_language(); + $request_allowed_langs = [ + 'fi', + 'en', + ]; - if ( ! $response ) { + if ( + ! $response && + in_array( $lang_key, $request_allowed_langs, true ) + ) { try { - $lang_key = Localization::get_current_language(); $client = new EventzClient( PIRKANMAA_EVENTZ_API_URL, PIRKANMAA_EVENTZ_API_KEY ); $response = $client->{'get_' . $name }( $lang_key ); @@ -307,7 +314,9 @@ protected function get_choices_by_name( string $name, array $field ) : array { if ( ! empty( $response ) ) { foreach ( $response as $item ) { - $field['choices'][ $item->_id ] = $item->name; + if ( isset( $item->_id ) ) { + $field['choices'][ $item->_id ] = $item->name; + } } } diff --git a/lib/Traits/EnrichPost.php b/lib/Traits/EnrichPost.php index c47ce59a..3ef13543 100644 --- a/lib/Traits/EnrichPost.php +++ b/lib/Traits/EnrichPost.php @@ -33,10 +33,12 @@ public static function enrich_post( int $excerpt_length = 160 ) { if ( $use_images ) { - $api_image = get_field( 'image_url', $post->ID ); + $api_image = get_field( 'image_url', $post->ID ); + $api_image_alt = get_field( 'image_alt', $post->ID ); if ( ! empty( $api_image ) ) { $post->api_image_url = $api_image; + $post->api_image_alt = $api_image_alt; } else { $post->featured_image = has_post_thumbnail( $post->ID ) diff --git a/models/single.php b/models/single.php index becff49f..85db781d 100644 --- a/models/single.php +++ b/models/single.php @@ -86,6 +86,7 @@ public function content() { : $single->image; $single->api_image_url = empty( $single->image ) ? get_field( 'image_url' ) : false; + $single->api_image_alt = empty( $single->image ) ? get_field( 'image_alt' ) : false; $single->has_image = ! empty( $single->image ) || ! empty( $single->api_image_url ); if ( 'blog-article' === $single->post_type ) { @@ -141,6 +142,7 @@ public function related() : ?array { } $item->api_image_url = get_field( 'image_url', $item->ID ); + $item->api_image_alt = get_field( 'image_alt', $item->ID ); $has_image = $item->image_id !== 0 || ! empty( $item->api_image_url ); if ( ! $has_image ) { diff --git a/partials/shared/header-inner.dust b/partials/shared/header-inner.dust index ea7c0451..9a7a89f1 100644 --- a/partials/shared/header-inner.dust +++ b/partials/shared/header-inner.dust @@ -11,14 +11,14 @@ {?Header.lang_nav_horizontal}
{image.caption|kses} -
+