问题描述
我正在尝试在 wordpress 标题中显示一个图标,但它对我不起作用 - 你认为会出现什么问题?
我正在使用 Twig/Timber 进行开发。
<link rel="shortcut icon" type="image/x-icon" href="{{options.header.favicon.url | default(site.theme.link ~ '/images/favicon.ico')}}"/>
一切正常:
<link rel="stylesheet" href="http://protoolsite.local/wp-content/themes/protool-theme/style.css" type="text/css" media="screen"/>
<link rel="shortcut icon" type="image/x-icon" href="http://protoolsite.local/wp-content/themes/protool-theme/images/favicon.ico"/>
<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<Meta http-equiv="X-UA-Compatible" content="IE=edge">
<Meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="author" href="http://protoolsite.local/wp-content/themes/protool-theme/humans.txt"/>
当我查看此链接时,它根本没有出现任何问题:http://protoolsite.local/wp-content/themes/protool-theme/images/favicon.ico
它只是一直显示 wordpress "W" 图标。
解决方法
很确定 Wordpress 也需要“图标”。
<link rel="icon" type="image/x-icon" href="http://protoolsite.local/wp-content/themes/protool-theme/images/favicon.ico"/>
不过在 Wordpress 中转到 appearance
> customise
> site identity
会更容易。