Subfields not displaying within Oxygen Custom Field/Meta Options
- This topic has 6 replies, 3 voices, and was last updated 2 years, 8 months ago by
Long Nguyen.
-
AuthorPosts
-
May 3, 2021 at 8:06 AM #27838
Amanda RM
ParticipantHello,
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!
May 3, 2021 at 11:18 PM #27859Long Nguyen
ModeratorHi,
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.
May 4, 2021 at 12:22 AM #27865Amanda RM
ParticipantThank 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 } }
May 12, 2021 at 2:34 AM #28112Amanda RM
ParticipantHi again - can you please respond to my last message?
May 12, 2021 at 9:33 AM #28119Long Nguyen
ModeratorHi 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
July 25, 2022 at 2:52 PM #37180[email protected]
ParticipantHello Meta Box Team,
Is there any update about the integration?
I am suppering with the same problem.Thanks,
PeterJuly 26, 2022 at 1:04 PM #37201Long Nguyen
ModeratorHi Peter,
The Oxygen team has created the integration with Meta Box and MB extensions. Please contact Oxygen support to get more details.
Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.