changing favicon in wordpress theme

I am customizing a a word press theme for my blog. I am trying to change the favicon, But I do not know how to do that. I checked all settings, there is no option for favicon. Can anybody will tell me how to change that.

Answers


I usually add a favicon in my site's root directory because some browsers look there by default.

function so18074365_favicon() {
  printf( "<link rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\" href=\"%s/favicon.ico\" />\n", site_url() );
}

add_action( 'wp_head', 's018074365_favicon' );

Add this function to your functions.php and upload your favicon.ico to your wordpress root folder.

If you want to add the favicon in yout theme folder, add this one:

function so18074365_favicon() {
  printf( "<link rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\" href=\"%s/favicon.ico\" />\n", get_stylesheet_directory_uri() );
}

add_action( 'wp_head', 's018074365_favicon' );

–°onsidering the Wordpress Codex you'd

  1. Go to your WordPress Administration Panel.
  2. Click on Design (called Presentation in WordPress 2.3.x and below, and Appearance in WordPress 2.7+).
  3. Click on Theme Editor.
  4. Select the file called Header or header.php to edit the file.
  5. Search for the line of code that begins with <link rel="shortcut icon" and ends with /favicon.ico" />. Overwrite it, if it exists, or add the following code below the <head> HTML tag. <link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />

  6. Save the changes.

Note. Dont forget to upload favico into you current theme root via any acceptable way.

Hope it helps. Cheers!


Need Your Help

rand() function does not work properly in C++

c++ search random binary

I am writing a game where the computer chooses a random number that a user has to guess. Then, It is the user to choose a number (he just guesses a number) that the computer has to guess. The probl...

Expanding a DIV with an Unordered List

javascript html css html5 css3

I'm looking at having an unordered list that filters through some of my work. I have the filter working perfectly fine (not in this example) and I am now at the stage where I am having difficulty

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.