wordpress - 从 the_tags() 更改标签的顺序
我目前正在获取这样的标签列表:
<?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>
按字母顺序显示它们。但我需要更改顺序。我只有 4 个可能的标签,并且我知道它们应该进入的顺序,但它不是按字母顺序排列的。
编辑:我发布了错误的代码。这就是标签的显示方式:
<?php wp_tag_cloud('smallest=9&largest=9&format=flat' );?>
我需要以自定义顺序“a”、“b”、“c”、“d”显示标签
I'm currently getting the list of tags like this:
<?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>
Which displays them alphabetically. I need to change the order though. I only have 4 possible tags and I know the order they should go in, but it's not alphabetical.
EDIT: I posted the wrong code. This is how the tags are getting displayed:
<?php wp_tag_cloud('smallest=9&largest=9&format=flat' );?>
I need to display that in custom order 'a', 'b', 'c', 'd'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您应该能够首先像这样获取标签,然后对它们执行某些操作:
文档位于 http:// /codex.wordpress.org/Function_Reference/get_the_tags
I believe you should be able to get the tags first like this and then do something with them:
Docs at http://codex.wordpress.org/Function_Reference/get_the_tags
这需要编辑
the_tags
函数。我认为他们目前是按 ID 订购的。您可以重新调整 ID(删除、重新添加)来更改顺序。这将避免额外的代码。This would require editing the
the_tags
function. I think they're currently ordered by their ID. You could possibly rejig the IDs (deleting, re-adding) to change the order. This would avoid extra code.