Hi,
I am using Advanced Custom Fields (ACF) to display many fields inside Enfold portfolios.
It is working great.
One of the fields is a youtube address.
Is it possible to show embed this youtube adress?
Hey!
There’s a shortcode you can use:
[av_video src='http://www.youtube.com/watch?v=G0k3kHtyoqc' format='16-9' width='16' height='9' custom_class='']
Best regards,
Josue
So you mean I should use:
[av_video src='[acf field=”fieldname”]’ format=’16-9′ width=’16’ height=’9′ custom_class=”]
It could work, did you try it?
Yes, but it does not work.
It only outputs:
’ format=’16-9′ width=’16’ height=’9′ custom_class=”]
Im placing in in a codeblock.
To be clear:
[acf field=”youtube”] outputs the correct youtube address
but
[av_video src='[acf field=”youtube”]’ format=’16-9′ width=’16’ height=’9′ custom_class=”] only outputs:
’ format=’16-9′ width=’16’ height=’9′ custom_class=”]
It seems it does not allow a shortcode inside a shortcode.
Hey!
You could try creating a new, custom shortcode just for this, try adding this to functions.php:
function custom_shortcode_func() {
ob_start();
echo do_shortcode("[av_video src='".get_field('youtube')."' format='16-9' width='16' height='9']");
$output = ob_get_clean();
return $output;
}
add_shortcode('acf_youtube_embed', 'custom_shortcode_func');
Then use:
[acf_youtube_embed]
Cheers!
Josue
This works great.
Thanks Josue!
You are welcome, glad to help :)
Regards,
Josue