我无法添加新的元框。这是我的代码。元框旨在添加到自定义帖子类型上,其名称为“爪”。
代码的最后一行实际上出现在源代码中。即使那样它也没有显示。非常不合逻辑。
add_action('add_meta_boxes', 'my_admin');
function my_admin() {
add_meta_box('claws_link','Link','random_callback','claws','normal','high');
}
function random_callback($post) {
$post_id = $post->ID;
wp_nonce_field( plugin_basename( __FILE__ ), 'random_linknonce' );
// The actual fields for data entry
// Use get_post_meta to retrieve an existing value from the database and use the value for the form
$value = get_post_meta( $_POST['post_ID'], $key = 'claws_link', $single = true );
echo '<label for="claws_link">';
_e("Enter link", 'random_textdomain' );
echo '</label> ';
echo '<input type="text" id="claws_link" name="claws_link" value = "'.$value.'" size="25" />'; //this html code actually comes in the source, still no metabox, dunno why
}