Custom Fields
Re-Envisioned
Support Meta Box Group i am struggling with a simple code !

  • Creator
    Topic
  • #19452
    Resolved sofdesigne
    Participant

    Hi,

    i am just trying to understand why the field within a group is not showing, i think this will need a special code ! i searched everywhere and couldn’t find the solution!

    here is my code: the first line shows normally the value, but the second doesn’t show the value for another field within a group

    <?php
    echo rwmb_get_value('select_u6xr9smqot_k9abafij1m');
    
    echo rwmb_get_value('group_b30kbpp4roh_select_u6xr9smqot');
    ?>

    i copied the id from inspector

    thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #19454
    Long Nguyen
    Moderator

    Hi,

    The value returned when getting the field group is an array, so you need to loop over the array by using foreach. Please follow this documentation to know how to display the group value
    https://docs.metabox.io/extensions/meta-box-group/#getting-sub-field-value

    #19473
    sofdesigne
    Participant

    Thanks alot,

    here is my working code

    <?php
    $group_value = rwmb_meta( 'group_b30kbpp4roh' );
    
    $value = isset( $group_value['select_u6xr9smqot'] ) ? $group_value['select_u6xr9smqot'] : '';
    echo $value; // Display sub-field value
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
grid gear info copy caret-up caret-down trash