Youtube Video
-
Hello
I have a PHP program that inserts youtube videos into a post by taking the youtube ID assigned from a data field
The code was as follows
<?php if ( $ytID ) { ?>
<div> Video from our YOUTUBE channel
</div>
<iframe width=”100%” height=”450″ src=”https://www.youtube.com/embed/<?php echo $ytID ?>”></iframe>
<?php } ?>But after some AMP plugin updates, I can’t tell exactly when, this code no longer worked and I had to add a new amp component, so that code is now like this.
<?php if ( $ytID ) { ?>
<div> Video from our YOUTUBE channel
</div>
<iframe width=”100%” height=”450″ src=”https://www.youtube.com/embed/<?php echo $ytID ?>”></iframe>
<amp-youtube width=”480″ height=”270″ layout=”responsive” data-videoid=”<?php echo $ytID ?>”></amp-youtube>
<?php } ?>It works fine, but I would like to make sure this is a good solution or if there is a better one.
Thanks
EnricoThe page I need help with: [log in to see the link]
- The topic ‘Youtube Video’ is closed to new replies.