Favicon in Web Browsers represents a unique visual identity to website. When too many tabs are open in same browser a stylish favicon makes a clear view to identify a particular website.
Although most of the new web developers don’t pay attention to this small fact but few developers who pay attention to this in wordpress theme, they do a small mistake to place the favicon in right way.
So here is the right way for Adding Favicon in WordPress Website:
- Place your favicon.ico file in root folder of wordpress theme
- Add this one line code inside <head></head> tag:
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico">
You may place your favicon.ico file in sub folder such as images. And the code for this will be like:
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/images/favicon.ico">
This code will also work greats. But here is a small problem with browsers working mechanism.
By default browsers (Specially Internet Explorer) will look favicon.ico file in wordpress theme root folder. If it can’t find favicon.ico in theme root folder, it will simply show crack ico in browser.