这是一般帖子下的自定义元框图像上传选项.我希望在add_options_page或下面有相同的选项add_menu_page.我该怎么办?
<?php
/**
* Adds a meta box to the post editing screen
*/
function prfx_custom_meta() {
add_meta_box( 'prfx_meta', __( 'Meta Box Title', 'prfx-textdomain' ), 'prfx_meta_callback', 'post' );
}
add_action( 'add_meta_boxes', 'prfx_custom_meta' );
/**
* Outputs the content of the meta box
*/
function prfx_meta_callback( $post ) {
wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' );
$prfx_stored_meta = get_post_meta( $post->ID );
?>
<p>
<label for="meta-image" class="prfx-row-title"><?php _e( 'Example File Upload', 'prfx-textdomain' )?></label>
<input type="text" name="meta-image" id="meta-image" value="<?php if …Run Code Online (Sandbox Code Playgroud) 如何在wordpress cmb2中输入可能的数字类型?我想要数字类型输入字段并设置默认值。
$cmb->add_field( array(
'name' => __( 'Number Title', 'myprefix' ),
'desc' => __( 'field description (optional)', 'myprefix' ),
'id' => 'number-id',
'type' => '',
'default' => '30',
) );
Run Code Online (Sandbox Code Playgroud)