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.

I'm using a feed to receive special YouTube feeds organized via playlists. Unfortunately, the URL is not included in the description field, but I can get the videos to display by including the source URL on post.

This works fine except since the URL is not in the post area in the editor, the YouTube thumbnail grabbers I have tried don't retrieve these thumbnails.

Does anyone know a way I can fetch the featured image through the published version of the post? It needs to be automated because I have way to many post items to adjust them manually.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Each YouTube video has 4 generated images. They are predictably formatted as follows

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg

The first one in the list is a full size image and others are thumbnail images.

so if you have the video url the you can extract the video id from it call your image, and to do that on posts that are already posted you can use the_content filter hook.

share|improve this answer
    
Are you suggesting to add this to the loop? I understand the concept, but not how you're insinuated I implement it. –  Kayle May 6 '11 at 21:19
    
no, not the loop, using add_filter('the_content',you_function'); and in your_function you do what you want so you dont have to change your theme or posts/pages –  Bainternet May 6 '11 at 22:46
    
can I use this method to inject a "featured" image rather than just calling an image? Youtube videos aren't the only thing that gets posted on the site. –  Kayle May 9 '11 at 19:27
    
Yes, Lookup wordpres image sideload or post a new question. –  Bainternet May 9 '11 at 20:38
    
thanks for the answer! –  Kayle May 10 '11 at 23:30

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.