WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Inserting a Shortcode into conditional with Custom Field

[Resolved] Inserting a Shortcode into conditional with Custom Field

  • cmdshiftdesign
    Member

    @cmdshiftdesign

    OK, so i have a custom field that is specifying the URL of an MP3 file for a podcast, and the end goal is for that URL to be inserted into the shortcode for the audioplayer…

    which looks like this [audio:http://domain.com/audio.mp3%5D

    SO I need something in the theme that says …

    if there us something in the mp3_link field
    [audio: *stick it right here*]

    <?php $values = get_field('mp3_link');
    	   if($values)
       {
        echo '' . do_shortcode(' [audio:$values] ') . '';
       }
        ?>

    I know i am missing something… this is the code i have and it returns [audio:http://domain.com/audio.mp3%5D but …not as code, but as text — so it’s not being translated to the audio player.

    Eh?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Inserting a Shortcode into conditional with Custom Field’ is closed to new replies.