在研究了s\\u ha\\u dum的链接和其他链接一段时间后,在标题和编辑器字段之间放置元框的唯一方法似乎是删除并读取主编辑器like this, 但这让我觉得有点不舒服,并收到了另一位回答者关于潜在问题的警告。
我能够结合@s\\u ha\\u dum的方法为新的元框创建位置,并且this code 这使我能够创建一个新的元框,其功能类似于类别分类法。
如果它对任何人都有帮助,下面是使自定义分类法出现在标题和编辑器之间的工作代码:
/***************************************************************
* Function create_ideas_type
* Register ideas type taxonomy
***************************************************************/
add_action( \'init\', \'create_ideas_type\', 0 );
function create_ideas_type() {
$labels = array(
\'name\' => __( \'Type\'),
\'singular_name\' => __( \'Type\'),
\'search_items\' => __( \'Search Types\' ),
\'popular_items\' => __( \'Popular Types\' ),
\'all_items\' => __( \'All Types\' ),
\'parent_item\' => null,
\'parent_item_colon\' => null,
\'edit_item\' => __( \'Edit Type\' ),
\'update_item\' => __( \'Update Type\' ),
\'add_new_item\' => __( \'Add New Type\' ),
\'new_item_name\' => __( \'New Type Name\' ),
\'separate_items_with_commas\' => __( \'Separate types with commas\' ),
\'add_or_remove_items\' => __( \'Add or remove types\' ),
\'choose_from_most_used\' => __( \'Choose from the most used types\' ),
);
register_taxonomy(\'ideas_type\',\'ideas\', array(
\'label\' => __(\'Type\'),
\'labels\' => $labels,
\'public\' => true,
\'hierarchical\' => true,
\'show_ui\' => true,
\'show_in_nav_menus\' => false,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'greenhouse/ideas-ambitions/type\', \'with_front\' => false),
));
}
/***************************************************************
* Functions add_before_editor and move_ideaspost_box
* Reorder the metabox to appear in between title and editor
***************************************************************/
// use the action to create a place for your meta box
add_action(\'edit_form_after_title\',\'add_before_editor\');
function add_before_editor($post) {
global $post;
do_meta_boxes(\'ideas\', \'pre_editor\', $post);
}
add_action(\'do_meta_boxes\', \'move_ideaspost_box\');
function move_ideaspost_box() {
global $post;
if( $post->post_type != \'ideas\' )
return;
remove_meta_box( \'ideas_typediv\', \'ideas\', \'side\' );
$t_name = \'ideas_type\';
if ( !is_taxonomy_hierarchical($t_name) )
add_meta_box(\'tagsdiv-\' . $t_name, "Type", \'post_tags_meta_box\', \'ideas\', \'pre_editor\', \'low\', array( \'taxonomy\' => $t_name ));
else
add_meta_box($t_name . \'div\', "Type", \'post_categories_meta_box\', \'ideas\', \'pre_editor\', \'low\', array( \'taxonomy\' => $t_name ));
}