Marc Ster
Marc Ster

Reputation: 2316

echo youtube video src in ifram with php

This is what I wanna do:

<iframe width="560" height="315" src="//<?php $key="youtubevideo"; echo get_post_meta($post->ID, $key, true); ?>"frameborder="0" allowfullscreen></iframe>

This is what happens:

<iframe frameborder="0" width="560" height="315" allowfullscreen="" src="//https://www.youtube.com/watch?v=IuRbVuQNppU">

How can I echo this correctly?

Thank you

Upvotes: 0

Views: 471

Answers (1)

Sigit prasetya nugroho
Sigit prasetya nugroho

Reputation: 173

Try this , change $key="youtubevideo" ----> $key='youtubevideo'

<iframe width="560" height="315" src="<?php $key='youtubevideo'; echo get_post_meta($post->ID, $key, true); ?>" frameborder="0" allowfullscreen></iframe>

Upvotes: 1

Related Questions