Wordpress blog favicon problem - html

I am trying to upload a favicon in my wordpress site. I have followed every step correctly but still its not showing the favicon. Fisrt I converted my pic to favicon.ico . Then I uploaded it to my root directory. Then I added the following code to my header.php file in the <head> tag :
<link rel="shortcut icon" href="http://misspassiton.com.au/favicon.ico" />
I have tried this one as well
<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
I have also visited : http://codex.wordpress.org/Creating_a_Favicon
but nothing seems to be working. I dont know whats wrong with it. I would be grateful, if anyone could help me
Regards
Omayr.

It seems that your .ico file is corrupted. I can't open it in my browser. Other than that, it looks like you are doing everything ok.
If you can open http://misspassiton.com.au/favicon.ico directly in your browser, then you'll know it's working.

Requesting http://misspassiton.com.au/favicon.ico, it responds but seems that the image is broken. So the href is ok ;)
2 suggestions:
First: try to use a tool that
converts images in ico (i.e.
http://www.favicon.cc/)
Second: if you want to use
bloginfo(), you have to pass as
parameter 'url' because if you pass
'template_directory' it will return
'http://example/home/wp/wp-content/themes/parent-theme' that is completely wrong and as you can see it doesn't point to public root
(see the reference)
edit : add also type on the link (for IE)
<link rel="shortcut icon" href="http://misspassiton.com.au/favicon.ico" type="image/vnd.microsoft.icon" />

I was having the same problem. The code below worked. Add to the header.php file right before the end head tag. Your image should be in the root of your wordpress installation.
/* ADD FAVICON */
<link rel="icon" href="<?php bloginfo('siteurl'); ?>/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<?php bloginfo('siteurl'); ?>/favicon.ico" type="image/x-icon" />

Related

Browser tab icon is not showing up

I am making a website and there is an error.
It won't show the website icon.
Proof: https://i.stack.imgur.com/053Xh.png
Code:
<link rel="icon" href="images/favicon32.ico" type="image/x-icon"
You are not closing the link tag add this " /> " at the end
<link rel="icon" href="images/favicon32.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
Do the following things.
Please close you link tag by adding "/>"
For good practice, first move favicon in main/root folder, not in inner folders, to load it fast
Change your favicon file name into "favicon" and its extension must
be "ico" not icon. Please see the file name carefully.

Having problems displaying favicon in codeigniter. Title shows the code instead

<link rel="icon" type="image/x-icon" href="<?php echo base_url().'favicon.ico'?>">Project name</title>
I have placed favicon.ico in the root folder.
But when trying to browse the page title shows the code instead with the entire link tag.
Lost of ideas on what to do.
Solution 1:
<link rel="icon" href="<?php echo base_url(); ?>favicon.ico"> <title>Project Name. </title>
Turn's out OP wrapped into <title></title>, which causing it not working.
Solution 2:
put your favicon.ico to your project root folder, then use href="favicon.ico"

Favicon ico doesn't work

<link rel='shortcut icon' href='img/favicon.ico'>
The above line is inside head part of page.
favicon.ico is inside img folder.
Doesn't work in Firefox and Chrome.
I restarted browsers, cleared the cache many times...
Any suggestion.
I also tried:
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
You forgot to self-close the link tag.
I think it is recommended to use double quotes as well:
<link rel="shortcut icon" href="img/favicon.ico"/>
If this doesn't work, have you tried to actually access the favicon image by typing the url like: http://example.org/img/favicon.ico to make sure it is reachable ?
Try using:
<link rel="icon" type="image/x-icon"
href="image/favicon.ico"/>
without the "shortcut"
if that doesn't help, you might find something in this
Wikipedia article on favicon
If any of the other answers don't work, just put ! in front of the tag.

How to set icon of an page using CSS

Is it possible to have this code:
<link rel="icon" href="icon.gif" />
Using css document?
(I would rather not have to go through and add that to every pages)
and is it possible to set title of page using css(I am not gonna use it as all pages have different title but just for general info)
You cannot set the favicon using CSS.... You need to use a link tag with rel value of shortcut icon.
Inorder to set that, you need to put the below string in between the <head> tags..
<link rel="shortcut icon" href="favicon.ico" />
-----^-----
<!--Remember to have .ico as the extension else
some browsers fail to load other extensions -->
You need to also specify the type attribute here type="image/x-icon" if IE fails to load your favicon, if it loads fine, you can just ignore the type attribute.
You can't do it using CSS it can only be done by inserting
<link rel="icon" href="icon.gif" />
as you have described above..
CSS is used to format some text/images etc in the page and and there is nothing to format in icon let me guess if you are working on many pages you probably have either a blog or an script to generate pages just add this line of text in it..
And you can always change icon of each page at once by just changing the icon itself...:)
You can't set a favicon from CSS - if you want to do this explicitly you have to do it in the markup as you described.
Most browsers will, however, look for a favicon.ico file on the root of the web site - so if you access http://example.com most browsers will look for http://example.com/favicon.ico automatically.
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
In href, you have to pass the image url.
Here is the combination of combination of .ico and .gif image
<link rel="shortcut icon" href="favicon.ico">
<link rel="icon" type="image/gif" href="animated_favicon1.gif">

Changing in the top of the browser using HTML (favicon)

How do you change the small image showed in a browsers tab when viewing image using HTML? Sorry, I am new to programming.
The small image is what I am talking about.
it's called a favicon:
place the favicon.ico file in the www root and use the following code:
<link rel="shortcut icon" href="/favicon.ico">
Insert the following line in <head> tag
<link href="Images/tsp1.png" rel="shortcut icon" type="image/x-icon" />
Replace Images/tsp1.png with an image of your choice, make it somting like a 16x16 image
This is the Favicon. Have a look at the whikipedia article: http://en.wikipedia.org/wiki/Favicon
Have an image in ico format with name favicon.ico in the root of your site. Search for favicon.ico for more information.
It's called a favicon.
<link rel="shortcut icon" href="http://www.example.com/myicon.ico">