$taxonomy = \'training_cats\';
$orderby = \'name\';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 0; // 1 for yes, 0 for no
$title = \'\';
$empty = 0;
$args = array(
\'name\' => $taxonomy,
\'orderby\' => $orderby,
\'show_count\' => $show_count,
\'pad_counts\' => $pad_counts,
\'hierarchical\' => $hierarchical,
\'title_li\' => $title,
\'hide_empty\' => $empty
);
$cats = get_taxonomies($args);
foreach ( $cats as $cats2 ) {
echo \'<input type="checkbox" name="checkbox_id" value="\'.$cats2->name.\'" />\';
echo $cats2-name;
}
未测试,但应正常工作,请更改分类名称等:)
编辑:使用get\\u分类法尝试新代码(代码不知道从何处提取数据)
Edit2:将分类法更改为名称: