Support

Account

Forum Replies Created

  • So, I posted this before I found: https://www.advancedcustomfields.com/resources/oembed/

    The section entitled “Display value with additional attributes” is the exact code I am using. I can now control the button color 🙂

    The code I am using looks like:

    <?php
    $video = get_sub_field('video');
    
    preg_match('/src="(.+?)"/', $video, $matches);
    $src = $matches[1];
    
    $params = array(
    'color' => f1d925
    );
    
    $new_src = add_query_arg($params, $src);
    $video = str_replace($src, $new_src, $video);
    
    $attributes = 'frameborder="0"';
    $video = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $video);
    
    echo '<div class="video">'.$video.'</div>';
    ?>

    Thanks,
    Josh

  • Hey there,

    Thanks for your reply, I actually just figured this out before I read your answer…total rookie mistake. In ACF I chose Image URL instead of Image Array. I was thinking because it was a single field there would be no “array”, as there is only one item…but that literally just passed the URL through and didn’t give me all the options that the array provides.

    So, the code didn’t change:

    <?php
         $page_title = get_page_by_title( 'How it Works' );
         $page_image = get_field('title', $page_title->ID);
    ?>
         <img src="<?php echo $page_image['sizes']['thumbnail']; ?>" />

    Thanks,
    Josh

Viewing 2 posts - 1 through 2 (of 2 total)