-
AuthorPosts
-
March 21, 2016 at 1:05 pm #601190
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?March 22, 2016 at 1:51 am #601629Hey!
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,
JosueMarch 22, 2016 at 9:54 am #601770So you mean I should use:
[av_video src='[acf field=”fieldname”]’ format=’16-9′ width=’16’ height=’9′ custom_class=”]March 22, 2016 at 10:06 am #601777It could work, did you try it?
March 22, 2016 at 10:10 am #601785Yes, but it does not work.
It only outputs:
’ format=’16-9′ width=’16’ height=’9′ custom_class=”]Im placing in in a codeblock.
March 22, 2016 at 10:53 am #601803To 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.
March 22, 2016 at 11:26 am #601814Hey!
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!
JosueMarch 22, 2016 at 11:38 am #601817This works great.
Thanks Josue!March 22, 2016 at 12:03 pm #601822You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.
