Skip to content

Instantly share code, notes, and snippets.

@bradfranklin
Created February 14, 2018 07:31
Show Gist options
  • Save bradfranklin/17f364d1681f6c4cfcf755d8689d7996 to your computer and use it in GitHub Desktop.
Save bradfranklin/17f364d1681f6c4cfcf755d8689d7996 to your computer and use it in GitHub Desktop.
Wp head - iOS - view site in full screen mode
// Wrote this a couple of weeks ago. Thought I'd share.
// Code adds "add to home screen" full screen functionality. (iOS). Not sure about android. Test project currently
// Adding meta tags, media queries via wp_head action hook
add_action( 'wp_head' , 'j66labs_addMeta' );
function j66labs_addMeta() {
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo '<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0 minimal-ui"/>';
echo '<meta name="apple-mobile-web-app-capable" content="yes"/>';
echo '<meta name="apple-mobile-web-app-status-bar-style" content="black">';
}
?>
<?php
// adding web app icons links via wp_head
add_action( 'wp_head' , 'j66labs_addWebAppIcons' );
function j66labs_addWebAppIcons() {
?>
<link rel="icon" type="image/png" href="<?php echo home_url();?>/uploads/splash/android-chrome-192x192.png" sizes="192x192" />
<link rel="apple-touch-icon" sizes="196x196" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-196x196.png" />
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-180x180.png" />
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-152x152.png" />
<link rel="apple-touch-icon" sizes="144x144" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo home_url();?>/wp-content/uploads/splash/apple-touch-icon-57x57.png" />
<link rel="icon" type="image/png" href="<?php echo home_url();?>/wp-content/uploads/splash/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/png" href="<?php echo home_url();?>/wp-content/uploads/splash/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="<?php echo home_url();?>/wp-content/uploads/splash/favicon-16x16.png" sizes="16x16" />
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment