mindctrl/alienship

Favicon

Closed this issue · 2 comments

:)

Maybe its not something really important but i think you forgot to include the favicon in header.php ....

something like

<link rel="Shortcut Icon" href="<?php echo get_stylesheet_directory_uri(); ?>/img/favicon.ico" type="image/x-icon" />

Hey @wrongman , I probably should add something for that. In the meantime, if you drop a favicon.ico in your root / folder, I think all major browsers will pick it up without having to be told.

I looked into this before, and I think the .ico format is the only one that all browsers officially support. I've seen a lot of people use png format, but according to some things I found not all browsers support that.

I'll think about this some more.

@wrongman I thought more about this and I think I'm going to leave it out. Here's why:

  1. I don't feel like a favicon should be tied to a theme, since it's a brand identity thing and likely not to change if someone changes themes.
  2. All major browsers support favicon.ico if it exists in the root folder, making it easy to add one without adding any code at all.

But, if you want to add another file format like png or want to add it to the theme for another reason, you can do it by easily hooking alienship_head with this code in your child theme:

function alienship_do_favicon() {
  echo '<link rel="shortcut icon" href="'. alienship_locate_template_uri('img/favicon.png') .'">';
}
add_action('alienship_head', 'alienship_do_favicon', 2);

Thanks for bringing this up and making me think about it. If you have any questions or other feedback please share.