- Go to your custom fields group in Meta Box.
- Locate your custom field and copy the ID.
- Copy the code below and paste into a snippet plugin, or your child themes functions file. I am using the WPCodeBox 2 plugin in the video. Here you need to select its a php snippet.
function render_radio_field_metabox_shortcode($atts) {
global $post;
if (!is_singular() || !isset($post->ID)) return '';
$value = rwmb_meta('radio_m3ksv1dlv6b', '', $post->ID);
if (!empty($value)) {
return '<p class="radio-field">' . esc_html($value) . '</p>';
}
return '';
}
add_shortcode('radio_field_display', 'render_radio_field_metabox_shortcode');
4. Go to the on of the single post you want to display the field on and click edit site.
5. This should edit your post type template. In the template add a shortcode field.
6. Paste in [radio_field_display] and now the field should show on the post if its not empty. You can also use the shortcode in some of the other modules if that fits how you want to show it better.