Support Forum
Support › Meta Box Group › Subfields not displaying within Oxygen Custom Field/Meta OptionsResolved
Hello,
I created a group field with two sub-fields (rec_url & where_to_buy). These do not show up within the Custom Field/Meta Options within Oxygen Builder (see here).
How can I insert these sub-fields? I do not know PHP, so I will likely need more detailed instructions if adding PHP will be necessary.
Thank you!
Hi,
Please follow the documentation to know how to get the subfield's value https://docs.metabox.io/extensions/meta-box-group/#getting-sub-field-values.
and refer to your topic to run the PHP function with Oxygen https://support.metabox.io/topic/output-shortcode-from-a-custom-field/.
You should have the basic knowledge of coding about PHP, HTML, CSS to do some advanced cases.
Thank you for the links.
I feel competent with html and css - not at all with php. Will php be necessary to be able to use the full functionality of Meta Box even when/if Meta Box integrates with Oxygen?
Can you tell please me where I would input the following (snippet code or code block)?
(It's a cloneable group)
$group_value = rwmb_meta( 'group_id' );
array(
'sub_field_1_key' => 'sub_field_1_value',
'sub_field_2_key' => 'sub_field_2_value',
'sub_field_3_key' => 'sub_field_3_value',
//...
)
$value = isset( $group_value[$sub_field_key] ) ? $group_value[$sub_field_key] : '';
echo $value; // Display sub-field value
array(
array(
'sub_field_1_key' => 'sub_field_1_value',
'sub_field_2_key' => 'sub_field_2_value',
'sub_field_3_key' => 'sub_field_3_value',
//...
),
array(
'sub_field_1_key' => 'sub_field_1_value',
'sub_field_2_key' => 'sub_field_2_value',
'sub_field_3_key' => 'sub_field_3_value',
//...
),
//...
)
$group_values = rwmb_meta( 'group_id' );
if ( ! empty( $group_values ) ) {
foreach ( $group_values as $group_value ) {
$value = isset( $group_value[$sub_field_key] ) ? $group_value[$sub_field_key] : '';
echo $value; // Display sub-field value
}
}
Hi again - can you please respond to my last message?
Hi Amanda,
Sorry for the late reply.
You can use the PHP code anytime even the integration released. It can help you to do some advanced cases when the integration won't cover.
I recommend using the Code Snippets to run the custom function.
function my_custom_function() {
$contacts = rwmb_meta( 'contacts' );
if ( ! empty( $contacts ) ) {
foreach ( $contacts as $contact ) {
echo '<div class="contact">';
echo '<h4>', 'Contact info', '</h4>';
echo '<p><label>', 'Name:', '<label> ', $contact['name'], '</p>';
echo '<p><label>', 'Email:', '<label> ', $contact['email'], '</p>';
echo '<p><label>', 'Phone number:', '<label> ', $contact['phone'], '</p>';
echo '</div>';
}
}
}
See the example for the cloneable group https://docs.metabox.io/extensions/meta-box-group/#examples
Hello Meta Box Team,
Is there any update about the integration?
I am suppering with the same problem.
Thanks,
Peter
Hi Peter,
The Oxygen team has created the integration with Meta Box and MB extensions. Please contact Oxygen support to get more details.
Thanks.