Read More

Vimeo oEmbed API is not working on shared hosting

Problem: When you’re on shared hosting and you want to embed Vimeo video’s, but can seem to get them to work on your Autofocus+ theme.

According to different support-threads on the internet, for example on Vimeo’s own forum here. Vimeo blocks users who access the API to often from the same IP. On shared hosting this is something you could run into, altho your hostingcompany probably would never confirm this, nor would Vimeo. Solution is build because of this thread on Getsatisfaction.com/fthrwght/

Solution for Autofocus+ theme (Theme is created by Allan Cole, change is build by Snapcat).. This change is probably applicable for multiple themes, but the starting point here is Allan’s theme. Here we go:

Open the file: wp-contentthemesautofocusincautofocus-images.php

After line 274 add:

// CODE CHANGE
<?php

} elseif ( get_post_meta($post->ID, ‘iframe_value’, true) ) { ?>

<div class=”entry-video-container”>
<?php
$af_iframe = get_post_meta($post->ID, ‘iframe_value’, true);
$iframe_url = ‘<iframe src=’ . $af_iframe . ‘?color=e6b93e” width=”800″ height=”533″ frameborder=”0″/></iframe>’;
echo $iframe_url ; ?>
</div><!– .entry-video-container –>

<?php
// END CODE CHANGE

Scroll down and after line 429 add:

// CODE CHANGE
// Is there an iframe attached?
if ( get_post_meta($post->ID, 'iframe_value', true) ) {
$af_video_url = get_post_meta($post->ID, 'iframe_value', true);
return $af_iframe;
}
// END CODE CHANGE

Save the file and overwrite in on the webserver.

Now open the file: wp-contentthemesautofocusincautofocus-post-meta.php

After line 19 add:

// CODE CHANGE
"iframe" => array(
"name" => "iframe_value",
"title" => __("Iframe","autofocus"),
"type" => "text",
"std" => "",
"description" => __("Paste your piece of Vimeo iframe code here. Example: http://player.vimeo.com/video/36158915","autofocus")),
// END CODE CHANGE

Save the file and overwrite in on the webserver.

Now go to your video on Vimeo.com and click the Share button and copy the piece of code you see marked below:

Vimeo oEmbed API is not working on shared hosting

So in this example you’ll have the iframe code shown below:

<iframe src="http://player.vimeo.com/video/36158915?color=78c90e" width="500" height="275" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <p><a href="http://vimeo.com/36158915">11.11.11</a> from <a href="http://vimeo.com/erinmurphy">Erin Murphy</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

and only take this piece: http://player.vimeo.com/video/36158915

Now you’ll start your new post (or edit an existing) and notice an additional field:

Vimeo oEmbed API is not working on shared hosting

In this field you paste the piece of code, you just copied.

As a result you’ll have a working Vimeo video shown on your website:

Vimeo oEmbed API is not working on shared hosting

Easy as pie! Good luck!

The two editted files are also available for download here. Upload the files to: /wp-content/themes/autofocus/inc/

2 Reacties, geef ook jouw reactie!

  1. #wordpress #vimeo RT @Snapcatnl Vimeo oEmbed api is not working on shared hosting with WP | Snapcat http://t.co/vqMsdvhG via @snapcatnl

  2. Vimeo oEmbed api is not working on shared hosting | Snapcat http://t.co/vqMsdvhG via @snapcatnl

Laat ons weten wat je vindt!