Tagged: , ,

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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?

    #601629

    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

    #601770

    So you mean I should use:
    [av_video src='[acf field=”fieldname”]’ format=’16-9′ width=’16’ height=’9′ custom_class=”]

    #601777

    It could work, did you try it?

    #601785

    Yes, but it does not work.
    It only outputs:
    ’ format=’16-9′ width=’16’ height=’9′ custom_class=”]

    Im placing in in a codeblock.

    #601803

    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.

    #601814

    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

    #601817

    This works great.
    Thanks Josue!

    #601822

    You are welcome, glad to help :)

    Regards,
    Josue

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.