1

I'm trying to add a meta box into a custom post type and display the text on the front end.

I made a meta box as follows:

array(
    'name'   => __( '<b>Schema</b>', 'themeum-soccer'),
    'id'     => 'schema_group',
    'type'   => 'group',
    'fields' => array(
        array(
            'name' => __('schema', 'themeum-soccer'),
            'id'   => 'schema_knvb',
            'desc' => __('Paste hier de php snippit', 'themeum-soccer' ),
            'type' => 'textarea',
            'std'  => '',
        ),
        array(
            'name' => __( 'Naam Trainer', 'themeum-soccer' ),
            'id'   => "test123",
            'desc' => __( 'Naam Trainer(ex: Arno Kuppen)', 'themeum-soccer' ),
            'type' => 'text',
            'std'  => '',
        ),
    )

That is now saved in the plugin I'm working in, but when I put the following code in my custom post template:

<div role="tabpanel" class= "tab-pane fade" id="schema">
    <div>
        <?php echo rwmb_meta( $schema_knvb ); ?>
    </div>   
</div>

Why does it only print "Array" (see image below)?

enter image description here

2

Use this code

$schema_group = rwmb_meta( 'schema_group' );
$schema_knvb = isset( $schema_group['schema_knvb'] ) ? $schema_group['schema_knvb'] : '';
echo $schema_knvb;

for more detail check the "Meta Box Group" page on the plugin documentation https://metabox.io/docs/meta-box-group/#section-how-to-get-meta-value-of-a-sub-field

  • Happy to help. If this answer solved your issue, please do not forget mark it as accepted ; ) – Nico Nov 8 '15 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.