首页 > 解决方案 > 尝试学习如何更改分页页面上的元标题

问题描述

我从本地主机开发了一个 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 

提前致谢

标签: phpwordpressplugins

解决方案


推荐阅读