[WordPress] I tried installing favicon using code

I tried setting a favicon using code in WordPress

Hello, this is naouniverse ( @naouniverse708 ).

We have installed a favicon, that small icon image that appears next to browser tabs, address bars, and bookmarked URLs.

I feel like having a favicon gives it a somewhat neater look when you look at it from a bird's-eye view.
You can also differentiate your site from other sites.

So, I'll leave it as a memorandum below.

In WordPress, there seems to be a convenient way to install a favicon using a plugin, but this time I installed a favicon using code as shown below.

First, convert the created image to favicon format and save it. The extension is "ico".
This time, I created a file with a file name such as favicon.ico.

Next, place the created favicon file (favicon.ico) in wp-content/themes/template name/ of WordPress.

and,<head></head> inside</head> I just added the following code.

<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />

This time, I converted and used the image without resizing the logo in the header, but it still seems to display well.
(*It may not be displayed depending on the browser.)

It's relatively easy to set up, so I think there's no harm in trying it out.

  • Add this entry to Hatena Bookmarks

At "naouniverse.com", the administrator writes about things, things, and the world that interest him.
Gadgets, cameras, design, programming, L'Arc~en~Ciel, etc...