WordPress 自定义分类法
我想知道是否有一种方法可以列出与当前页面同级的所有自定义分类法(例如在我的 single.php 中)?
例如,我的分类如下
类别
- -- 古代
- +++ 希腊
- ///// 柏拉图
- ///// 苏格拉底
- +++ 罗马
- +++ 印度
- -- 经典
- -- 现代
我想创建一个侧边栏列出具有相同父项的所有其他项目(包括其他兄弟姐妹的后代 - 例如“希腊”页面将列出“罗马”和“印度”。“古代”页面将包括指向“古代>>希腊”、“古代>>罗马”、“古代印度”、“经典”和“现代”页面。)
这可以通过自定义分类法实现吗?我怎样才能实现它?
谢谢!
*编辑*
另外,作为参考,我正在处理以下博客文章,这些文章可以更详细地了解我需要的内容,我只是在将其自定义为我在原来的帖子中提到的规范:
http://net.tutsplus.com/tutorials/wordpress/introducing-wordpress-3-custom-taxonomies/
https://github.com/scribu/wp-query-multiple-taxonomies/wiki/Changing-templates
http://scribu.net/wordpress/extending-the-category-walker.html
I'm wondering if there's a way to list all custom taxonomies that are siblings to the current page (e.g. in my single.php)?
For example my taxonomy is as follows
Categories
- -- Ancient
- +++ Greek
- ///// Plato
- ///// Socrates
- +++ Roman
- +++ Indian
- -- Classic
- -- Modern
I'd like to create a sidebar that lists all other items that have the same parent (including descendants of other siblings - e.g. "Greek" page would list "Roman" and "Indian". The "Ancient" page would include links to "Ancient >> Greek", "Ancient >> Roman", "Ancient >> Indian", "Classic" and "Modern" Pages. )
Is this possible with custom taxonomies? How can I achieve it?
Thanks!
*EDIT*
Also, for reference, I am working with the following blog posts which give a more detailed insight into what I need, I simply am having trouble customizing it to the specifications I mentioned in my original post:
http://net.tutsplus.com/tutorials/wordpress/introducing-wordpress-3-custom-taxonomies/
https://github.com/scribu/wp-query-multiple-taxonomies/wiki/Changing-templates
http://scribu.net/wordpress/extending-the-category-walker.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将创建一个页面的所有同级页面的列表。我有一种感觉,您想要一些稍微不同的东西,正如您提到的自定义分类法和页面一样。这些是自定义帖子类型、类别还是页面?让我知道这是否适合您:)
This will create a list of all the siblings of a page. I have a feeling you want something slightly different, as you mention custom taxonomies as well as pages. Are these custom post types, categories, or pages? Let me know if this works for you :)