wp_list_categories() 将 span 添加到类别名称
我已经尝试了一堆“解决方案”,但不允许我添加一个简单的
<span></span>
使用functions.php /default-widgets.php 到类别名称,例如。
<li><a><span></span>Category 1</a></li>
我最接近的是使用 str_replace 替换类别帖子计数。 我不想直接从主题调用小部件,因为它会弄乱顺序或使用 jquery,这是他们“轻松”执行此操作的一种方法,还是 WP 不允许这样做。
谢谢
I've tried a heap of "solutions" but non allow me add a simple
<span></span>
using functions.php /default-widgets.php
to the category name, eg.
<li><a><span></span>Category 1</a></li>
the closest I've come replaces the category post count using str_replace.
I don't want to call the widget straight from the theme because it messes up the order or use jquery, is their a way of doing this "easily" or will WP not allow it.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法绝对是编辑核心文件。
如果您使用 WordPress 3.2.1,请转到文件夹 wp-includes 并查找 category-template.php
并转到第 874 行...
并添加您需要的标记,例如 < strong>span 并删除括号。
瞧
Definately the easiest way is to edit the corefiles.
If your using wordpress 3.2.1, go to the folder wp-includes and look for category-template.php
And go to line 874...
and add in what markup you need too, for example span and removing the brackets.
and Voila