WordPress 在自定义主题中覆盖标题
我正在尝试更改 Lightword 主题的 ,使其仅显示标签中的页面标题,而不是通常显示的“页面标题 | 博客标题”。
在标题模板中,我将标题行更改为:
<title><?php wp_title(''); ?></title>
刷新服务器上的页面后,它仍然显示为“页面标题 | 博客标题”。作为测试,我继续完全删除标题,只留下
- 但似乎有东西在 WP 中覆盖了它,并且出现了相同的标题格式。
最后,我在标题标签中添加了一个空格,如下所示(旨在破坏任何正则表达式):
<title><?php wp_title(''); ?></ title>
最后,我的标题实际上出现了
I'm attempting to change the of the Lightword theme to show only the page title in the tag, and not the "Page Title | Blog Title" it normally does.
In the header template, I changed the title line to:
<title><?php wp_title(''); ?></title>
After refreshing the page on the server, it STILL showed up as "Page Title | Blog Title". I went on to delete the title entirely as a test, leaving only <title></title>
- but it appears something overrode it within WP, and the same title format came out.
Finally, I added a space in the title tag like such (designed to break any regexps):
<title><?php wp_title(''); ?></ title>
And at long last, my title actually came out <title>Page Title</ title>
. This behavior strikes me as extraordinarily odd, however - why does wordpress (or this theme) resist changing the title structure? Is there any less-hacky way to get around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用此代码仅显示页面标题:
编辑
尝试此代码以仅获取标题中的页面名称:
Try this instead to show just the page title:
EDIT
Try this code to get just the page name in title: