我如何修复 Wordpress 分类页面标题:Category <span>...</span>
在我的一个 Wordpress 网站上,分类页面的标题字面上是
category_title_example.txt
Category <span>My category</span>搜索主题源代码没有快速找到解决方案,所以我使用插件添加了这个自定义 JS:
fix_category_title.js
jQuery(document).ready(function( $ ){
if(jQuery("h1.page-title").text().includes("Category: <span>")) {
var input = jQuery("h1.page-title").text();
var output = /<span>(.*)<\/span>/g.exec(input)[1];
jQuery("h1.page-title").text(output);
}
});这只是将标题替换为 span 标签的内容。你可能需要为你的主题调整 CSS 类。
Check out similar posts by category:
Javascript, Wordpress
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow