Adding a favicon to your site
Looking to add a favicon to you site?
Inside your WordPress theme’s functions file (functions.php) add the following to inside your PHP code.
/**
* FAVICON
* @WPCult.com
*/
function my_favicon() { ?>
<link rel="shortcut icon" href="<?php echo bloginfo("stylesheet_directory") ?>'/images/favicon.ico" />
<?php }
add_action('wp_head', 'my_favicon');
That’s it, just be sure to upload an icon image or a .gif/.png. Be sure to correct the target location id the file is located somewhere else.
Related Posts
2 Trackbacks
- Tip: Favicon Function « WP TOY
April 3, 2009 1:03 AM - WordPress articles for 03.04.09 | WPStart.org - WordPress themes, plugins and news
April 3, 2009 4:45 PM

Digg
Furl
Reddit
del.icio.us
StumbleUpon
MySpace
Facebook
TwitThis
YahooBuzz
Mixx
Propeller
Slashdot
April 2, 2009
11:37 pm
The backstory on why it’s traditionally a .ico (instead of .gif or .jpg) is actually pretty interesting – you can read up on it on this wikipedia entry:
http://en.wikipedia.org/wiki/Favicon
Ok, so maybe its only interesting to me
.
Peter´s last blog post..Creating User Friendly Custom Fields by Modifying the Post Page
April 3, 2009
10:00 am
Yeah, I’ve read it. Though with more browsers supporting it, I typically like to use transparent png’s these days.
April 18, 2009
1:24 pm
Thanks great post.
April 27, 2009
1:17 pm
Is there a benefit to doing it this way, instead of just adding into the header.php?
April 27, 2009
2:06 pm
No difference.
October 29, 2009
4:13 pm
Moved from blogspot to wordpress and then was searchinhg for a way to add favicon to my blog then got here thnx.
How To Add Favicon To Your Blogspot Blog