Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output link/meta tags depending on web app manifest display value #581

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions wp-includes/class-wp-web-app-manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,27 @@ public function manifest_link_and_meta() {
?>
<link rel="manifest" href="<?php echo esc_url( static::get_url() ); ?>">
<meta name="theme-color" content="<?php echo esc_attr( $manifest['theme_color'] ); ?>">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="YES">
<?php
$icons = isset( $manifest['icons'] ) ? $manifest['icons'] : array();
usort( $icons, array( $this, 'sort_icons_callback' ) );
$icon = array_shift( $icons );
$display = isset( $manifest['display'] ) ? $manifest['display'] : '';
switch ( $display ) :
case 'fullscreen':
case 'minimal-ui':
case 'standalone':
?>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<?php
$icons = isset( $manifest['icons'] ) ? $manifest['icons'] : array();
usort( $icons, array( $this, 'sort_icons_callback' ) );
$icon = array_shift( $icons );
?>
<?php if ( ! empty( $icon ) ) : ?>
<link rel="apple-touch-startup-image" href="<?php echo esc_url( $icon['src'] ); ?>">
<?php endif; ?>
<?php
break;
endswitch;
?>
<?php if ( ! empty( $icon ) ) : ?>
<link rel="apple-touch-startup-image" href="<?php echo esc_url( $icon['src'] ); ?>">
<?php endif; ?>

<?php $name = isset( $manifest['short_name'] ) ? $manifest['short_name'] : $manifest['name']; ?>
<meta name="apple-mobile-web-app-title" content="<?php echo esc_attr( $name ); ?>">
Expand Down