Jul 10, 2011

Wordpress Dynamic Favicon

It’s simple to add your own link within the header.php file to create a favicon. However if you’d like to be a little more dynamic we can write a simple function inside our functions.php which adds our favicon into every page without fail. Below is the few lines of code required.

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

[/php]

No comments :

Post a Comment