Okay, I think I have done it!!
Long trial and error.
Please give me feedback on whether what I have done is a good idea!
Suggestions for improvements welcome!
I have created a new shortcode my_meta2 and I am calling it like this:
[my_meta2 meta_key="key_topic_1" element="topic"]
[my_meta2 meta_key="key_topic_1" element="obj1"]
In functions.php I have added this code:
add_action( 'init', function () {
add_shortcode( 'my_meta2', function ( $atts ) {
$atts = shortcode_atts( [
'meta_key' => '',
'element' => '',
'post_id' => get_the_ID(),
], $atts );
$value = rwmb_meta( $atts['meta_key'], array(), $atts['post_id'] );
return $value[$atts['element']];
} );
} );