WordPress tutorials: Insert favicon with function

Wpsnipp – Nowadays, any serious blog have its own favicon. To add yours into WordPress, you can directly edit header.php or you can use a more clean technique, using the power of WordPress hooks.Adding this PHP code to your functions.php of your wordpress theme will insert the HTML for your favicon.

 

 

function myfavicon() {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('wpurl').'/favicon.ico" />';
}
add_action('wp_head', 'myfavicon');

Be Sociable, Share!

Leave a comment