Home Forums ACF PRO Oembed and repeater Reply To: Oembed and repeater

  • The joys of code!

    The youtube aspect worked great for me, it was just the vimeo side. I solved this by replacing the get_vimeo_uri function with the code example provided by vimeo here –

    I had to make a small tweak to pass the full url rather than just the id.

    function get_vimeo_thumbnail_uri( $clip_id ) {
    		$clip_id = ''.$clip_id;
    		$oembed_endpoint = '';
    // Grab the video url from the url, or use default
    $video_url = ($_GET['url']) ? $_GET['url'] : $clip_id;
    // Create the URLs
    $json_url = $oembed_endpoint . '.json?url=' . rawurlencode($video_url) . '&width=640';
    $xml_url = $oembed_endpoint . '.xml?url=' . rawurlencode($video_url) . '&width=640';
    // Curl helper function
    function curl_get($url) {
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        $return = curl_exec($curl);
        return $return;
    // Load in the oEmbed XML
    $oembed = simplexml_load_string(curl_get($xml_url));
        An alternate approach would be to load JSON,
        then use json_decode() to turn it into an array.
    return $oembed->thumbnail_url;