• Alex Ball

    (@alexball)


    Hey WordPress Community,

    PHP question here. I’ve created an athlete profile page, and I’m making the template for the output.

    I have a meta box for my client to insert their YouTube video ID, and use the Enhanced YouTube Shortcode. So help me out with the code…

    <?php echo do_shortcode('[youtube_video id="ofxTLWCmvUU"]'); ?>

    I want to make the id dynamic to the meta box that I have. Suggestions on how to make this work?

    I’ve tried:

    <?php echo do_shortcode('[youtube_video id="' ?><?php echo get_post_meta($post->ID, 'highlight', true) ?><?'"]'); ?>

    and

    <?php echo do_shortcode('[youtube_video id="' . echo get_post_meta($post->ID, 'highlight', true) . '"]'); ?>

  • The topic ‘Echoing Custom Meta Info in Shortcode’ is closed to new replies.