I found the existing support thread about favicons, but it doesn't address my question. https://community.getbeans.io/discussion/child-theme-favicon/
I see that you, like WP, recommend I upload a 512sq image and have WP resize it in all the ways. https://codex.wordpress.org/Creating_a_Favicon But the current advice for multisize favicons seems to coalesce around this strategy https://realfavicongenerator.net/faq https://realfavicongenerator.net/blog/favicon-why-youre-doing-it-wrong/ in which (a) the primary contenders don't get anywhere near as big as 512, and (b) at that point it's likely a good idea to generate different images for use at 512 than for 200 or for 16. So I don't actually want to come up with a 512 big image that I'll also like at 16, I want to create a small fleet of images and upload them myself.
At which point, the thing I need to figure out becomes, how do I properly add a little string of link rel and meta name tags to my theme's headers? (I create a header.php? I drop something in my functions.php? Where do I find syntax for that?)
I've poked around looking at php for enqueueing stylesheets and whatnot, but I'm thinking you could save me a whole lot of time?
Many thanks, lydia
Hey Lydia,
You may use the wp_head
action to add your favicon link in the head of your website. Here is a example code snippet which you may add to your child theme functions.php
:
add_action( 'wp_head', 'example_head_extra' );
function example_head_extra() {
?><link rel="Shortcut Icon" type="image/x-icon" href="http://www.getbeans.io/wp-content/themes/tm-beans/lib/favicon.ico"><?php
}
Note that it is extremely rare that you would create files such as header.php
to add, overwrite or remove thing. 99% of the time, you will use actions and filters or Beans API functions in your child theme:-)
Have fun,
Many thanks! That was exactly what I needed. 🙂