I am trying to get some oembed parameters attached to my Vimeo clips. I tried to get it going using the following two instructions:
- Passing Parameters to a Vimeo link in a WordPress Custom Field – LimeCanvas.com
- Any way to use a custom parameter for YouTube embed without using an iframe – WordPress.SE.com
Unfortunately what works for YouTube won’t work for Vimeo, as the returning URL has no such string as ?feature=oembed
that I can make str_replace
work on. It is just the video’s id at the end of the URL, which is random. I can make it work if I enter the exact ID of the clip to make str_replace
look for.
Any idea how to make the function look for numbers and attach the parameters? An example clip would be
http://vimeo.com/14956293
and the oEmbed should be
//player.vimeo.com/video/14956293?color=FFFFFF&title=0&byline=0.
As you can see here, there is another difference to YouTube. The arguments start with? and connects the arguments with &
. Whereas YouTube begins with &
and also connects the arguments with &
.
You should add a filter on oembed provider to allow customs parameters:
then, in your template:
or via a shortcode in post’s content:
and you can do the same for youtube and all others oembed providers (if your
my_oembed_fetch_url
allow it)