我使用CMB2插件将select metaboxes添加到post中。metabox在post编辑器上工作得很好。但未能在贴图页上呈现和显示。
邮政编辑代码
add_action( 'cmb2_admin_init', 'postintro_metabox' );
function myweb_postintro_metabox() {
$myweb_grouppf = new_cmb2_box( array(
'id' => 'postintro_metabox',
'title' => __('Post Intro', 'MYWEB'),
'object_types' => array( 'post', ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
) );
$myweb_grouppf->add_field( array(
'name' => 'Test Select',
'desc' => 'Select an option',
'id' => 'wiki_test_select',
'type' => 'select',
'show_option_none' => true,
'default' => 'custom',
'options' => array(
'standard' => __( 'Option One', 'cmb2' ),
'custom' => __( 'Option Two', 'cmb2' ),
'none' => __( 'Option Three', 'cmb2' ),
),
) );
}然后,我试着用这段代码调用我的帖子,但不幸的是,它没有起作用:
你能帮帮我吗?我很感激。
发布于 2022-10-21 09:54:58
https://wordpress.stackexchange.com/questions/410615
复制相似问题