WordPress – Add a Favicon to your Blog

Every blog deserves to have its own identity. You can add this identity by adding the favicon code in your header.php file, or you can make it easier for yourself by simply adding the following code in your functions.php file.

// add a favicon to your
function blog_favicon() {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('wpurl').'http://yourdomain.com/favicon.ico" />';
}
add_action('wp_head', 'blog_favicon');

Now whenever you are developing the theme, just upload the .ico file in the root folder where the blog is uploaded. You can also modify the file destination if you like. Often theme developers forget to change the URL of the favicon. This can eliminate another worry.

Leave a Reply

Your email address will not be published. Required fields are marked *

*