Plugin / RSSImport
Description
Description
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.
As with all other content you publish, make sure you are allowed to (re-)publish the content of the feeds you are about to import!
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/” use_simplepie=”true”]
For all (bool) parameters you can either use the strings true and false or the integer values 1 and 0.
display– The number of items to display. Default is5.feedurl– The feed address. Default ishttp://bueltge.de/feed/.before_desc– The HTML or string to insert before the description. Default isempty. You can use some variables which will be replaced, see below.displaydescriptions– (bool) When set to true, the description for each entry will be displayed. Default isfalse.after_desc– The HTML or string to insert after the description. Default isempty. You can use some variables which will be replaced, see below.html– (bool) When set to true, the description can include HTML tags. Default isfalse.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 is200, set the value to empty quotes''to never truncate descriptions.truncatedescstring– The HTML or string to insert at the end of a description after it has been truncated. Default is...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.truncatetitlestring– The HTML or string to insert at the end of a title after it has been truncated. Default is' ... '.before_date– The HTML or string to insert before the date. Default is<small>.date– (bool) If true, display the date of the item. Default isfalse.after_date– The HTML or string to insert after the date. Default is</small>.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.before_creator– The HTML or string to insert before the creator of the item. Default is<small>.creator– (bool) If true, display the creator of the item. Default isfalse.after_creator– The HTML or string to insert after creator of the item. Default is</small>.start_items– The HTML or string to insert before the list of items. Default is<ul>.end_items– The HTML or string to insert after the list of items. Default is</ul>.start_item– The HTML or string to insert before each item. Default is<li>. You can use some variables which will be replaced, see below.end_item– The HTML or string to insert after each item. Default is</li>. You can use some variables which will be replaced, see below.target– The string to use for thetargetattribute on links. Default isempty. Valid options areblank,self,parent,top.rel– The string to use for therelattribute on links. Default isempty. Valid options arenofollowandfollow.desc4title– The description to use in thetitleattribute on item title links. Default isfalse.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 isfalse.debug– (bool) If true, activate debug-mode, which will echo the Magpie object as an array. Default isfalse. Only use this option for debugging.before_noitems– The HTML or string to insert before the no items message. Default is<p>.noitems– The message to display when the feed is empty. Default isNo items, feed is empty..after_noitems– The HTML or string to insert before the no items message. Default is</p>.before_error– The HTML or string to insert before the error message. Default is<p>.error– Error message displayed when there is an error loading or displaying the feed. Default isError: Feed has an error or is not valid.after_error– The HTML or string to insert before the error message. Default is</p>.paging– (bool) If true, enable pagination. Default isfalse.prev_paging_link– The name of the previous page link. Default is« Previous.next_paging_link– The name next page link. Default isNext ».prev_paging_title– The title attribute of the previous page link. Default ismore items.next_paging_title– The title attribute of the next page link. Default ismore items.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 isfalseif used with Shortcode,trueif used with the PHP function.view– (bool) If true, calling theRSSImport()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 istrue. Default when using Shortcode isfalse.random_sort– (bool) If true, Items will be displayed in random order. Default when using Shortcode isfalse.
The parameters before_desc, after_desc, start_item and end_item accepts the following variables which will be replaced:
%title%for the title of the entry%href%for the entry’s URL%picture_url%for the URL of a thumbnail image for the entry if available. To use this variable, SimplePie is required to be enabled (use_simplepie="true")
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 for the PHP function 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" use_simplepie="true"]
Add a “more” link to the output:
RSSImport(
$display = 5,
$feedurl = 'http://bueltge.de/feed/',
$before_desc = '',
$displaydescriptions = true,
$after_desc = ' <a href="%href%" target="_blank">show more</a>'
);
or
[RSSImport feedurl="http://www.ichdruck3d.de/feed/" after_desc=" <a href='%href%' target='_blank'>show more</a>" displaydescriptions="true" use_simplepie="true"]
Enable Thumbnail Pictures:
RSSImport(
$display = 5,
$feedurl = 'http://www.thestage.co.uk/opinion/shenton/feed/',
$before_desc = '<img src="%picture_url%" alt="">',
$displaydescriptions = true
);
or
[RSSImport feedurl="http://www.thestage.co.uk/opinion/shenton/feed/" displaydescriptions="true" before_desc="<div><img src='%picture_url%' width='50px' alt='' style='float:left;' />" after_desc="</div>" use_simplepie="true"]
Acknowledgements
Thanks to Dave Wolf for the idea, to Thomas Fischer and Gunnar Tillmann for better code and Ilya Shindyapin, http://skookum.com for the idea and solution of pagination.
Localizations
- German language files by me Frank Bültge 😉
- Russian translation by Fat Cow
- Ukrainian translation by WordPress Ukraine
- French translation by Martin Korolczuk
- Hungarian translation by Feriman
- Hindi translation by Ashish Jha
- Italian translation by Gianni Diurno
- Romanian language files, thanks to Alexander Ovsov
- Lithuanian translation files by Vincent G
- Portuguese translation files by Miguel Patricio Angelo
License
Good news, this plugin is free for everyone! Since it’s released under the GPL, you can use it free of charge on your personal or commercial blog. But if you enjoy this plugin, you can thank me by leaving a small donation for the time I’ve spent writing and supporting this plugin. And I really don’t want to know how many hours of my life this plugin has already eaten 😉
Translations
The plugin comes with various translations, please refer to the WordPress Codex for more information about activating the translation. If you want to help to translate the plugin to your language, please have a look at the sitemap.pot file which contains all defintions and may be used with a gettext editor like Poedit (Windows).
Ratings
Rating breakdown
DIRECTORY DISCLAIMER
The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.
The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.
Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.
While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.
wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.