WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Advanced Custom Fields to show Vimeo videoes on a site I am creating for a client - The client pastes the vimeo ID (the last letters in the url) in a field, and the video is shown. But I would also like to show thumbnail of the video, I am using the following (not working code) for this:

$imgid = the_field('video_link');
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$imgid.php"));
echo $hash[0]['thumbnail_medium'];  

This code only shows the video-ID on the page. But if I, instead for "the_field('video_link')" writes the video-ID in the code - the thumbnail URL is displayed. Does anyone know what I am doing wrong? :)

share|improve this question

closed as off topic by EAMann Aug 7 '12 at 23:13

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This doesn't really have anything to do with WordPress. Migrating to Stack Overflow where it will be more on-topic. – EAMann Aug 7 '12 at 23:13
up vote 1 down vote accepted

Maybe this can help

$videoID = the_field('video_link');
$jsonurl = 'http://vimeo.com/api/v2/video/'.$videoID.'.json';
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json,true);
echo '<img src="'. $json_output[0]['thumbnail_large'] .'" />';

It's the same call using json method

share|improve this answer
Thanks @ifdion But I figures out I just needed to use get_field, instead of the_field! :) – Cody Aug 8 '12 at 13:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.