From 5040f399928bc13c9edeaf0fe3d0bf76c049217c Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 11 Aug 2021 15:57:24 +0800 Subject: [PATCH] Add apple_touch_startup_images filter This adds an apple_touch_startup_images filter for plugins/themes to adjust the rel="apple-touch-startup-image" link tags outputted. This allows more images to be added, with an applicable media attribute for each image. Fixes https://github.com/GoogleChromeLabs/pwa-wp/issues/586. --- wp-includes/class-wp-web-app-manifest.php | 43 ++++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-web-app-manifest.php b/wp-includes/class-wp-web-app-manifest.php index 4836af00c..4c349f492 100644 --- a/wp-includes/class-wp-web-app-manifest.php +++ b/wp-includes/class-wp-web-app-manifest.php @@ -83,15 +83,48 @@ public function manifest_link_and_meta() { ?> + - - - - $icon['src'] ); + } + + /** + * Filters splash screen images for Safari on iOS. + * + * @param array $images { + * Array of splash screen images and their attributes. + * + * @type array ...$0 { + * Array of splash screen image attributes. + * + * @type string $href URL of splash screen image. Required. + * @type string $media Media query for when the splash screen image should be used. + * } + * } + */ + $images = apply_filters( 'apple_touch_startup_images', $images ); + + foreach ( $images as $key => $image ) { + if ( ! is_array( $image ) ) { + continue; + } + + if ( ! isset( $image['href'] ) || ! esc_url( $image['href'], array( 'http', 'https' ) ) ) { + continue; + } + + printf( '\n"; + } break; endswitch; ?>