WordPress.org

Ready to get started?Download WordPress

Plugin Directory

RSSImport

Import and display feeds on your blog, using PHP in your templates or Shortcode in your posts and pages.

Import and display feeds in your blog, using PHP, a Widget or Shortcode. The plugin uses only standard WordPress functionality, so no external libraries are required. For older versions of WordPress, the built-in MagpieRSS library is used. For WordPress 2.8 and newer, there is a setting available to enable the built-in SimplePie library for parsing feeds.

You can insert the following code into a PHP plugin or in a template, for example sidebar.php or single.php:

Example:

<?php RSSImport(10, 'http://bueltge.de/feed/'); ?>

This is the minimal code needed for using the plugin. The plugin accepts a number of parameters for customizing the feed content import. See below for the full list of available parameters. You can also use any of the parameters with Shortcode in posts and pages.

Example Shortcode:

[RSSImport display="5" feedurl="http://bueltge.de/feed/"]

For all (bool) parameters you can either use the strings true and false or the integer values 1 and 0.

  1. display - The number of items to display. Default is 5.
  2. feedurl - The feed address. Default is http://bueltge.de/feed/.
  3. before_desc - The HTML or string to insert before the description. Default is empty.
  4. displaydescriptions - (bool) When set to true, the description for each entry will be displayed. Default is false.
  5. after_desc - The HTML or string to insert after the description. Default is empty. You can use the following variables which will be replaced: %title% for the title of the entry and %href% for the entry's URL.
  6. html - (bool) When set to true, the description can include HTML tags. Default is false.
  7. truncatedescchar - The maximum number of characters allowed in descriptions. If the description is longer than this length, it will be truncated to the given length. Default is 200, set the value to empty quotes '' to never truncate descriptions.
  8. truncatedescstring - The HTML or string to insert at the end of a description after it has been truncated. Default is ...
  9. truncatetitlechar - The maximum number of characters allowed in titles. If the title is longer than this value, it will be truncated to the given length. Default is '', which means never truncate titles.
  10. truncatetitlestring - The HTML or string to insert at the end of a title after it has been truncated. Default is ' ... '.
  11. before_date - The HTML or string to insert before the date. Default is <small>.
  12. date - (bool) If true, display the date of the item. Default is false.
  13. after_date - The HTML or string to insert after the date. Default is </small>.
  14. date_format- The date format string. Leave empty to use the format of your WordPress installation. If a different date format is desired, specify a PHP date string, for example: F j, Y. See also the date and time formatting page in the WordPress Codex.
  15. before_creator - The HTML or string to insert before the creator of the item. Default is <small>.
  16. creator - (bool) If true, display the creator of the item. Default is false.
  17. after_creator - The HTML or string to insert after creator of the item. Default is </small>.
  18. start_items - The HTML or string to insert before the list of items. Default is <ul>.
  19. end_items - The HTML or string to insert after the list of items. Default is </ul>.
  20. start_item - The HTML or string to insert before each item. Default is <li>.
  21. end_item - The HTML or string to insert after each item. Default is </li>.
  22. target - The string to use for the target attribute on links. Default is empty. Valid options are blank, self, parent, top.
  23. rel - The string to use for the rel attribute on links. Default is empty. Valid options are nofollow and follow.
  24. desc4title - The description to use in the title attribute on item title links. Default is false.
  25. charsetscan - (bool) If true, scan the feed content for the correct character set. This may cause the content to load more slowly. Use this option if you're having problems with feed content being displayed with stranged characters. Default is false.
  26. debug - (bool) If true, activate debug-mode, which will echo the Magpie object as an array. Default is false. Only use this option for debugging.
  27. before_noitems - The HTML or string to insert before the no items message. Default is <p>.
  28. noitems- The message to display when the feed is empty. Default is No items, feed is empty..
  29. after_noitems - The HTML or string to insert before the no items message. Default is </p>.
  30. before_error - The HTML or string to insert before the error message. Default is <p>.
  31. error - Error message displayed when there is an error loading or displaying the feed. Default is Error: Feed has a error or is not valid.
  32. after_error - The HTML or string to insert before the error message. Default is </p>.
  33. paging - (bool) If true, enable pagination. Default is false.
  34. prev_paging_link - The name of the previous page link. Default is &laquo; Previous.
  35. next_paging_link - The name next page link. Default is Next &raquo;.
  36. prev_paging_title - The title attribute of the previous page link. Default is more items.
  37. next_paging_title - The title attribute of the next page link. Default is more items.
  38. use_simplepie- (bool) If true, use SimplePie to parse the feed. SimplePie is included in WordPress 2.8 and newer and can parse both RSS and ATOM feeds. Default is false.
  39. view - (bool) If true, calling the RSSImport() function will print the rendered HTML directly to the output. If false, the rendered HTML will be returned by the function as a string value and nothing will be output. Default when using PHP code is true. Default when using Shortcode is false.

If pagination is enabled, it adds a div with the class rsspaging to enable easier styling with CSS. You can also style the previous and next links, which have the classes: rsspaging_prev and rsspaging_next.

You can use any of the parameters in the php function RSSImport() in your templates or with the Shortcode [RSSImport] in posts and pages.

Examples:

Using the PHP function with many parameters:

RSSImport(
    $display = 5, $feedurl = 'http://bueltge.de/feed/', 
    $before_desc = '', $displaydescriptions = false, $after_desc = '', $html = false, $truncatedescchar = 200, $truncatedescstring = ' ... ', 
    $truncatetitlechar = '', $truncatetitlestring = ' ... ', 
    $before_date = ' <small>', $date = false, $after_date = '</small>', 
    $before_creator = ' <small>', $creator = false, $after_creator = '</small>', 
    $start_items = '<ul>', $end_items = '</ul>', 
    $start_item = '<li>', $end_item = '</li>' 
)

Please note that the parameters are expected in the order in which they are defined in the above list. Thus if you skip one parameter, you will also have to skip all of the subsequent parameters.

Using Shortcode with several parameters:

[RSSImport display="10" feedurl="http://your_feed_url/" 
displaydescriptions="true" html="true" 
start_items="<ol>" end_items="</ol>" paging="true"]
Tags: , , ,

Requires: 1.5 or higher
Compatible up to: 3.9.2
Last Updated: 2014-8-19
Downloads: 147,106

Ratings

4 stars
4.6 out of 5 stars

Support

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

Got something to say? Need help?

Compatibility

+
=
Not enough data

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

100,1,1 100,1,1
100,1,1
100,1,1 100,1,1 100,1,1
100,1,1
100,8,8
100,5,5
100,3,3 100,1,1
100,2,2 100,3,3
67,3,2
100,1,1
100,1,1
100,1,1
67,3,2
100,1,1
100,3,3 100,1,1
100,4,4
100,7,7 100,2,2
75,4,3
100,1,1
100,2,2
100,3,3
33,3,1
100,3,3
100,1,1
100,1,1
100,1,1
100,1,1
0,1,0
67,3,2 100,1,1
100,2,2