我有一个用自定义帖子类型填充的下拉式元框,现在在我的模板中,我可以获得元框输出的值,但我真正需要的是从所选CPT存储的所有信息,以显示在帖子的某些区域。
My metabox
$meta_boxes[] = array(
\'id\' => \'actordetails\',
\'title\' => \'Select an Actor\',
\'pages\' => array( \'films\' ),
\'context\' => \'normal\',
\'priority\' => \'high\',
// List of meta fields
\'fields\' => array(
array(
\'name\' => \'\',
\'id\' => $prefix . \'getactors\',
\'type\' => \'select\',
\'clone\' => false,
\'options\' => get_actors_options(),
),
)
);
My function
function get_actors_options( $query_args ) {
$args = wp_parse_args( $query_args, array(
\'post_type\' => \'actors\',
) );
$posts = get_posts( $args );
$post_options = array();
if ( $posts ) {
foreach ( $posts as $post ) {
$post_options [ $post->post_title ] = $post->post_title;
}
}
return $post_options;
}
这就是我得到的: <?php echo get_post_meta($post->ID, \'nt_getactors\', true); ?>

This is what I need:

那么,我将使用什么代码来获取我选择的其他自定义帖子类型呢。