在wordpress中按字母顺序排列分类法?

时间:2011-01-29 02:22:23

标签: wordpress taxonomy term custom-tags

我正在为我的帖子使用自定义分类法,我这样打印:

the_terms(get_the_ID(), 'sizes', '<p>', ', ', '</p>');

这样可以正常工作,但它按照添加的顺序打印条件,有没有办法让它按字母顺序打印? the_terms函数不允许我传递任何order参数,所以我想我必须使用另一个,但我还没有找到。

提前致谢。

1 个答案:

答案 0 :(得分:0)

the_terms()使用get_term_list来检索代码的分类法(http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/category-template.php#L932)。

您可以选择在此处使用过滤器,但它适用于为每个单词生成的HTML(taxonomy1)。不是排序的最佳选择。

最好是使用函数get_the_terms(),自己排序结果并构建输出列表!

相关问题