How to Embed RSS Feed Entries in WordPress Posts

How to Embed RSS Feed Entries in WordPress Posts

If you want to list some of the latest posts from another site within one of your WordPress posts or pages, here’s a handy way to do it using a shortcode.

First, add this to your functions.php file:

//This file is needed to be able to use the wp_rss() function.
include_once(ABSPATH.WPINC.'/rss.php');

function readRss($atts) {
extract(shortcode_atts(array(
"feed" => 'http://',
"num" => '1',
), $atts));

return wp_rss($feed, $num);
}

add_shortcode('rss', 'readRss');

After adding that you can now use a shortcode to embed RSS:

[rss feed="https://wpmudev.com/blog/feed" num="5"]

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

It will look a little something like this:

Source: CatsWhoCode.com

Tags: