• Resolved cjvalotta

    (@cjvalotta)


    I’m wondering if there is a way to do this?

    I’d like the variable of an ACF field to echo the url of a video into the shortcode url.. Is there a specific way to do this? I appreciate any insight.

    <?php $video = the_sub_field( ‘video_url’ );?>
    <?php echo do_shortcode(‘[su_youtube url=”‘.$video.'” width=”600″ height=”400″ responsive=”yes” autoplay=”no” mute=”no” class=””]’); ?>

Viewing 1 replies (of 1 total)
  • Plugin Author Vova

    (@gn_themes)

    Hi @cjvalotta,

    1. Make sure your code works without shortcode. Try this before:

    the_sub_field( 'video_url' );
    

    If video URL is displayed, continue to the next step. If it’s not, then read ACF documentation first.

    2. Replace the test code with the following:

    <?php
    $video_url = get_sub_field( 'video_url' );
    echo do_shortcode( '[su_youtube url="' . $video_url . '" width="600" height="400" responsive="yes" autoplay="no" mute="no" class=""]' );
    ?>
    
Viewing 1 replies (of 1 total)
  • The topic ‘Echo do_shortcode with ACF variable. Is it possible’ is closed to new replies.