开发者

order post taxonomies alphabeticaly in wordpress?

I'm using a custom taxonomy for my posts which I print like this:

the_terms(get_the_ID(), 'sizes', '开发者_开发百科<p>', ', ', '</p>');

This works fine but it prints the terms in the order they were added, is there a way to make it print alphabeticaly? the_terms function doesn't let me pass any order parameter so I guess I have to use a different one but I haven't found any yet.

Thanks in advance.


the_terms() is using get_term_list, to retrive the taxonomy ( http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/category-template.php#L932 ) for the code.

You have the option to use a filter here, but it is applyed to the HTML generated for every single term (taxonomy1). Not the best option to sort.

Best is use the function get_the_terms() , sorting the results and constructing the output list by yourself!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜