Using a Specific Favicon Per WordPress Theme

by Justin on October 17, 2008

I really like using the favicon. Favicons are great for branding purposes as they show up as a graphic in the URL bar and also when a page is bookmarked. While themes do not change much in WordPress I thought it would be nice to have a favicon that is specific for that theme. If I switch themes the new theme will need a favicon or nothing (or maybe the default favicon I haven’t tried that) will be shown. First create your 16×16 pixel favicon as described in this post and upload the file called favicon.ico to your BLOG/wp-content/themes/THEMENAME/images directory. Next up in the wordpress admin (or shell or text editor) open up the themes header.php file. Add this one line:

Download text file, WP (or server) won’t show the correct line.

You will then see your favicon in your browser window ONLY when browsing your site. Not in the wp-admin area because your theme is not being used in the admin area.

What do you think? Sure this is extra work as you could simply put this in the root folder but the geek in me likes the control. This could also be useful for distributing a free wordpress theme and branding.

{ 6 comments… read them below or add one }

Dennis Edell October 18, 2008 at 6:36 pm

What one line?

Dennis Edells last blog post..So I’ve Started to Monetize – Link Love Style ;)

Reply

Justin October 21, 2008 at 8:51 am

@Dennis – I have fixed the code. Now it’s in an external text file. WP or the hosting server would not let me show the php code.

Reply

shaxx October 21, 2008 at 9:26 pm

Favicon is a must for me! Cheers!

shaxxs last blog post..Jalan Shaxx Beruang

Reply

Dennis Edell October 22, 2008 at 3:30 am

Thought so, thanks for the link. :)

Dennis Edells last blog post..Don’t Be Like Jack…

Reply

Soula Digital Design November 10, 2008 at 5:08 am

Nice one, there are already plugins to manage favicons but I always hate using plugins for stuff thats easy to do without because they are potential security risks.

Reply

Web Design Liverpool November 11, 2008 at 8:27 am

Nothing to do with Wordpress but you know what i really hate? When people are using Joomla and keep the default favicon, its so easy to change, and when i see a site with it i just think it looks so unprofessional and lazy.

Reply

Leave a Comment

Previous post:

Next post: