<?php // Get RSS Feed(s)
include_once( ABSPATH . WPINC . '/feed.php' );
// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( 'https://www.youtube.com/channel/UCZEUuBtKIvoZPSQMgtKUw5A' );
// $rss = fetch_feed( 'http://www.forbes.com/taxes-law/feed2/', 'http://www.wsj.com/xml/rss/3_7031.xml' );
/*
$rsslist = array( 'http://www.forbes.com/taxes-law/feed2/',
'http://www.wsj.com/xml/rss/3_7031.xml',
'http://www.taxlawroundup.com/?feed=rss'
);
$rss = fetch_feed($rsslist);
*/
$maxitems = 0;
if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly
// Figure out how many total items there are, but limit it to 5.
$maxitems = $rss->get_item_quantity( 7 );
// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items( 0, $maxitems );
endif;
?>
<?php if ( $maxitems == 0 ) : ?>
<ul>
<li><?php _e( 'No items', 'my-text-domain' ); ?></li>
</ul>
<?php else : ?>
// Loop through each feed item and display each item as a hyperlink.
<?php foreach ( $rss_items as $item ) :
echo '<div class="rss-feed-container">';
if ($enclosure = $item->get_enclosure())
{
echo '<img class="feed-thumb" style="float: left; width: 200px; margin-right: 10px;" src="' . $enclosure->get_thumbnail() . '" />';
}
?>
<a title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>" href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank" rel="noopener">
<?php echo esc_html( $item->get_title() ); ?></a> - <?php echo esc_html( $item->get_date('F j, Y') ); ?>
<p><?php echo substr($item->get_description(), 0, 150); ?> <a title="<?php echo esc_html( $item->get_title() ); ?>" href="<?php echo esc_url( $item->get_permalink() ); ?>">Continue Reading</a></p>
<?php echo '</div>'; ?>
<?php endforeach; ?>
<?php endif; ?>