• Resolved jayseventwo

    (@jayseventwo)


    Hi guys – great plugin!

    I have used the do_shortcode syntax to display YouTube videos from within my theme, which successfully works, but i now want to use a variable for the video_id, but cannot seem to get it to work.

    $youtube_id = the_field('new_youtube_link');
    	echo do_shortcode('[video_lightbox_youtube width="1280" height="720" auto_thumb="1" video_id="'.$youtube_id.'"]');

    This just echo’s out the ID, with a message “Error! You must specify a value for the Video ID, Width, Height parameters to use this shortcode!”

    Any ideas?

    Thanks in advance.

    https://www.ads-software.com/plugins/wp-video-lightbox/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jayseventwo

    (@jayseventwo)

    I should just add that i am inserting the video id through a custom field called “new_youtube_link”

    Thread Starter jayseventwo

    (@jayseventwo)

    Okay, so simple mistake – should have used “get_field” instead of “the_field” – all fixed now.

    FYI: i was using the advanced custom fields plugin to create the custom field, for anyone wondering.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using shortcode and variable’ is closed to new replies.