我的问题很基本。我有一个档案。php和内部的主循环如下:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Do stuff here
<?php endwhile; endif; ?>
适用于类别,但不适用于自定义分类法。我有一个称为“类型”的自定义分类法。我进入WordPress菜单,从“类型”分类法中添加术语“Spa休息”。
这是可行的,但是我每个帖子都会得到10个帖子。所有重复帖子的ID都是相同的,它只决定列出每个帖子的10个。
我没有添加任何自定义查询或类似的内容。
有可能发生什么的线索吗?
以下是我的分类:
function build_taxonomies(){
register_taxonomy("type", array("venue"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => array(\'slug\' => \'type\')));
}
这是我的帖子类型代码:
function create_post_type()
{
$labels = array(
\'name\' => __( \'Venue\' ),
\'singular_name\' => __( \'Venue\' ),
\'rewrite\' => array(\'slug\' => \'venues\'),
\'add_new\' => _x(\'Add New\', \'venue\'),
\'add_new_item\' => __(\'Add New Venue\'),
\'edit_item\' => __(\'Edit Venue\'),
\'new_item\' => __(\'New Venue\'),
\'view_item\' => __(\'View Venue\'),
\'search_items\' => __(\'Search Venue\'),
\'not_found\' => __(\'No venues found\'),
\'not_found_in_trash\' => __(\'No venues found in Trash\'),
\'parent_item_colon\' => \'\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'menu_position\' => null,
\'supports\' => array(\'title\',\'editor\',\'thumbnail\', \'custom-fields\', \'comments\')
);
register_post_type(\'venue\',$args);
}
提前谢谢。