Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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 Feb 29 '12 at 14:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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