Problem:
The issue here is that the user wanted to get the ID of his repeatable image fields.
Solution:
This can be done by using the code below.
// Put the code of your snippet below this comment. function wp_get_image_ids() { $image_urls = get_post_meta( get_the_ID(),'wpcf-galleria-evento'); $id_list = array(); foreach ($image_urls as $image_url) { if(!empty($image_url)){ $attachment = attachment_url_to_postid($image_url); array_push($id_list, $attachment); } } return implode(",", $id_list); } add_shortcode( 'wp_get_image_ids', 'wp_get_image_ids' );
Just replace "wpcf-galleria-evento" with the slug of your repeatable image fields keeping the wpcf- prefix.
Add this to your custom code section in our Toolset -> Settings-> Custom Code and activate it.
Then you can just use the shortcode below to get the ID [wp_get_image_ids]
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Ce sujet contient 4 réponses, a 2 voix.
Dernière mise à jour par Il y a 5 années et 5 mois.
Assisté par: Shane.