拿the_category()
例如:
以下是wordpress循环中的\\u category函数的输出:
<ul class="post-categories">
<li>
<a href="http://example.com/category/another-category/" rel="category tag">
Another Category
</a>
</li>
<li>
<a href="http://example.com/category/uncategorized/" rel="category tag">
Uncategorized
</a>
</li>
</ul>
所以我们需要一种方法来添加属性,就像其他一些类、数据属性和。。。到列表中,以便输出如下内容:<ul id="drop1" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
<li>
<a href="http://example.com/category/another-category/" rel="category tag">
Another Category
</a>
</li>
<li>
<a href="http://example.com/category/uncategorized/" rel="category tag">
Uncategorized
</a>
</li>
</ul>