Child theme favicon

Hello Thierry, I found a bug in the beans code that generates the favicon link. From what I can tell, Beans look into the child theme for a favicon, and if none is found, will use Beans' default favicon... except the code to do this has a bug:

--- tm-beans/lib/templates/fragments/header.php          2016-06-17 09:10:29.763997615 -0400
+++ tm-beans/lib/templates/fragments/header.php.bugfix   2016-06-17 13:09:13.924995906 -0400                                                                   @@ -47,7 +47,7 @@
        if ( function_exists( 'has_site_icon' ) && has_site_icon() )

-       $url = file_exists( get_template_directory() . 'favicon.ico' ) ? get_template_directory_uri() . 'favicon.ico' : BEANS_URL . 'favicon.ico';
+       $url = file_exists( get_stylesheet_directory() . '/favicon.ico' ) ? get_stylesheet_directory_uri() . '/favicon.ico' : BEANS_URL . 'favicon.ico';

Hey Marc,

Thanks for reporting it. I just pushed a fix on Beans development repo so you can pull from there or manually change it in your code, since it will automatically be in the next Beans release.


Hi Thierry,

I just tried to add the pushed-a-fix code to my functions.php file (in my child theme), and got an error message saying you cannot define beans_favicon() because it is already defined (presumably in the parent beans theme). However, the browser (Chrome with default favicon directory trashed) still shows the beans favicon instead of my custom favicon, even though I uploaded the favicon (as .ico and .png) to my child theme directory (and to my child theme's images directory). Do I need to download a new functions.php file? Um, no that just says to load lib/init.php. And when I search that file for favicon, it's not there. Sigh. While I love the idea of modularity, it CAN be frustrating.

What do I need to do ??? Um, do I change the header.php file at



Please help ! Thanks !!!!

Hi Wyn,

As explained in my previous answer, you can manually apply this change in tm-beans/lib/templates/fragments/header.php and then simply drop your file in your child theme root. This won't be an issue when you update Beans since the change will automatically be added in the next release.

Alternatively, Beans has support for the customizer Site Icon option so you can add your favicon in your Admin->Appearance->Customize->Site Identity->Site Icon.


PS: kindly follow the forum rules, aka sentences are not closed with triple question/exclamation marks, even though it is out of furtration due to not reading previous replies attentively πŸ˜‰

Oops, so sorry. Did not mean to be shouting or ... whatever triple ? or ! means.

And thank you so much for expanding your answer. I have now made that change to the ...fragments... header.php file and it works beautifully.

I do point out that your previous answer did not say where that change needed to be made. However, looking over the entire thread above, I now realize that the original question contained the file url that needed to be changed, but I had not understood that at the time of my question.

Again, my apologies for not having understood all this in the first place. I do try to read everything relevant to a question before I ask one. (My eyesight is not of the best. One eye sees only a blur, the other sees double. I need cataract surgery. So reading everything carefully is a bit of a challenge for me.)

Thanks again! (Hopefully single ! is okay ?)

No worries, I am glad to hear you managed to sort it out πŸ™‚ Keep an eye on the next release changelog!

Happy coding,

Write a reply

Login or register to write a reply, it's free!