这个add_meta_box
HTML回调的级别相当低,我们需要自己编写HTML,例如回显HTML表单标记
function myplugin_meta_box_callback( $post ) {
// Add an nonce field so we can check for it later.
wp_nonce_field( \'myplugin_meta_box\', \'myplugin_meta_box_nonce\' );
/*
* Use get_post_meta() to retrieve an existing value
* from the database and use the value for the form.
*/
$value = get_post_meta( $post->ID, \'_my_meta_value_key\', true );
echo \'<label for="myplugin_new_field">\';
_e( \'Description for this field\', \'myplugin_textdomain\' );
echo \'</label> \';
echo \'<input type="text" id="myplugin_new_field" name="myplugin_new_field" value="\' . esc_attr( $value ) . \'" size="25" />\';
}
对于metabox表单元素,是否有任何标准的HTML标记模板,以便我们更好地遵循,而不是自己随意创建HTML表单元素?i、 e.与默认metabox元素更加一致,例如,行高、字体大小等