0

My blog has simple posts including a youtube videos. For example:

<iframe width="460" height="342" src="http://www.youtube.com/embed/PkxteedBq9g?rel=0" frameborder="0" allowfullscreen></iframe>

and index.php will echo content ( )

I want that the permanent link of this post ( single.php ) displays:

<iframe width="700" height="505" src="http://www.youtube.com/embed/PkxteedBq9g?rel=0" frameborder="0" allowfullscreen></iframe>

.. it's the same video but with different width and height.

What will be the best and easy way?

( should i use and try to work the excerpt and content someway? )

That also leaves to another question: how to show some content in the index.php and different content in the single.php page ?

Many thanks, Pedro

1 Answer 1

0

Your best bet is to use custom fields for the YouTube video URL and then use get_post_meta(); to pull out the URL, then in your template files (index.php, single.php) set up the embed code on each template.

1
  • Alex, great tip! Worked as a charm using: <?php $key="full-video"; echo get_post_meta($post->ID, $key, true); ?> where i could define custom field full-video Many thanks,Pedro
    – Pedro P
    Commented Feb 29, 2012 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.