Skip Navigation

[Resolved] Shortcode [wpv-for-each] displayng as plain text and wrapper tags don't loop

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 11 years ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by keaneL-2 11 years ago.

Assisted by: Luo Yang.

Author
Posts
#75484

The shortcode [wpv-for-each] is displaying as plain text. The images are being displayed, but the html codes that are supposed to loop aren't working.

echo do_shortcode('[wpv-for-each field="wpcf-wedding_ceremony_photos"]
<figure class="figure">
             	      <a href="#" class="lightbox-image" data-gal="prettyPhoto[1]">
             	          [types field="wedding_ceremony_photos" width="128" height="128"][/types]
             	      </a>
             	</figure>[/wpv-for-each]');

I can actually use get_post_meta, as an alternative. However, I really need to use Types' auto thumbnail resize feature.

Help will be appreciated 🙂

#75811

Hi keaneL-2,

Are you using latest version of Views?
You can download it here:
https://toolset.com/my-account/downloads/

And the shortcode [wpv-for-each] is a feature of Views.
Please let me know if you need more assistance.

Regards
Luo

#75864

Hi Luoy,

I'm using the latest version of Types. The images are displaying correct, there are multiple values for that particular custom field.

Since I'm not using Views, how can I display all images and wrap each image in HTML code?

Thanks.

#76298

Please add "index" parameter in the Types shortcode, like this:

$photos = get_post_meta(get_the_ID(), 'wpcf-wedding_ceremony_photos', false);
foreach($photos as $index => $photo)
{
echo do_shortcode('<figure class="figure">
                      <a href="#" class="lightbox-image" data-gal="prettyPhoto[1]">
                          [types field="wedding_ceremony_photos" width="128" height="128" index=' . $index .'][/types]
                      </a>
                </figure>');
}

Please let me know if you need assistance to do it

#76525

Worked like a charm!

Thanks Luoy!

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.