Support

Account

Home Forums General Issues oEmbed – Animoto Video not displaying

Helping

oEmbed – Animoto Video not displaying

  • I have a new oEmbed field created in ACF PRO 5.1 and I have the default code in my custom template PHP file.

    I am able to enter a YouTube video shortcode URL into the new field and it will display perfectly on my site page. But when I enter an Animoto video shortcode URL into the field it will not display and in fact the URL is not even included in the code to render the page.

    Does anyone know why YouTube works but not Animoto? I can enter the Animoto URL directly into content area of a Page/Post and it will work but not when it’s entered into the ACF custom field on the Page/Post.

    <div class="video-wrap">
    <?php
    
    // get iframe HTML
    $iframe = get_field('oembed');
    
    // use preg_match to find iframe src
    preg_match('/src="(.+?)"/', $iframe, $matches);
    $src = $matches[1];
    
    // add extra params to iframe src
    $params = array(
        'controls'    => 0,
        'hd'        => 1,
        'autohide'    => 1
    );
    
    $new_src = add_query_arg($params, $src);
    
    $iframe = str_replace($src, $new_src, $iframe);
    
    // add extra attributes to iframe html
    $attributes = 'frameborder="0"';
    
    $iframe = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);
    
    // echo $iframe
    echo $iframe;
    
    ?>
    	</div>

    ACF 5.1, WordPress 4.1

  • This reply has been marked as private.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.