title: Passing ACF Field To Shortcode
body: <p>I'm currently creating a small plugin that just makes custom post types. I wanted to add a shortcode that easily places an audio player on the page. The URL of the MP3 can change per post, and I am using Advanced Custom Fields (ACF) to get the URL from the user. How can I pass the the URL field to the shortcode? Here is my shortcode function:</p>
  
  <pre><code>// Add A Shortcode for the MP3 Player
  function sermon_audio_shortcode() {
      // Code
      $output = '&lt;script&gt;';
      $output .= 'audiojs.events.ready(function() {';
      $output .= 'var as = audiojs.createAll();';
      $output .= '});';
      $output .= '&lt;/script&gt;';
  
      $mp3url = get_field('f1sermon_mp3_url');
  
      $output .= '&lt;audio src="';
      $output .= 'echo $mp3url';
      $output .= '" preload="auto" /&gt;';
  
      return $output;
  }
  add_shortcode( 'sermon-audio', 'sermon_audio_shortcode' );
  </code></pre>
  
  <p>I tried just <code>$output .= echo $mp3url;</code> but that is incorrect as well. The shortcode works correctly but the URL is just "echo $mp3url" Any thoughts?</p>