Display data from cloned fields

Support MB Settings Page Display data from cloned fields

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3556
    Infolu OfficialInfolu Official
    Participant

    need personal view of the cloned field data, however it just returns me the word array, and debug returns me the current error () expects parameter 1 to be array, null given in
    I have the following code

    Page configuration field

    array (
        'Id' => $PrefixField. "Company_contact"
        'Name' => __ ( 'phones', 'your-prefix'),
        'Type' => 'text'
        'Clone' => true,
        'Max_clone' => 5,
    )

    To view have tried unsuccessfully

    $Settings = get_Option ('ims_settings');
    $FIELD_ID = 'ims_settings_default_mf_company_contact';
    if (isset ($settings[$FIELD_ID]))
    {
        echo $settings[$FIELD_ID];
    }

    Can anyone help me with an example of how to do?

    #3559
    Anh TranAnh Tran
    Keymaster

    Hi,

    The contact field is a cloned field, so it has values as an array. To output its values, you need to use a foreach loop, as this:

    $settings = get_option( 'ims_settings' );
    $field_id = 'ims_settings_default_mf_company_contact';
    if ( !empty( $settings[$field_id] ) && is_array( $settings[$field_id] ) ) {
        foreach ( $settings[$field_id] as $field_value ) {
            echo $field_value, '<br>';
        }
    }
    #3565
    Infolu OfficialInfolu Official
    Participant

    Perfect, thanks for the help

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Display data from cloned fields’ is closed to new replies.