Dukeo » WordPress » Adding a Favicon: The Proper Way

Adding a Favicon: The Proper Way

Steven WordPress

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:

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.

If you enjoyed this article,
Get email updates

Join for Free »