https://github.com/CMB2/CMB2/wiki/Field-Types#radio_inline
You can use something like WordPress core’s get_post_types() function to fetch available post type information and create an array to pass in as the options parameter for the radio_inline field type. For the “standard” part of this snippet, I’d use the post type slug, as shown here: 'standard' => __( 'Option One', 'cmb2' ),
I’m sorry I’m new to wordpress, could you send me an example code?
function retorna_todos_equipamentos(){
$list = array();
$args = array(
‘post_type’ => ‘equipamentos’,
‘posts_per_page’ => -1,
);
$wp_query = new WP_Query($args);
$equipamentos = $wp_query->posts;
wp_reset_postdata();
foreach ($equipamentos as $value) {
$obj = array(‘id’ => $value->ID,’titulo’ => $value->post_name);
array_push($lista,$obj);
}
return $lista;
}
???
Are you wanting to put the posts in the radio_inline field option, or the post types? Going with the posts themselves, could result in a very long list, for what it’s worth.
Untested, but I believe it should work, or at least be rather close. Worth looking over and reviewing, for sure.
https://gist.githubusercontent.com/tw2113/29e27bd2cd30f2981909789f6c1c2bf1/raw/11eee8e351d36bf4208fb1e58d7821a6c03707fc/gistfile1.txt