Support

Account

Home Forums Front-end Issues Returning multiple values from the video fields

Solving

Returning multiple values from the video fields

  • Hi I’m use the_field(‘field_name’) to return the ‘Video URL’ which I’ve set the field to, is it possible to use the_field(‘field_name’) to also return the ‘Thumbnail URL’ for the same field.

    Cheers

  • which field type are you using?

  • Hi @vindicateme, At the moment I’m trying it with this extension the video field https://github.com/findingsimple/acf-field-video.

    But I was also thinking this about the images field, if it’s selected to return the Image Object but some reason I needed to get hold of say Image URL or Image ID is there a simple work around.

    Cheers,
    ^JD

  • if you’ve set the return value to return an array or object, you can access those values like so:

    
    $video = get_field('video');
    $video_url = $video['url'];
    $video_thumbnail_url = $video['thumbnail'];
    
    $image = get_field('image');
    $image_url = $image['url'];
    $image = $image['id'];
    

    You can always view the entire object/array by using var_dump($image);

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

You must be logged in to reply to this topic.