Support

Account

Home Forums Front-end Issues Using ACF field in do_shortcode()

Unread

Using ACF field in do_shortcode()

  • I have tried the following:

    echo do_shortcode( '[video_lightbox_vimeo5 video_id="'.the_sub_field( 'expertise_video_video').'" width="1280" height="960" anchor="http://paraffin.foxrobinson.com/wp-content/uploads/2023/08/purple_square.jpg"]');

    As recommended here: https://wordpress.stackexchange.com/questions/275152/using-acf-field-in-do-shortcode

    But this doesn’t work. I get the message:

    “Error! You must specify a value for the Video ID, Width, Height and Anchor parameters to use this shortcode!”

    The field is a text field and outputs a Viemo ID. If I add the Vimeo ID in directly to the shortcode it works fine.

    I have also tried adding the field as a variable in this style:

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

    But get the same error message.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.