I created a custom field called "Classes", within the field group I created a clonable subgroup with three fields, (Description, Active, Teacher), respectively.
I'm using Bricks Builder and when I need to list the fields, I just select the "MB Group Classes" post in the Query Builder and all records are displayed normally, even everything occurs normally and as expected.
My question is how do I list in this loop only the group records that have the "Active" field equal to true?
<div>
$groups = rwmb_meta( 'cg_class', [ 'object_type' => 'setting' ], 'customizacao-do-sistema' );
foreach ( $groups as $group ) {
// Field cf_description:
echo $group[ 'cf_description' ] ?? '';
// Field cf_active:
$checkbox = $group[ 'cf_active' ] ?? 0;
if ( $checkbox ) {
echo 'Checked';
} else {
echo 'Unchecked';
}
// Field cf_teacher:
echo $group[ 'cf_teacher' ] ?? '';
}
</div>
Only records with the active field = true can be displayed in the search loop.