Navigation überspringen

[Gelöst] Repeating Custom Field: Embedded Media –> „wpv-for-each“ doesn’t seem to work

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

I have Repeating Custom Field: Embedded Media, where I insert YouTube Videos. How to display them in front-end?

Solution:

You can try [wpv-for-each] shortcode, for example:

[wpv-for-each field="wpcf-embedded-youtube"]
<div style="">[types field='embedded-youtube' ][/types]</div>
[/wpv-for-each]

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-for-each

This support ticket is created vor 4 Jahren, 1 Monat. There's a good chance that you are reading advice that it now obsolete.

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 – 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)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Lara vor 4 Jahren, 1 Monat.

Assistiert von: Luo Yang.

Author
Artikel
#1845293

Tell us what you are trying to do?
I have Repeating Custom Field: Embedded Media, where I insert YouTube Videos.

I tried to set it up in the following way:

[wpv-for-each field="wpcf-embedded-youtube"]
<div style="">[types field='embedded-youtube' ][/types]</div>
[/wpv-for-each]

I also tried:

[wpv-for-each field="embedded-youtube"]
<div style="">[types field='embedded-youtube' ][/types]</div>
[/wpv-for-each]

Both doesn't work. The videos only show up, if I use the following setup:

[types field='embedded-youtube' separator='<br/>'][/types]

I'm a bit unhappy with that solution, because there is no white space between the youtube videos. I also tried <br/><br/> as separator, but it doesn't change anything..

Is there any documentation that you are following?
https://toolset.com/forums/topic/repeater-field-line-breaks/
https://toolset.com/documentation/customizing-sites-using-php/functions/#embedded-media
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-for-each

Is there a similar example that we can see?
In the documentation

What is the link to your site?
Site under development

#1845385
embedded.JPG

Hello,

I have tried the same codes you mentioned above in my localhost with a fresh WP installation + the latest version of Toolset plugins, using below steps:
1) Create a repeating Embedded Media field "embedded-youtube"
2) Create a post, display a shortcode block:

[wpv-for-each field="wpcf-embedded-youtube"]
<div style="">[types field='embedded-youtube' ][/types]</div>
[/wpv-for-each]

It works fine in front-end, see my screenshot: embedded.JPG

Is there any missing?

I suggest you check these:
1) If you are using Blocks editor, please put those shortcodes into a shortcode block
https://wordpress.org/support/article/shortcode-block/

2) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

3) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again

#1846393

Thanks Luo. There was a compatibility problem with another plugin.
The problem is now solved 🙂