我想在选项面板中显示一个下拉列表,用于选择“特色产品类别”,这是一种自定义分类法。我这样做:
register_taxonomy("Catalogs",
array("kmproduct"),
array("hierarchical" => true,
"label" => "Catalogs",
"singular_label" => "catalog",
"rewrite" => true ));
在我的
theme_options.php
我有:
...
array( "name" => "Homepage featured category",
"desc" => "Choose a category from which featured posts are drawn",
"id" => $shortname."_feat_cat",
"type" => "select",
"options" => $wp_tax,
"std" => "Choose a category"),
我无法获取分类列表:
$args=array( \'name\' => \'Catalogs\');
$output = \'names\'; // or objects
$taxonomies = get_taxonomies($args,$output);
$wp_tax = array();
foreach ($taxonomies as $category_list ) {
$wp_tax[$category_list->ID] = $category_list->name;
}
array_unshift($wp_tax, "Choose a category");
怎么了?我无法让它工作:(