所以我的问题是,我可以把代码放在哪里来显示分类法?我找到了这个代码
`function get_taxonomies( $args = array(), $output = \'names\', $operator = \'and\' ) {
global $wp_taxonomies;
$field = ( \'names\' === $output ) ? \'name\' : false;
return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field );
}`
但它不起作用,我会出错。我的意思是我必须做一个新的文件把它放在那里?
分类法是
function create_post_type()
{
$labels = array(
\'name\' => __(\'Offer\'),
\'singular_name\' => __(\'offer\'),
\'add_new\' => __(\'New offer\'),
\'add_new_item\' => __(\'Add New offer\'),
\'edit_item\' => __(\'Edit offer\'),
\'new_item\' => __(\'New offer\'),
\'view_item\' => __(\'View offer\'),
\'search_items\' => __(\'Search offer\'),
\'not_found\' => __(\'No offer Found\'),
\'not_found_in_trash\' => __(\'No offer found in Trash\'),
);
$args = array(
\'labels\' => $labels,
\'has_archive\' => true,
\'public\' => true,
\'supports\' => array(
\'title\',
\'editor\',
\'excerpt\',
\'custom-fields\',
\'thumbnail\',
\'page-atributes\'
),
\'taxonomies\' => array(\'post_tag\', \'category\'),
);
register_post_type(\'offer\', $args);
}
add_action(\'init\', \'create_post_type\');
function htl_register_taxonomy()
{
$args = array(
\'labels\' => array(
\'name\' => __(\'hotel\'),
\'singular_name\' => __(\'hotel\'),
),
\'public\' => true,
);
register_taxonomy(\'hotel\', array(\'offer\'), $args);
}
add_action(\'init\', \'htl_register_taxonomy\');