Title: Echo do_shortcode with ACF variable. Is it possible
Last modified: December 7, 2018

---

# Echo do_shortcode with ACF variable. Is it possible

 *  Resolved [cjvalotta](https://wordpress.org/support/users/cjvalotta/)
 * (@cjvalotta)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/echo-do_shortcode-with-acf-variable-is-it-possible/)
 * 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](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/echo-do_shortcode-with-acf-variable-is-it-possible/#post-10961684)
 * Hi [@cjvalotta](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [url](https://wordpress.org/support/topic-tag/url/)
 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * 1 reply
 * 2 participants
 * Last reply from: [Vova](https://wordpress.org/support/users/gn_themes/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/echo-do_shortcode-with-acf-variable-is-it-possible/#post-10961684)
 * Status: resolved