Hi there,
I have a problem with the PHP output in a settings page, using a group and 2 text fields:
I have just one group, with 2 text fields, the code I am getting is this :
<?php
$groups = rwmb_meta( 'vita_group', [ 'object_type' => 'setting' ], 'test-setting' );
foreach ( $groups as $group ) {
// Field vita_group_year:
echo $group[ 'vita_group_text' ] ?? '';
// Field vita_group_content:
<?php $values = $group[ 'vita_group_content' ] ?? [];
<?php foreach ( $values as $value ) : ?>
<div class="my-content"><?php echo $value ?></div>
<?php endforeach ?>
}
?>
which is wrong, the code should be
<?php
$groups = rwmb_meta( 'vita_group', [ 'object_type' => 'setting' ], 'test-setting' );
foreach ( $groups as $group ) {
// Field vita_group_year:
echo $group[ 'vita_group_text' ] ?? '';
// Field vita_group_content:
echo $group[ 'vita_group_content' ] ?? '';
}
?>