私はそれが期待どおりに動作するように私はカスタムポストタイプを持っています。以下は、お客様の声評価のためのカスタムメタボックスカスタムポストタイプ
add_action('init', 'register_cpt_testimonial');
function register_cpt_testimonial() {
...
$args = array(
..
);
register_post_type('testimonial', $args);
}
ためのコードのスニペットは、しかし、今、私は空想することとメタボックスを追加したいが、私はそれを表示するために取得することはできません。
function testimonial_meta_boxes() {
add_meta_box('testimonial_form', 'Testimonial Details', 'testimonial_form', 'testimonial', 'side', 'high');
}
function testimonial_form() {
$post_id = get_the_ID();
$testimonial_data = get_post_meta($post_id, '_testimonial', true);
$client_name = (empty($testimonial_data['client_name'])) ? '' : $testimonial_data['client_name'];
wp_nonce_field('testimonial', 'testimonial');
?>
<p>
<label>Client's Name (optional)</label><br />
<input type="text" value="<?php echo $client_name; ?>" name="testimonial[client_name]" size="40" />
</p>
<?php
}
誰かが私がここで欠けているものを説明できますか?私はhttps://developer.wordpress.org/reference/functions/add_meta_box/を読んでいますが、私は逃しているものを手に入れません。
に管理パネルに表示されないmetaboxを追加する必要がありますか? – vel