WordPress.org

Ready to get started?Download WordPress

Plugin Directory

JP's Get RSS Feed

Get last X number of posts from a selected RSS feed. Default is last 5 items. Includes shortcode for listing feed items on posts or pages.

How do I use the plugin?

You can use the plugin in two ways:

  1. In your PHP code (functions.php, or a plugin), you would call the plugin function like this:
if (function_exists('jp_get_rss_feed_items')) {
  jp_get_rss_feed_items(array(
    'url' => "http://somefeed.com/rss", 
    'numitems' => 5,
    'nofollow' => true,
    'cssclass' => 'myclass',
    'getdesc' => false,
    'opennewwindow' => false,
    'show' => true    
  ));
}

This will:

  • fetch the feed located at http://somefeed.com/rss
  • list the last 5 items
  • add rel="nofollow" to each link
  • add the "myclass" CSS class to the div tag that wraps the output (instead of default "jpgetrssfeed")
  • hide the item description
  • open links in the same window
  • echo the content to the screen
  • Hyperlink the post title

This will override any settings you configured on the plugin's Settings page. Always wrap plugin function calls in a function_exists check so that your site doesn't go down if the plugin is inactive.

  1. As a shortcode, you call the plugin like this:
[jp-rss-feed numitems="3"]

This will take the settings from the Settings page (or the defaults if a setting is missing) and apply them to the shortcode, except there will only be three items even if you specified 5 on the Settings page. In this way you can override settings by passing them to the shortcode at runtime.

What are the plugin defaults?

The plugin arguments and default values may change over time. To get the latest list of arguments and defaults, look at the settings page after installing the plugin.

I want to use the plugin in a widget. How?

Add this line of code to your functions.php:

add_filter('widget_text', 'do_shortcode');

Or, install a plugin to do it for you: http://blogs.wcnickerson.ca/wordpress/plugins/widgetshortcodes/

Now, add the built-in text widget that comes with WordPress, and insert the JP's Get RSS Feed shortcode into the text widget. See above for how to use the shortcode.

See http://digwp.com/2010/03/shortcodes-in-widgets/ for a detailed example.

Keep in mind, if you want to show your blog feed in a sidebar widget, WordPress already has a built-in "Recent Posts" widget for that.

I don't want the post editor toolbar button. How do I remove it?

Add this to your functions.php:

remove_action('admin_enqueue_scripts', 'jpgrf_ed_buttons');

I inserted the shortcode but don't see anything on the page.

Clear your browser cache and also clear your cache plugin (if any). If you still don't see anything, check your webpage source for the following:

<!-- JP's Get RSS Feed: plugin is disabled. Check Settings page. -->

This means you didn't pass a necessary setting to the plugin, so it disabled itself. You need to pass at least the URL, either by entering it on the settings page or passing it to the plugin in the shortcode or PHP function. You should also check that the "enabled" checkbox on the plugin settings page is checked. If that box is not checked, the plugin will do nothing even if you pass it a URL.

I requested 10 feed items but I only see 5. How do I increase the limit?

If the RSS feed only includes 10 items at a time, you will only ever be able to request 10 items at most. (Hint: Load the feed in your browser to confirm) Even if you request 100 items, you will only get at most 10. You should contact whomever controls the feed and ask them to increase the number of items in their feed.

For WordPress blogs, go to Settings » Reading and change the value of "Syndication feeds show the most recent ___ items" to change the number of feed items available.

Genesis Theme Framework users

If you are using the Genesis framework from Studiopress, you might use the plugin like this:

add_action('genesis_after_post_content', 'showrss');
function showrss() {
  if (is_page('faq')) { // we are on the FAQ page...
    if (function_exists('jp_get_rss_feed_items')) { // and the function exists...
      echo '<h3>Latest Articles From my Favorite RSS Feed</h3>';
      jp_get_rss_feed_items(array('url' => "http://feeds.feedburner.com/MyFavoriteRSSFeed", 'show' => true));
      // or: echo jp_get_rss_feed_items(array('url' => "http://feeds.feedburner.com/MyFavoriteRSSFeed"));
    }
  }
}

This code would go in your functions.php file, or (ideally) in a plugin. Check the Hook Reference to determine where you want to place the output. The above example (remember, for Genesis framework only) would show the last five articles from a given RSS feed at the bottom of the 'FAQ' page.

How can I list from multiple feeds?

Use an array and a foreach loop:

if (function_exists('jp_get_rss_feed_items')) {
  // create array
  $feedslist = array(
  "My feed URL number one",
  "My feed URL number two",
  "My feed URL number three"
  );
  // loop through array and call plugin
  foreach ($feedslist as $item) {
   jp_get_rss_feed_items(array('url' => $item, 'show' => true));
  }
}

This will list the last five items from each feed in its own unordered list.

But suppose you want a different CSS class for each one. Use a for loop instead.

if (function_exists('jp_get_rss_feed_items')) {
  // create array
  $feedslist = array(
  "My feed URL number one",
  "My feed URL number two",
  "My feed URL number three"
  );
  // loop through array and call plugin
  for ($i = 0, $size = count($feedslist); $i < $size; $i++) {
   jp_get_rss_feed_items(array('url' => $feedslist[$i], 'cssclass' => 'jpgetrssfeed_' . $i , 'show' => true));
  }
}

So your CSS classes would be

  • jpgetrssfeed_1
  • jpgetrssfeed_2
  • jpgetrssfeed_3

How can I list items from a random feed?

Use array_rand:

if (function_exists('jp_get_rss_feed_items')) {
  // create array
  $feedslist = array(
  "My feed URL number one",
  "My feed URL number two",
  "My feed URL number three"
  );
  // get random index from array
  $item = array_rand($feedslist, 1);
  // pass randomly selected array member to plugin
  jp_get_rss_feed_items(array('url' => $feedslist[$item], 'show' => true));
}

This selects one URL randomly and passes it to the plugin.

How can I style the output?

Feed items are wrapped in a div tag, with class "jpgetrssfeed" (or whatever you change it to) so you can style the output in your CSS file. The items list is surrounded by <ul></ul> tags, with each feed item listed in a <li></li> tag.

So you could add something like this in your style.css:

.jpgetrssfeed {border:1px solid gray;margin:10px 0}
.jpgetrssfeed ul li {list-style-type:circle}

You can also specify your own class, or use a different class name for each shortcode to style it differently. Ex:

In my style.css file I add the following

.rssorange {border:1px solid #FF9900;margin:10px 0} .rssblue {border:1px solid blue;margin:10px 0} .rssred {border:1px solid red;margin:10px 0}

I specify each class in my shortcodes as follows:

[jp-rss-feed url="http://somefeed.com/rss" cssclass="rssorange"] [jp-rss-feed url="http://some_other_feed.com/rss" cssclass="rssblue"] [jp-rss-feed url="http://some_new_feed.com/rss" cssclass="rssred"]

Each feed will be surrounded by a different color border.

How do I add a header or title above the feed items list?

See the examples above. Before you call the shortcode or the PHP function, echo your header like this:

echo '<h3>Latest Articles From my Favorite RSS Feed</h3>';

Then call the PHP function or shortcode.

I don't want the admin CSS. How do I remove it?

Add this to your functions.php:

remove_action('admin_head', 'insert_jpgrf_admin_css');

I don't see the plugin toolbar button(s).

This plugin adds one or more toolbar buttons to the HTML editor. You will not see them on the Visual editor.

The label on the toolbar button is "RSS Feed".

I don't want to see such a long description.

Enter a lower character limit on the plugin's options page.

The plugin is breaking the RSS feed or my site.

Check the number of characters in the feed item description textbox. Try increasing it.

Remember that the character limit cuts off the item description. If the item description contains HTML and you cut it off in the middle, you are leaving unclosed HTML tags which can affect the rest of the page.

I want to display items in reverse order.

See the plugin settings page. There is a dropdown box for you to indicate the sort order. The default is newest first, change the dropdown box to 'oldesfirst' and the items will be sorted in reverse date order.

I am using the shortcode but the parameters aren't working.

On the plugin settings page, go to the "Parameters" tab. There is a list of possible parameters there along with the default values. Make sure you are spelling the parameters correctly.

The Parameters tab also contains sample shortcode and PHP code.

Requires: 3.5 or higher
Compatible up to: 3.9.2
Last Updated: 2014-8-16
Downloads: 27,829

Ratings

4 stars
4.7 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

0,1,0
0,2,0
0,1,0
100,1,1
100,1,1 0,1,0 100,1,1 100,1,1 100,1,1
100,1,1
0,1,0
100,1,1