0

I want to display all recently uploaded youtube videos from my youtube account as a widget on the right side of the page. Just like how technobuffalo.com has done. Is there such a plugin that will do this?

ps: as for what I've tried, i have searched on wordpresses plugin pages and all i see are plugins that allow me to add a short code for the video as a post. But this isnt what i want. I just want to display all recently uploaded videos automatically on the right side just like technobuffalo.

1

You can use YouTube developer API. Example how to get recent videos below:

$data = wp_remote_get('http://gdata.youtube.com/feeds/api/users/<USERNAME>/uploads/?start-index=1&max-results=40');
$response =  new SimpleXMLElement($data['body']);

foreach ($response->entry as $entry):
    $vid_id = '';
    if ( preg_match('#videos/([^/]+)$#', $entry->id, $matches) ) {
        $vid_id = $matches[1];
    }
    if ( $vid_id ):
    ?>
        <a href="http://youtube.com/watch?v=<?php echo $vid_id; ?>">
            <img src="http://i.ytimg.com/vi/<?php echo $vid_id; ?>/1.jpg" width="220" height="130" />
            <span class="video-title"><?php echo esc_html($entry->title); ?></span>
            <span class="video-description"><?php echo esc_html($entry->content); ?></span>
        </a>
<?php
    endif;
endforeach;
  • thanks, i ended up finding a plugin named youtube channel that did what i wanted. – Sarmen B. Jun 23 '13 at 5:01
0

Forget about WordPress for the time being & concentrate on figuring out the core mechanics of what you want to achieve, to display a user's recent uploads on your website:

  1. Check out the YouTube developer API
  2. Search on stackoverflow.com
  3. Use Google

Then check out one of the many WordPress widget tutorials to get to grips with things, then wrap it around your newfound YouTube knowledge!

If you get stuck, by all means come back to us (with the code you're having trouble with) and we'll set you right!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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