Tip: Favicon Function

If you have a favicon you want to add to your WordPress powered blog, you can simply add a function to your functions.php file from inside your theme directory.

Here is the snippet:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php /**
 * FAVICON
 * @WPCult.com
 */
function my_favicon() { ?>
	<link rel="shortcut icon" href="<?php echo bloginfo("template_directory"); ?>/images/favicon.ico" />
<?php }

add_action('wp_head', 'my_favicon'); ?>

Please note that you have to add a favicon in .ico format (or .gif / .png) and you have to upload that to your theme directory inside the /images/ folder. If you have located the favicon somewhere else, please do correct the href path.

Snipped build by WPCult.

This article is written by:

Name:

URL: http://www.wptoy.com/

Description: I am Stefan Vervoort, WordPress enthusiast from the Netherlands. I also write for DivitoDesign.

Comments are closed.