Setting of favicon in WordPress
The favicon of any site plays vital role to display the brand of small logo on the website title page. The favicon of website should need to be eye catche. so we can enable put the favicon in theme using wordpress coding standard.
Generally favicon image size is [Width : 16px and Height:16px ]
Put the image favicon.ico icon type image into the theme directory same as function.php file level
Location : [<project_folder_name>/wp-content/themes/<theme_name>/favicon.ico].
Then Add the below wp_head hook on to the template function function.php file.
Location : [<project_folder_name>/wp-content/themes/<theme_name>/function.php].
function prakash_favicon() {
$favicon = get_template_directory_uri().”/favicon.ico”;
echo ‘<link rel=”shortcut icon” href=”‘.$favicon.'” title=”Favicon” />’;
}
add_action(‘wp_head’, ‘prakash_favicon’);
You can easyly change your any images to icon type by using this site.