This code snippet will help you to display your own Favicon in Genesis Child Themes.

/** Adding custom Favicon */
add_filter( 'genesis_pre_load_favicon', 'custom_favicon' );
function custom_favicon( $favicon_url ) {
	return 'http://www.wpstuffs.com/images/favicon.png';
}

In above Replace the line http://www.wpstuffs.com/wp-content/uploads/2013/05/favicon.png with a link to your own favicon link.

Paste the modified code in your child themes functions.php file.

Favicon URL relative to the website

If you want to use relative URL to define the favicon Image.Use the following code

/** Adding custom Favicon */
add_filter( 'genesis_pre_load_favicon', 'custom_favicon' );
function custom_favicon( $favicon_url ) {
	return ''. trailingslashit( get_bloginfo('url') ) .'/wp-content/themes/child-theme-name/images/favicon.png';
}

In above code replace child-theme-name with your child theme folder name and place the favicon in images folder(inside child theme folder).

This will be useful when you are distributing a Genesis Child Theme theme.

References

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge