【发布时间】:2011-01-25 05:08:57
【问题描述】:
我正在尝试删除/替换 WordPress 使用的类别元素上的 title 属性。我使用的是 WordPress 2.9.1,代码如下:
<div id="categories">
<h3>Manufacturers</h3>
<ul>
<?php str_replace("title=\"View all posts filed under ","",wp_list_categories('use_desc_for_title=0&exclude=1,2,3,4,5&title_li=&hierarchical=1')); ?>
</ul>
</div>
从我读到的内容来看,这种方法用于旧版本(虽然我从未尝试过)。我真的不想破解 WordPress 的内部结构,或者不得不使用 JavaScript 破解,因为这样直截了当。任何帮助表示赞赏...
更新 下面是从上面的代码创建的...
<div id="categories">
<h3>Manufacturers</h3>
<ul>
<li class="cat-item cat-item-7"><a href="http://localhost/crosstrainers/?cat=7" title="View all posts filed under Featured">Featured</a>
</li>
</ul>
</div>
【问题讨论】:
-
您能否具体说明“类别元素”对于非 WP 专家的含义?
-
... 并显示一些有问题的 HTML 代码?
-
类别(可选)与博客文章相关联,当使用 wp_list_categories() 显示它们时,它会不断添加默认标题元素(例如,title="查看#category 下的所有帖子" 到它的锚点创建。我似乎无法删除或替换标题
标签: php wordpress function customization