Insert Youtube ID from Custom Field into Embed Code
-
I have a custom field setup called “youtubeid”. One can insert the ID of a youtube video into it, then on my single.php page, it checks to see if that ID exists, then it inserts that ID into some embed code to put the youtube video into the post. This works nicely for me because i can then also pull the thumbnail image of the video from youtube for my archives page. The video part works in every browser EXCEPT Internet explorer. Thumbnails work fine.
I’m wondering if IE just doesn’t like you putting php into video embedding code?
This is what my code looks like to display the video.
<?php $youtubeid = get_post_meta($post->ID, "youtubeid", true); ?> <?php if($youtubeid !== '') { ?> <div class="video_style"> <object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="https://www.youtube.com/v/<?php echo $youtubeid; ?>"> <param name="movie" value="https://www.youtube.com/v/<?php echo "youtubeid"; ?>" /> </object> </div> <?php } ?>
Any thoughts on why IE won’t display the video?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Insert Youtube ID from Custom Field into Embed Code’ is closed to new replies.