Wordpress自定义分类移动元框
我有一个自定义元框(分类法),它位于我的自定义帖子的一侧。我想将它移动到正常位置,但当我移除它(移除meta框)并重新添加(添加meta框)时,我只会得到条,没有选择任何内容的选项。我认为我没有编写正确的$callback,但我尝试了许多变体,但没有任何线索Wordpress自定义分类移动元框,wordpress,Wordpress,我有一个自定义元框(分类法),它位于我的自定义帖子的一侧。我想将它移动到正常位置,但当我移除它(移除meta框)并重新添加(添加meta框)时,我只会得到条,没有选择任何内容的选项。我认为我没有编写正确的$callback,但我尝试了许多变体,但没有任何线索 function create_isotope_taxonomies() { $labels = array( 'name' => _x( 'Select Category', 'taxonomy general name
function create_isotope_taxonomies()
{
$labels = array(
'name' => _x( 'Select Category', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'popular_items' => __( 'Popular Categories' ),
'all_items' => null,
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit' ),
'update_item' => __( 'Update' ),
'add_new_item' => __( 'Add New' ),
'new_item_name' => __( 'New Category' ),
'separate_items_with_commas' => __( 'Separate writers with commas' ),
'add_or_remove_items' => __( 'Add or remove categories' ),
'choose_from_most_used' => __( 'Choose from the most used categories' ),
'menu_name' => __( 'Categories' ),
);
register_taxonomy('fzisotope_categories','fzisotope_post',array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'fzisotope_categories' ),
));
}
function fzisotope_categories_meta_box(){
remove_meta_box('fzisotope_categoriesdiv', 'fzisotope_post', 'side');
add_meta_box( 'fzisotope_categoriesdiv', 'Select Category', 'fzisotope_categories_meta_box', 'fzisotope_post', 'normal', 'high');
//print '<pre>';print_r( $wp_meta_boxes['post'] );print '<pre>';
}
add_action( 'admin_init', 'fzisotope_categories_meta_box', 0 );
函数创建同位素分类法()
{
$labels=数组(
'name'=>x('Select Category','taxonomy general name'),
“单数名称”=>\ux(“类别”、“分类单数名称”),
“搜索项目”=>(“搜索类别”),
“热门商品”=>(“热门类别”),
“所有项目”=>null,
“父项”=>null,
“父项\u冒号”=>null,
“编辑项目”=>“‘编辑’”,
'update_item'=>'update',
“添加新项目”=>(“添加新项目”),
“新建项目名称”=>(“新建类别”),
“带逗号的独立写入程序”=>(“带逗号的独立写入程序”),
“添加或删除项目”=>(“添加或删除类别”),
“从使用最多的类别中选择”=>“(“从使用最多的类别中选择”),
“菜单名称”=>“(“类别”),
);
注册分类法('fzisotope_类别','fzisotope_post',数组(
“分层”=>正确,
“标签”=>$labels,
'show_ui'=>true,
'show_admin_column'=>true,
“更新计数回调”=>“\u更新计数后计数”,
'query_var'=>true,
“重写”=>array('slug'=>fzisotope_categories'),
));
}
函数fzisotope_categories_meta_box(){
移除元框('fzisotope_categoriesdiv','fzisotope_post','side');
添加元框('fzisotope_categoriesdiv','Select Category','fzisotope_categories_meta_box','fzisotope_post','normal','high');
//打印“”;打印($wp_meta_box['post']);打印“”;
remove_meta_box('fzisotope_categoriesdiv', 'fzisotope_post', 'side');
add_meta_box( 'fzisotope_categoriesdiv', 'XXXXXXXXXXX', 'post_categories_meta_box', 'post', 'normal', 'high', array( 'taxonomy' => 'fzisotope_categories' ));
}
添加操作('admin_init','fzisotope_categories_meta_box',0);
感谢阅读您必须使用:
具有层次结构的分类法的post_categories_meta_框
如果使用自定义post类型执行此操作,则需要使用自定义\u post\u类型\u slug替换post