Adding parameters to vimeo videos via wordpress oembedWP Oembed not passing through the “autoplay=1” variableIs there a better way to do optional function parameters in JavaScript?Can I install/update WordPress plugins without providing FTP access?Set a default parameter value for a JavaScript functionGet img thumbnails from Vimeo?Pass a JavaScript function as parameterruby-oembed, Vimeo custom parameters?Vimeo oEmbed API stopped workingWordpress oEmbed not working when echoing Vimeo linkVimeo oEmbed not working with curl+PHPoEmbed discovery for Vimeo
Apex Framework / library for consuming REST services
Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Why is this clock signal connected to a capacitor to gnd?
Is this a hacking script in function.php?
How does a predictive coding aid in lossless compression?
Determining Impedance With An Antenna Analyzer
Can compressed videos be decoded back to their uncompresed original format?
Method Does Not Exist error message
Why doesn't using multiple commands with a || or && conditional work?
What's the in-universe reasoning behind sorcerers needing material components?
Avoiding the "not like other girls" trope?
iPad being using in wall mount battery swollen
What mechanic is there to disable a threat instead of killing it?
How do I handle a potential work/personal life conflict as the manager of one of my friends?
Expand and Contract
Why can't we play rap on piano?
How could indestructible materials be used in power generation?
Is there a hemisphere-neutral way of specifying a season?
Why didn't Boeing produce its own regional jet?
What is the most common color to indicate the input-field is disabled?
What does “the session was packed” mean in this context?
CAST throwing error when run in stored procedure but not when run as raw query
How seriously should I take size and weight limits of hand luggage?
Adding parameters to vimeo videos via wordpress oembed
WP Oembed not passing through the “autoplay=1” variableIs there a better way to do optional function parameters in JavaScript?Can I install/update WordPress plugins without providing FTP access?Set a default parameter value for a JavaScript functionGet img thumbnails from Vimeo?Pass a JavaScript function as parameterruby-oembed, Vimeo custom parameters?Vimeo oEmbed API stopped workingWordpress oEmbed not working when echoing Vimeo linkVimeo oEmbed not working with curl+PHPoEmbed discovery for Vimeo
I'm trying to add parameters to vimeo video's that are embedden via Wordpress' oembed. I've managed to do this for youtube video's with the code below. I use this function in functions.php and it works like a charm. I've edited the code to do the same for Vimeo video's, but I can't seem to make it work.
This is my code:
function Oembed_vimeo_no_title($html,$url,$args)
// Only run this for vimeo embeds
if ( !strstr($url, 'vimeo.com') )
return $html;
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);
if (isset($id['v']))
return '<div id="video_full_width"><iframe width="100%" height="394" src="//player.vimeo.com/video/'.$id['v'].'?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe></div>';
return $html;
add_filter('oembed_result','Oembed_vimeo_no_title',10,3);
Any suggestion on what I'm doing wrong?
wordpress function vimeo oembed
add a comment |
I'm trying to add parameters to vimeo video's that are embedden via Wordpress' oembed. I've managed to do this for youtube video's with the code below. I use this function in functions.php and it works like a charm. I've edited the code to do the same for Vimeo video's, but I can't seem to make it work.
This is my code:
function Oembed_vimeo_no_title($html,$url,$args)
// Only run this for vimeo embeds
if ( !strstr($url, 'vimeo.com') )
return $html;
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);
if (isset($id['v']))
return '<div id="video_full_width"><iframe width="100%" height="394" src="//player.vimeo.com/video/'.$id['v'].'?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe></div>';
return $html;
add_filter('oembed_result','Oembed_vimeo_no_title',10,3);
Any suggestion on what I'm doing wrong?
wordpress function vimeo oembed
add a comment |
I'm trying to add parameters to vimeo video's that are embedden via Wordpress' oembed. I've managed to do this for youtube video's with the code below. I use this function in functions.php and it works like a charm. I've edited the code to do the same for Vimeo video's, but I can't seem to make it work.
This is my code:
function Oembed_vimeo_no_title($html,$url,$args)
// Only run this for vimeo embeds
if ( !strstr($url, 'vimeo.com') )
return $html;
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);
if (isset($id['v']))
return '<div id="video_full_width"><iframe width="100%" height="394" src="//player.vimeo.com/video/'.$id['v'].'?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe></div>';
return $html;
add_filter('oembed_result','Oembed_vimeo_no_title',10,3);
Any suggestion on what I'm doing wrong?
wordpress function vimeo oembed
I'm trying to add parameters to vimeo video's that are embedden via Wordpress' oembed. I've managed to do this for youtube video's with the code below. I use this function in functions.php and it works like a charm. I've edited the code to do the same for Vimeo video's, but I can't seem to make it work.
This is my code:
function Oembed_vimeo_no_title($html,$url,$args)
// Only run this for vimeo embeds
if ( !strstr($url, 'vimeo.com') )
return $html;
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $id);
if (isset($id['v']))
return '<div id="video_full_width"><iframe width="100%" height="394" src="//player.vimeo.com/video/'.$id['v'].'?title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe></div>';
return $html;
add_filter('oembed_result','Oembed_vimeo_no_title',10,3);
Any suggestion on what I'm doing wrong?
wordpress function vimeo oembed
wordpress function vimeo oembed
edited Jun 24 '14 at 20:02
Rik
asked Jun 24 '14 at 19:56
RikRik
1616
1616
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I find that a better way to do it is on the oembed_fetch_url filter hook, like so:
<?php
/**
* Add parameters to embed
*
* @src https://foxland.fi/adding-parameters-to-wordpress-oembed/
* @src https://github.com/WordPress/WordPress/blob/ec417a34a7ce0d10a998b7eb6d50d7ba6291d94d/wp-includes/class-oembed.php#L553
* @src https://developer.vimeo.com/api/oembed/videos
*
* Use it like this: `[embed autoplay="true"]https://vimeo.com/190063150[/embed]`
*/
$allowed_args = ['autoplay'];
function koa_oembed_args($provider, $url, $args)
global $allowed_args;
$filtered_args = array_filter(
$args,
function ($key) use ($allowed_args)
return in_array($key, $allowed_args);
,
ARRAY_FILTER_USE_KEY
);
foreach ($filtered_args as $key => $value)
$provider = add_query_arg($key, $value, $provider);
return $provider;
add_filter('oembed_fetch_url', 'koa_oembed_args', 10, 3);
More details in my other answer here: https://stackoverflow.com/a/55053642/799327
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24395204%2fadding-parameters-to-vimeo-videos-via-wordpress-oembed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I find that a better way to do it is on the oembed_fetch_url filter hook, like so:
<?php
/**
* Add parameters to embed
*
* @src https://foxland.fi/adding-parameters-to-wordpress-oembed/
* @src https://github.com/WordPress/WordPress/blob/ec417a34a7ce0d10a998b7eb6d50d7ba6291d94d/wp-includes/class-oembed.php#L553
* @src https://developer.vimeo.com/api/oembed/videos
*
* Use it like this: `[embed autoplay="true"]https://vimeo.com/190063150[/embed]`
*/
$allowed_args = ['autoplay'];
function koa_oembed_args($provider, $url, $args)
global $allowed_args;
$filtered_args = array_filter(
$args,
function ($key) use ($allowed_args)
return in_array($key, $allowed_args);
,
ARRAY_FILTER_USE_KEY
);
foreach ($filtered_args as $key => $value)
$provider = add_query_arg($key, $value, $provider);
return $provider;
add_filter('oembed_fetch_url', 'koa_oembed_args', 10, 3);
More details in my other answer here: https://stackoverflow.com/a/55053642/799327
add a comment |
I find that a better way to do it is on the oembed_fetch_url filter hook, like so:
<?php
/**
* Add parameters to embed
*
* @src https://foxland.fi/adding-parameters-to-wordpress-oembed/
* @src https://github.com/WordPress/WordPress/blob/ec417a34a7ce0d10a998b7eb6d50d7ba6291d94d/wp-includes/class-oembed.php#L553
* @src https://developer.vimeo.com/api/oembed/videos
*
* Use it like this: `[embed autoplay="true"]https://vimeo.com/190063150[/embed]`
*/
$allowed_args = ['autoplay'];
function koa_oembed_args($provider, $url, $args)
global $allowed_args;
$filtered_args = array_filter(
$args,
function ($key) use ($allowed_args)
return in_array($key, $allowed_args);
,
ARRAY_FILTER_USE_KEY
);
foreach ($filtered_args as $key => $value)
$provider = add_query_arg($key, $value, $provider);
return $provider;
add_filter('oembed_fetch_url', 'koa_oembed_args', 10, 3);
More details in my other answer here: https://stackoverflow.com/a/55053642/799327
add a comment |
I find that a better way to do it is on the oembed_fetch_url filter hook, like so:
<?php
/**
* Add parameters to embed
*
* @src https://foxland.fi/adding-parameters-to-wordpress-oembed/
* @src https://github.com/WordPress/WordPress/blob/ec417a34a7ce0d10a998b7eb6d50d7ba6291d94d/wp-includes/class-oembed.php#L553
* @src https://developer.vimeo.com/api/oembed/videos
*
* Use it like this: `[embed autoplay="true"]https://vimeo.com/190063150[/embed]`
*/
$allowed_args = ['autoplay'];
function koa_oembed_args($provider, $url, $args)
global $allowed_args;
$filtered_args = array_filter(
$args,
function ($key) use ($allowed_args)
return in_array($key, $allowed_args);
,
ARRAY_FILTER_USE_KEY
);
foreach ($filtered_args as $key => $value)
$provider = add_query_arg($key, $value, $provider);
return $provider;
add_filter('oembed_fetch_url', 'koa_oembed_args', 10, 3);
More details in my other answer here: https://stackoverflow.com/a/55053642/799327
I find that a better way to do it is on the oembed_fetch_url filter hook, like so:
<?php
/**
* Add parameters to embed
*
* @src https://foxland.fi/adding-parameters-to-wordpress-oembed/
* @src https://github.com/WordPress/WordPress/blob/ec417a34a7ce0d10a998b7eb6d50d7ba6291d94d/wp-includes/class-oembed.php#L553
* @src https://developer.vimeo.com/api/oembed/videos
*
* Use it like this: `[embed autoplay="true"]https://vimeo.com/190063150[/embed]`
*/
$allowed_args = ['autoplay'];
function koa_oembed_args($provider, $url, $args)
global $allowed_args;
$filtered_args = array_filter(
$args,
function ($key) use ($allowed_args)
return in_array($key, $allowed_args);
,
ARRAY_FILTER_USE_KEY
);
foreach ($filtered_args as $key => $value)
$provider = add_query_arg($key, $value, $provider);
return $provider;
add_filter('oembed_fetch_url', 'koa_oembed_args', 10, 3);
More details in my other answer here: https://stackoverflow.com/a/55053642/799327
answered Mar 7 at 22:22
Laust DeleuranLaust Deleuran
3071318
3071318
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24395204%2fadding-parameters-to-vimeo-videos-via-wordpress-oembed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown