27 Jan 2020

How to add Favicon in your WordPress site

Update: Favicon feature is available in WordPress core from version 4.3. Site Icon

What is a Favicon ?
A favicon is a small … 16px by 16px … image. Your favicon usually appears right before your web site name in the browser location bar, in browser tabs, in browser favorites, in RSS readers, and the like.

A favicon (short for favorites icon), also known as a website icon, shortcut icon, url icon, or bookmark icon is a 16×16,32×32 or 64×64 pixel square icon associated with a particular website or webpage.

Why do I want one?
Favicons can help identify your web site or blog across the Internet. These images become increasingly useful the more people use RSS readers and tabbed browsing. It offers the reader a visual reference allowing them to quickly identify your web site.
Step 1: Create Favicon
Your favicon image can be a .ico or .png. This can pose a little bit of a problem as some desktop image programs do not allow for the saving of images in the .ico format. If this is the case with your program, you can can save your image as a .GIF, .JPG, or .PNG and then use an online conversion program. You can create a 100 x 100 image, for example, and the conversion program will also shrink your image. I generally use Dynamic Drive conversion tool. ( Favicon Generator ) You can also find many different programs that allow you to create a favicon online.
Step 2: Upload you Favicon
Using your favorite FTP program or CPanel, upload your favicon to your WordPress theme’s main folder. For example, if your theme is ‘mytheme’ then …/wp-content/themes/mytheme/
Step 3: Link your Favicon
Now in your theme folder open header.php in your favorite editor and add following line in between <head>and </head>

<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />

Nilambar

PHP Programmer, WordPress and Laravel Developer, Freelancer and a Blogger.

View all posts by Nilambar →

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.