Support

Account

Home Forums Front-end Issues Cloned Text Field Trying to Output as an Array

Helping

Cloned Text Field Trying to Output as an Array

  • Hello, I have setup a clone field using the the Display: Group setting containing two fields, one is a text field and one is a WYSIWYG field.

    Here is how I am defining and displaying them:

    $contentGroup = get_sub_field('content_clone_sec');
      if ($contentGroup) {
      $contentClass = $contentGroup['content_class'];
      $content = $contentGroup['content'];
    }
    
    if ($content) {
      echo '<div class="block-content ' . $contentClass . '">' . $content . '</div>';
    }

    For the echo line I am getting the error “Warning: Array to string conversion”, but neither of the fields are arrays.

    Trying to simplify the code to just outputting the text field and leaving out the WYSIWYG field doesn’t make a difference.

    I am using this same method to output other fields and it works without any issues.

    Any insight into the bug is appreciated.

  • content_clone_sec does not appear to be a sub field unless I’m missing something this:

    
    $contentGroup = get_sub_field('content_clone_sec');
    

    should be:

    
    $contentGroup = get_field('content_clone_sec');
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.