Hi,
I'm working on a WP theme, which was working last I check and has since stopped. Maybe it's something little but it's driving me nuts right now.
I'm taking a youtube username and grabbing the latest video and embedding into the page. Seems to be pretty simple, but I may be attacking it wrong.
Here is my code(any suggestions?):
<?php // Get YOUTUBE FEED
include_once(ABSPATH . WPINC . '/feed.php');
// Get a SimplePie feed object from the specified feed source. - YOUTUBE FEED ADDRESS
$youtube = fetch_feed('http://gdata.youtube.com/feeds/api/users/USERNAME/uploads');
if (!is_wp_error( $youtube ) ) { // Checks that the object is created correctly
// Figure out how many total items there are, but limit it to 1.
$maxitemsy = $youtube->get_item_quantity(1);
// Build an array of all the items, starting with element 0 (first element).
$rss_itemsy = $youtube->get_items(0, $maxitemsy);
}
?>
<h3>YouTube</h3>
<ul>
<?php if ($maxitemsy == 0) echo '<li>No Video? Check out our <a href="http://www.youtube.com/USERNAME" >YouTube Channel</a></li>';
else
// Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_itemsy as $item ) {
$link = $item->get_item_tags('http://search.yahoo.com/mrss/', 'player');
$useThis = $link[0]['attribs']['']['url'];
?>
<li>
<object style="height: 172.5px; width: 230px">
<param name="movie" value="http://www.youtube.com/v/<?php echo getYTid($useThis);?>">
<param name="allowFullScreen" value="true">
<param name="allowScriptAccess" value="always">
<embed src="http://www.youtube.com/v/<?php echo getYTid($useThis);?>" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="230" height="172.5">
</object>
</li>
<li>
<?php echo $item->get_content();?>
</li>
<?php } ?>
</ul>
Anyways, I keep getting the "No video, check out our..." output instead of the youtube embed (which was showing up before).
Help!