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     

解决方法

        
$post = get_post($id); //Get the post id

    if($post->post_parent){ //If it has a parent

        wp_list_pages(\'child_of=\'.$post->post_parent . \'&exclude=\'.$id); //List the pages that are children of the parent page,excluding the current one.

    }
这将创建页面的所有同级列表。我有一种感觉,您想要一些稍有不同的东西,因为您提到了自定义分类法和页面。这些是自定义帖子类型,类别还是页面?让我知道这是否适合您:)