Skip to content

Instantly share code, notes, and snippets.

@jimmy89Li
Last active September 16, 2015 08:13
Show Gist options
  • Save jimmy89Li/661e53eafc81cad83c5f to your computer and use it in GitHub Desktop.
Save jimmy89Li/661e53eafc81cad83c5f to your computer and use it in GitHub Desktop.
PHP code inside functions.php to load facivon.ico file as your website favicon
//add a favicon for your WordPress website
function blog_favicon() {
//this will load the favicon from the root directory of your blog
// echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('wpurl').'/favicon.ico" />';
//this will load the favicon from the root directory of your theme
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('stylesheet_directory').'/favicon.ico" />' . "\n";
}
add_action('wp_head', 'blog_favicon');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment