Last active
February 27, 2019 11:28
-
-
Save charleslouis/5661830 to your computer and use it in GitHub Desktop.
PHP - Wordpress - embed favicon and touch icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Créer les icones suivantes en respectant les noms et dimensions des images : | |
name = "favicon.png" - size="16x16" | |
name = "favicon.ico" - size="16x16" | |
<!-- For third-generation iPad with high-resolution Retina display: --> | |
name = "apple-touch-icon-144x144-precomposed.png" - size="144x144" | |
<!-- For iPhone with high-resolution Retina display: --> | |
name = "apple-touch-icon-114x114-precomposed.png" - size="114x114" | |
<!-- For first- and second-generation iPad: --> | |
name = "apple-touch-icon-72x72-precomposed.png" - size="72x72" | |
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: --> | |
name = "apple-touch-icon.png" - size="72x72" | |
name = "apple-touch-icon-precomposed.png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// icons.php | |
define('ICONS_FOLDER', get_stylesheet_directory_uri()."/_inc/img/icones"); // define Icon folder to be used in embed_touchIcons() in icons.php | |
function embed_touchIcons() { | |
// embed touch icons and facebook pics | |
echo '\n\t | |
<link rel="icon" type="image/png" sizes="16x16" href="'. ICONS_FOLDER .'/favicon.png"> | |
<link rel="icon" type="image/ico" sizes="16x16" href="'. ICONS_FOLDER .'/favicon.ico"> | |
<!-- For third-generation iPad with high-resolution Retina display: --> | |
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="'. ICONS_FOLDER .'/apple-touch-icon-144x144-precomposed.png"> | |
<!-- For iPhone with high-resolution Retina display: --> | |
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="'. ICONS_FOLDER .'/apple-touch-icon-114x114-precomposed.png"> | |
<!-- For first- and second-generation iPad: --> | |
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="'. ICONS_FOLDER .'/apple-touch-icon-72x72-precomposed.png"> | |
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: --> | |
<link rel="apple-touch-icon" sizes="72x72" href="'. ICONS_FOLDER .'/apple-touch-icon.png"> | |
<link rel="apple-touch-icon-precomposed" href="'. ICONS_FOLDER .'/apple-touch-icon-precomposed.png"> | |
<!-- For Facebook and co. --> | |
<link rel="image_src" href="'. ICONS_FOLDER .'/apple-touch-icon-144x144-precomposed.png"> | |
<link rel="image_src" href="'. ICONS_FOLDER .'/logo-sante-ensemble-red.png"> | |
<meta property="og:image" content="'. ICONS_FOLDER .'/apple-touch-icon-144x144-precomposed.png" /> | |
<meta property="og:image" content="'. ICONS_FOLDER .'/logo-sante-ensemble-red.png" />\n'; | |
} | |
add_action('myBp_head', 'embed_touchIcons'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment