Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Genesis Favicons
<?php
// Filter to customize favicon and add Apple Touch Icons
add_filter( 'genesis_pre_load_favicon', 'gs_pre_load_favicon');
function gs_pre_load_favicon() {
$favicon_directory = get_stylesheet_directory_uri() . '/images/';
echo '<link rel="shortcut icon" href="' . $favicon_directory . 'favicon.ico">'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="57x57" href="' . $favicon_directory . 'apple-touch-icon-57x57.png" />' . PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . $favicon_directory . 'apple-touch-icon-114x114.png" />'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="72x72" href="' . $favicon_directory . 'apple-touch-icon-72x72.png" />'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="144x144" href="' . $favicon_directory . 'apple-touch-icon-144x144.png" />'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="60x60" href="' . $favicon_directory . 'apple-touch-icon-60x60.png" />'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="120x120" href="' . $favicon_directory . 'apple-touch-icon-120x120.png" />'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="76x76" href="' . $favicon_directory . 'apple-touch-icon-76x76.png" />'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="152x152" href="' . $favicon_directory . 'apple-touch-icon-152x152.png" />'. PHP_EOL
.'<link rel="icon" type="image/png" href="' . $favicon_directory . 'favicon-196x196.png" sizes="196x196" />'. PHP_EOL
.'<link rel="icon" type="image/png" href="' . $favicon_directory . 'favicon-96x96.png" sizes="96x96" />'. PHP_EOL
.'<link rel="icon" type="image/png" href="' . $favicon_directory . 'favicon-32x32.png" sizes="32x32" />'. PHP_EOL
.'<link rel="icon" type="image/png" href="' . $favicon_directory . 'favicon-16x16.png" sizes="16x16" />'. PHP_EOL
.'<link rel="icon" type="image/png" href="' . $favicon_directory . 'favicon-128.png" sizes="128x128" />';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment