• Resolved unsavouryindividual

    (@unsavouryindividual)


    Hi folks,
    I need to be able to insert a shortcode in a template file and set a variable in the shortcode with php. I know I can’t break do_shortcode to insert my echo, so what can I do to work around this?

    For clarification, I’m considering using a plugin that generates a podcast player and I need to set the URL variable of the shortcode with a custom field of in the current post.
    Alternatively, if anyone can suggest a good podcast player project I can use as a standalone, that would be awesome too.

    Thanks

Viewing 1 replies (of 1 total)
  • It’s actually pretty easy…

    echo do_shortcode ('[shortcode value="'.$custom_value.'"]');

    Anything that’s in that call is just a normal PHP string, so you can cut it up and add things in as much as you like.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP inside do_shortcode or workaround?’ is closed to new replies.