{"id":399,"date":"2010-06-29T13:25:51","date_gmt":"2010-06-29T13:25:51","guid":{"rendered":"https://www.divydovy.com/?p=399"},"modified":"2020-01-23T10:30:14","modified_gmt":"2020-01-23T10:30:14","slug":"easy-thematic-favicons","status":"publish","type":"post","link":"https://www.divydovy.com/2010/06/easy-thematic-favicons/","title":{"rendered":"Easy Thematic Favicons"},"content":{"rendered":"<p>Continuing with my <a title=\"divydovy's Web pages\" href=\"/web/\">modest efforts</a> to post some useful Thematic/WordPress snippets, here&#8217;s some code to provide favicons for WordPress sites using Thematic child themes. Simply add this code to your child theme&#8217;s functions.php page:</p>\n<p><code><br />\n// Add favicons to the child theme<br />\nfunction childFavicons() { ?&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/favicon_16x16.png\" /&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/favicon_32x32.png\" /&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/favicon_64x64.png\" /&gt;<br />\n&lt;?php }<br />\nadd_action('wp_head','childFavicons');<br />\n</code></p>\n<p>Here&#8217;s a variation to provide different favicons for two different versions of the same site, for example for staging and live sites:</p>\n<p><code><br />\n// Add favicons to the child theme<br />\nfunction childFavicons() {<br />\n//detect if is live site<br />\nif (strtolower($_SERVER[\"HTTP_HOST\"] == \"www.domain.com\"))<br />\n{ ?&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/favicon_16x16.png\" /&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/favicon_32x32.png\" /&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/favicon_64x64.png\" /&gt;<br />\n&lt;?php } elseif (strtolower($_SERVER[\"HTTP_HOST\"] == \"stg.domain.com\"))<br />\n{ ?&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/stg_favicon_16x16.png\" /&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/stg_favicon_32x32.png\" /&gt;<br />\n&lt;link rel=\"icon\" type=\"image/png\" href=\"/wp-content/themes/childtheme/images/stg_favicon_64x64.png\" /&gt;<br />\n&lt;?php }<br />\n}<br />\nadd_action('wp_head','childFavicons');<br />\n</code></p>\n<p>Should work OK &#8211; let me know in the comments if you have any probs.</p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing with my modest efforts to post some useful Thematic/WordPress snippets, here&#8217;s some code to provide favicons for WordPress sites using Thematic child themes. Simply add this code to your child theme&#8217;s functions.php page: // Add favicons to the child theme function childFavicons() { ?&gt; &lt;link rel=&#8221;icon&#8221; type=&#8221;image/png&#8221; href=&#8221;/wp-content/themes/childtheme/images/favicon_16x16.png&#8221; /&gt; &lt;link rel=&#8221;icon&#8221; type=&#8221;image/png&#8221; href=&#8221;/wp-content/themes/childtheme/images/favicon_32x32.png&#8221; /&gt; &lt;link rel=&#8221;icon&#8221; type=&#8221;image/png&#8221; href=&#8221;/wp-content/themes/childtheme/images/favicon_64x64.png&#8221; /&gt; &lt;?php } add_action(&#8216;wp_head&#8217;,&#8217;childFavicons&#8217;); Here&#8217;s a variation to provide different favicons for two different versions of the same site, for example for staging and live sites: // Add favicons to the child theme function childFavicons() { //detect if is live site [&hellip;]</p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","clkt_auto_upload":"0","_clkt_publish_and_upload":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wordproof_timestamp":false},"categories":[7],"tags":[151,168,165,140,125],"my_content_publications":[],"class_list":["post-399","type-post","status-publish","format-standard","hentry","category-web","tag-child-theme","tag-favicons","tag-functions","tag-thematic","tag-wordpress"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"clkt_attachments":{"featured_image":null,"inline_attachments":[],"upload_candidates":[],"max_free_size":102400,"max_allowed_size":104857600},"_clkt_upload_mode":"new_only","clkt_content_hash":"86d1434fb9067de7297cf73755b29c3f18934cc148c82b3a301a75c211afcc82","customFields":{"clkt_auto_upload":"0","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"processed_attachments":{"total_attachments":0,"uploaded_to_arweave":0,"kept_original_urls":0,"upload_summary":{"total":0,"uploaded":0,"failed":0,"too_large":0,"reused":0}}},"paymentAddress":"8_-tV4d15kVVq9Gd-Al2MAIC3LqNtJ_KgFol71TzxPw"}