Support

Account

Home Forums Add-ons Gallery Field Is there a way to use get_sub_field to return unformatted data?

Solving

Is there a way to use get_sub_field to return unformatted data?

  • Hi – I am looking for a way to include a gallery field that will produce a WP default gallery inside a repeater. When I’m outside the repeater I can get it to work perfectly by using the extra parameters in get_field:

    $image_ids = get_field('photos', false, false);

    but I am struggling to get the same effect inside the repeater with get_sub_field – I know it doesn’t have those extra parameters to return unformatted data, but is there any other way to strip out just the IDs inside a repeater like this?

    Thanks in advance for any help or pointers!

  • Hi @elemenopy

    Unfortunately, it is not possible to load sub fields without formatting.
    I will add this to the to-do for ACF5 and see if there is a way to solve the limitation.

    Thanks
    E

  • I am using galleries as sub field and they are working perfectly. At my localhost anyway. When I tested my website on my test server, the galleries didn’t show… What could be going on?

    Thanks

  • lucawater- do you mind sharing the code you used to get it work?

  • Unfortunately, it’s not an ideal solution.

    In my WordPress ACF settings, I made a repeater field inside a flexible content field. There is an image field inside that repeater. I’m getting the images’ data with ‘get_sub_field(‘image’)’ and put these in a gallery(royalslider).

  • Owww!!! I have the same problem!!!
    Just posted a New Topic about this!

    Elliote, any news about this on version 5?
    Maybe I could use the Beta right now!

    Thanks

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

The topic ‘Is there a way to use get_sub_field to return unformatted data?’ is closed to new replies.