in WordPress

Add Custom Favicon To Your Wordpress Blog

A favicon (short for ‘favorites icon’), are little icons associated with a particular website shown next to the site’s name in the URL bar of most browsers. This will also appear in the tabs of the browser which makes your website easy to notice. If your website has a custom favicon and you don't want to change the theme favicon then you can create a hook to add an action into the head tag. The below snippet will add a link tag with the website URL plus the favicon link, just add this to the functions.php


<?php
// add a favicon to your
function blog_favicon() {
     echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('url').'/favicon.ico" />';
}
add_action('wp_head', 'blog_favicon');
?>

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email