我已经使用多个内容编辑器完成了自定义帖子类型的翻译,我使用了This Metabox Plugin 要添加元框,此插件允许您根据主题要求创建多个元框,要实现您的要求,请首先安装此插件Here is the link 然后在函数中添加如下代码。php或单独的文件,然后包含到函数中。php
global $meta_boxes;
$meta_boxes = array();
$meta_boxes[] = array(
\'id\' => \'standard\',
\'title\' => __( \'Simple Editors\', \'your-languge-key\' ),
\'pages\' => array( \'your-post-type\' ),
\'context\' => \'normal\',
\'priority\' => \'high\',
\'autosave\' => true,
\'fields\' => array(
array(
\'name\' => __( \'Simple Editor\', \'your-languge-key\' ),
\'id\' => "{$prefix}home-bottom-content",
\'type\' => \'wysiwyg\',
// Set the \'raw\' parameter to TRUE to prevent data being passed through wpautop() on save
\'raw\' => true,
\'std\' => __( \'WYSIWYG default value\', \'your-languge-key\' ),
// Editor settings, see wp_editor() function: look4wp.com/wp_editor
\'options\' => array(
\'textarea_rows\' => 4,
\'teeny\' => true,
\'media_buttons\' => false, // mediabuttons to editor
),
),
),
);
/**
* Register meta boxes
*
* @return void
*/
function rw_register_meta_boxes()
{
global $meta_boxes;
// Make sure there\'s no errors when the plugin is deactivated or during upgrade
if ( class_exists( \'RW_Meta_Box\' ) ) {
foreach ( $meta_boxes as $meta_box ) {
if ( isset( $meta_box[\'only_on\'] ) && ! rw_maybe_include( $meta_box[\'only_on\'] ) ) {
continue;
}
new RW_Meta_Box( $meta_box );
}
}
}
add_action( \'admin_init\', \'rw_register_meta_boxes\' );
/**
* Check if meta boxes is included
*
* @return bool
*/
function rw_maybe_include( $conditions ) {
// Include in back-end only
if ( ! defined( \'WP_ADMIN\' ) || ! WP_ADMIN ) {
return false;
}
// Always include for ajax
if ( defined( \'DOING_AJAX\' ) && DOING_AJAX ) {
return true;
}
if ( isset( $_GET[\'post\'] ) ) {
$post_id = intval( $_GET[\'post\'] );
}
elseif ( isset( $_POST[\'post_ID\'] ) ) {
$post_id = intval( $_POST[\'post_ID\'] );
}
else {
$post_id = false;
}
$post_id = (int) $post_id;
$post = get_post( $post_id );
foreach ( $conditions as $cond => $v ) {
// Catch non-arrays too
if ( ! is_array( $v ) ) {
$v = array( $v );
}
switch ( $cond ) {
case \'id\':
if ( in_array( $post_id, $v ) ) {
return true;
}
break;
case \'parent\':
$post_parent = $post->post_parent;
if ( in_array( $post_parent, $v ) ) {
return true;
}
break;
case \'slug\':
$post_slug = $post->post_name;
if ( in_array( $post_slug, $v ) ) {
return true;
}
break;
case \'category\': //post must be saved or published first
$categories = get_the_category( $post->ID );
$catslugs = array();
foreach ( $categories as $category )
{
array_push( $catslugs, $category->slug );
}
if ( array_intersect( $catslugs, $v ) )
{
return true;
}
break;
case \'template\':
$template = get_post_meta( $post_id, \'_wp_page_template\', true );
if ( in_array( $template, $v ) )
{
return true;
}
break;
}
}
// If no condition matched
return false;
}
这里我只添加了一个编辑器,您可以通过重用编辑器字段来添加多个编辑器。希望这能解决你的问题。祝你好运