Skip Navigation

[Resolved] Youtube url – related videos

This support ticket is created 6 years, 1 month ago. 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.

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 1 month ago.

Author
Posts
#1112453

I made a custom field called video-url. My client then pastes in the url of the youtube video. On the front of the site, I show this custom field and it plays the video. But I need to add a rel=0 to the end of the url so that it doesn't show related videos. That is the fatal flaw of using your embed media custom field type. It doesn't let me add any code to pull this off.

Can you help?

#1112706

It depends on what exactly the client of yours copy/pastes to the Field input.

The problem is that if you insert the Field so to output a iFrame (the player) then this produces a HTML as this:

<iframe width="525" height="295" src="<em><u>hidden link</u></em>" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe>

But the URL inserted to the Fields usually is something like hidden link

Now, as you see to append URL parameters to the URL you would need to output the RAW URL as you insert it to the Field's input (which is possible by using output='raw' in the ShortCode displaying the field (this will show only the URL saved), but it still does not allow you to insert the required /embed/ code of the iFrame to the URL.

You would need to require your client to for as example insert only the Unique ID of the Video to a FIeld (7IH41CQIU-Q), and use that to craft a semi-dynamic Link in a Content Template like so:

<iframe width="525" height="295" src="<em><u>hidden link</u></em> field='field-with-unique-id' output='raw'][/types]?feature=oembed" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe>

Would that work in your setup?