Embedding RSS Feed In Your WordPress Posts And Pages

Open Your themes function.php and add the following code at the bottom:

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’);

Save function.php and whenever you need to embed RSS in any of your post or page write the following short code inside your post:

[ rss feed=”https://sangkrit.net/feed” num=”5″ ]

In the above give short code replace https://sangkrit.net/feed with your feed address and in num=5 replace 5 with the number of posts you like to show.

Note: Remember there is no space between [ and rss feed and num=”5″  and  so after you copy the short code; check the space, remove it (if there is some space) and then publish it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.