WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using WP YouTube Lyte to show YouTube videos. I'm combining it with Advanced Custom Fields so that the user can just add the YouTube id to show the video. I'm using the WP YouTube Lyte short code but it is writing the code the wrong way round.

Below is the code:

<?php if( get_field('video_file') ): 
$video = the_field("video_file");
<?php echo do_shortcode('[lyte id="'. $video . '" /]'); ?>
<?php endif; ?>

Here is the result:


When I just add a YouTube id into the code it displays the video correctly.

share|improve this question

the_field() prints the value, it doesn’t return the string, so you cannot use it in a variable. Use …

$video = get_field("video_file");

… instead.

share|improve this answer
Thanks. So simple!!! – Josh Dec 27 '12 at 11:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.