December 12, 2014
·1 min read
Adding a Favicon correctly in WordPress
There are 19 different ways to “load” a favicon. You can put it in the of the site, just like how you would with a static site. I tend to a lot of people recommending of dropping your favicon into the root of your site, for example: https://aaronreimann.com/favicon.ico. But, what if people switch hosting and they only grab the wp-content directory?
I think it is best is to have it integrated into the theme, by using the steps:
-
Grab your PNG/GIF/JPG and go to http://favicon-generator.org/ and upload the file. They will generate a true .ico file at 16px by 16px.
-
Take your PNG at 152×152 and put it in your theme directory, in (for this example) /images. Put your .ico file you just downloaded and put it in the same directory.
-
Drop in this code in your functions.php in your theme.
`function twpw_add_favicon() { ?>