Support

Account

Home Forums General Issues Using field data in shortcode Reply To: Using field data in shortcode

  • Hey @tintin,

    You’ll want to create a variable for your string then use a concatenated string -> http://php.net/manual/en/language.operators.string.php.

    $idcode = get_field('id_code');
    echo do_shortcode('[shortcode id="'.$idcode.'"]');

    You could also skip the variable all together and just use the get_field function inline.

    echo do_shortcode('[shortcode id="'.get_field('id_code').'"]');

    Hope that helps. 🙂

    EDIT: Added inline function option.