Support

Account

Home Forums Add-ons Repeater Field images in repeater form

Solving

images in repeater form

  • having got the repeater form to work with text and wysiwyg formats I am now trying to add a sub field with an image I have it showing up on the edit page but when previewed I can only see url not the graphic am I needing to add a bit of code ? please excuse my ignorance I am new to coding.

  • having got the repeater form to work with text and wysiwyg formats I am now trying to add a sub field with an image I have it showing up on the edit page but when previewed I can only see url not the graphic am I needing to add a bit of code ? please excuse my ignorance I am new to coding.

    <?php
    // check if the repeater field has rows of data
    if( have_rows('features') ):
    
     	// loop through the rows of data
        while ( have_rows('features') ) : the_row();
    
            // display a sub field value
            the_sub_field('hero');
            the_sub_field('content');
        endwhile;
    
    else :
    
        // no rows found
    
    endif;
    ?>

    `

  • An image field does not return an image tag. You have a choice between Array, URL or ID. To show the image you need to do the rest of the work yourself. Using the different return values is covered in the image field documentation https://www.advancedcustomfields.com/resources/image/

  • Thanks for that I can now make that work on its own I now need to combine three subfields a text field an image field and wysiwyg field is there a specific syntax to combining all three

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.