[Closed] Image field, multiple , types_render_field

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by bruce 8 years ago.

Assigned support staff: bruce.

Author
Posts
#13763

Hi, in a custom fields group I have an image one, with "This fields can appear multiple times when editing" checked.
In my frontend I'd love to use this field to generate an array of the uploaded images, in a certain size, so:
types_render_field("galleryfield", array("size"=>"thumbnail","url"=>"true"));
The output is a string like: hidden link etc
How to obtain an array instead of this unusable string?
Thanks. Love the plugin.

#13783

bruce
Supporter

Languages: English (English )

Timezone: Australia/Perth (GMT+08:00)

Hi Francesco,

Try adding separator="," and then explode.

Eg.

$my_array = explode(",", types_render_field("galleryfield", array("size"=>"thumbnail", "url"=>"true", "separator"=>",")));

I'm not sure if it will work.

Best regards,
Bruce.

#13786

Thanks but this solution cannot work. In fact there's no "," that separates the values. Here's the actual result:

hidden link

#13811

bruce
Supporter

Languages: English (English )

Timezone: Australia/Perth (GMT+08:00)

Hi Francesco,

Did you add the separator parameter to the types_render_field function. It should work then.

Best regards,
Bruce.

The topic ‘[Closed] Image field, multiple , types_render_field’ is closed to new replies.