php - 尝试学习如何更改分页页面上的元标题
问题描述
我从本地主机开发了一个 WordPress 插件,并试图找出如何更改静态分页页面上的元标题。
假设我有一个博客,主页有超过 5 个带有博客文章的分页页面。
例如,
website[.]com -> 10 blog posts
website[.]com/page/2/ -> the other 10 blog posts
website[.com]/page/3/ -> the other 10 blog posts
...
此外,我还有其他类别的博客文章。
例如,
website[.com]/category-name -> "category name's" 10 blog posts
website[.com]/category-name/page/2/ -> "category name's" 10 blog posts
...
在这种情况下,我想手动更改每个静态分页页面的元标题(元标题)。
例如,
第 1 页的元标题:BigQuery 调试建议 - 品牌
第 2 页的元标题:修复 BigQuery 错误 - 品牌
...
我找到的只是一个 PHP 代码,我可以在其中更改网站上每个页面的元标题。有没有办法通过过滤器实现这一点?
<?php
add_filter('pre_get_document_title', 'new_filter_title');
function new_filter_title($title){
return $title . "Meta Title for Pagination Pages";
}
if
提前致谢
解决方案
推荐阅读
- mocking - NSubstitute 无法确定项目“运行所有测试”时要使用的参数规范
- android - FCM Android - 点击通知 - 打开网页视图
- java - JAXB 无法将值转换为 BigDecimal
- c++ - 具有 N 列和 N 行的矩阵,列必须具有 N-1 , N-2 等值
- notifications - PWA关闭时如何接收点击通知数据?
- javascript - 使用 JQuery 和 Ajax 淡化 html 页面的问题
- rest - 在 http 请求中设置 grpc 元数据
- flutter - 没有材料设计或库比蒂诺定制的颤振?
- python - tkinter 中的打包和网格
- android - 使 NestedScrollView 中的工具栏不可滚动