[insert_php] _e( ‘Recent news from Some-Other Blog:’, ‘my-text-domain’ ); [/insert_php]

[insert_php] // Get RSS Feed(s)
include_once( ABSPATH . WPINC . ‘/feed.php’ );

// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( ‘http://www.wpbeginner.com/feed/’ );

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( 5 );

// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items( 0, $maxitems );

endif;
[/insert_php]

    [insert_php] if ( $maxitems == 0 ) : [/insert_php]

  • [insert_php] else : [/insert_php]
    [insert_php] // Loop through each feed item and display each item as a hyperlink. [/insert_php]
    [insert_php]php foreach ( $rss_items as $item ) : [/insert_php]