If you want your blog to appear professional and to be taken seriously by your peers, there is a number of basic steps you must take, including having your very own favicon. Of course, you could easily add a favicon by editing your header.php file and adding some code there, but it’s not really a clean way to do that.
To add a favicon to your WordPress blog the proper way, you should paste the following code in the functions.php file of your WordPress theme:
1 2 3 4 5 6 7
function dukeo_favicon() { ?>
<link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/img/favicon.ico" />
<?php }
add_action('wp_head', 'dukeo_favicon');Make sure you edit the url to the favicon file, for the favicon to be displayed properly.

