oblax
September 10, 2013, 9:59am
1
Hello when I generate a code like this on the head.php:
<link rel="icon" type="image/x-icon" href="<?php echo THEME_PATH ?>/assets/icons/favicon.ico" />
It will output like this:
<link rel="icon" type="image/x-icon" href="wp-content/themes/responsive/assets/ico/favicon.ico" />
How do we do it so that it will appear
<link rel="icon" type="image/x-icon" href="/assets/icons/favicon.ico" />
Sorry for this question. I’m a beginner.
oblax
September 14, 2013, 11:49am
2
I resoved this. My apologies for that short reply. I test to remove the
<?php echo THEME_PATH ?>/
and it worked. It should just be
<link rel="icon" type="image/x-icon" href="assets/icons/favicon.ico" />
It’ll be great if the favicon code will be added to the roots theme on future release.
ben
September 14, 2013, 2:55pm
3
Please don’t post things like this without posting your solution, it’s very frustrating to people who have the same issue that would come across this thread.
I don’t know why you tried THEME_PATH
, but the correct way is using get_template_directory_uri()
1 Like
Must be something like this:
<link rel="icon" type="image/x-icon" href="<?php echo get_template_directory_uri(); ?>/assets/img/favicon.ico" />
bersam
March 7, 2015, 2:25am
5
As I found out, in latest version of sage you should use asset_path function. like this:
<link rel="icon" type="image/x-icon" href="<?= Assets\asset_path('images/favicon.ico') ?>" />
and do not forget to add “<?php use Roots\Sage\Assets; ?>” before using Assets class.
1 Like
Where can I read more about this?
raffen
August 25, 2015, 7:19pm
7
Hi. Where do you guys usually put the favicon stuff? Of course head.php would be a good solution for most occasions, but somehow it doesn’t feel alright. Why not through wp_head();?
What’s the best solution?
It’s built in to WP 4.3 now, I would just use that.
5 Likes
raffen
August 26, 2015, 3:13pm
9
Damn. Didn’t know that. Tried with the suggested 512x512 image and it works flawlessly.
mZoo
September 22, 2015, 2:09pm
10
Instructions for how to use the new WP Favicon feature .
It’s under Admin-> Appearance->Customize->Site Identy — Favicon.
They want you to upload a file at least 512pixels.
6 Likes