admin管理员组文章数量:1125938
its possible use to change the favicon on based the post-featured image icon? I use 100x100 size or 64x64 icon images on my posts. I want these icons to show as a favicon also. if some posts not have featured images then show our default favicon. help me out how to this work through ad-filter or ad-action.
its possible use to change the favicon on based the post-featured image icon? I use 100x100 size or 64x64 icon images on my posts. I want these icons to show as a favicon also. if some posts not have featured images then show our default favicon. help me out how to this work through ad-filter or ad-action.
Share Improve this question asked Jan 30, 2024 at 6:51 SS AppsSS Apps 31 bronze badge 2 |1 Answer
Reset to default 0You can use the wp_head
action to print code in the <head>
block of each document. If your theme does not use the wp_head()
function, then dropping do_action( 'wp_head' )
into your <head>
block is required.
Simplest way would be to wrap the favicon's URL in a filter, and then change that depending on the current post being viewed. Note you'll likely need to take measures to prevent caching of the favicon, which in my experience can be a challenge.
本文标签: Changable favicon based on postfeatured image
版权声明:本文标题:Changable favicon based on post-featured image 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736671047a1946924.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
wp_head
action. But, how are you going to get WP to auto-generate all the different required favicon files when you upload featured images? Like thefeatured-image-favicon.ico
? And I think that theapple-touch-icon.png
has to always be namedapple-touch-icon.png
- so you may not be able to do this properly for all platforms/browsers. – Tony Djukic Commented Jan 31, 2024 at 4:13