Support » Plugins and Hacks » Simple Youtube Shortcode » Using the shortcode in a template

Using the shortcode in a template

  • Hi there
    I’m trying to display a Youtube video on the front page of a site that utilises the front-page.php file and so for the time being is a template. Can you tell me what syntax I should use to achieve this? I’ve been trying to use <?php echo do_shortcode('[embed_youtube src="https://www.youtube.com/watch?v=nJ0E3aqGbIU&noredirect=1" width="340" height="220" class="youtube" id="youtube"]'); ?> but no video displays although the container is present.

    I am hoping to use custom fields in the future so that I don’t have to update this page for my client, but that will also require the use of the do_shortcode. Would the code remain the same.

    Also, when this is output, the iframe has an allowfullscreen appended to it, is there a way to prevent this? In fact is there a list of other parameters that can be used?

    Thanks for any help you can give.


  • The topic ‘Using the shortcode in a template’ is closed to new replies.