-
Upload the plugin files to the ‘/wp-content/plugins/plugin-name’ directory, or install the plugin through the WordPress plugins screen directly.
-
Activate the plugin through the ‘Plugins’ screen in WordPress.
-
Access the ‘Admin Panel >
RSS Shortcodes’ to create any shortcode you might need. We suggest Sort by Author, Sort by Category, Sort by Year.
You can insert the following code into a PHP plugin or in a template, for example
sidebar.php
or
single.php
:
Example:
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=”https://yourdomain.com/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 is
5
.
-
feedurl
– The feed address. Default is
https://yourdomain.com/feed/
.
-
before_desc
– The HTML or string to insert before the description. Default is
empty
. 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 is
false
.
-
after_desc
– The HTML or string to insert after the description. Default is
empty
. You can use some variables which will be replaced, see below.
-
html
– (bool) When set to true, the description can include HTML tags. Default is
false
.
-
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.
-
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
.
-
date
– (bool) If true, display the date of the item. Default is
false
.
-
after_date
– The HTML or string to insert after the date. Default is
.
-
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
.
-
creator
– (bool) If true, display the creator of the item. Default is
false
.
-
after_creator
– The HTML or string to insert after creator of the item. Default is
.
-
start_items
– The HTML or string to insert before the list of items. Default is
.
-
end_items
– The HTML or string to insert after the list of items. Default is
.
-
start_item
– The HTML or string to insert before each item. Default is
-
. You can use some variables which will be replaced, see below.
-
end_item
– The HTML or string to insert after each item. Default is
. You can use some variables which will be replaced, see below.
-
target
– The string to use for the
target
attribute on links. Default is
empty
. Valid options are
blank
,
self
,
parent
,
top
.
-
rel
– The string to use for the
rel
attribute on links. Default is
empty
. Valid options are
nofollow
and
follow
.
-
desc4title
– The description to use in the
title
attribute on item title links. Default is
false
.
-
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
.
-
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.
-
before_noitems
– The HTML or string to insert before the no items message. Default is
.
-
noitems
– The message to display when the feed is empty. Default is
No items, feed is empty.
.
-
after_noitems
– The HTML or string to insert before the no items message. Default is
.
-
before_error
– The HTML or string to insert before the error message. Default is
.
-
error
– Error message displayed when there is an error loading or displaying the feed. Default is
Error: Feed has an error or is not valid
.
-
after_error
– The HTML or string to insert before the error message. Default is
.
-
paging
– (bool) If true, enable pagination. Default is
false
.
-
prev_paging_link
– The name of the previous page link. Default is
« Previous
.
-
next_paging_link
– The name next page link. Default is
Next »
.
-
prev_paging_title
– The title attribute of the previous page link. Default is
more items
.
-
next_paging_title
– The title attribute of the next page link. Default is
more 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 is
false
if used with Shortcode,
true
if used with the PHP function.
-
view
– (bool) If true, calling the
rssfp_import()
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
.
-
random_sort
– (bool) If true, Items will be displayed in random order. Default when using Shortcode is
false
.
-
order
– (string) Order of the filds Date, Title, Creator, Description. Use a comma separated string for your order. Default is
date,title,creator,description
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
rssfp_import
in your templates or with the Shortcode
[RSSImport]
in posts and pages.
Examples
Using the PHP function with many parameters:
rssfp_import( $display = 5, $feedurl = 'https://bueltge.de/feed/', $before_desc = '', $displaydescriptions = false, $after_desc = '', $html = false, $truncatedescchar = 200, $truncatedescstring = ' ... ', $truncatetitlechar = '', $truncatetitlestring = ' ... ', $before_date = '
', $date = false, $after_date = '
', $before_creator = '
', $creator = false, $after_creator = '
', $start_items = '
', $start_item = '
', $end_item = '
'
);
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="https://your_feed_url/"
displaydescriptions="true" html="true"
start_items="
" end_items="
" paging="true" use_simplepie="true"]
Add a “more” link to the output:
rssfp_import( $display = 5, $feedurl = 'https://yourdomain.com/feed/', $before_desc = '', $displaydescriptions = true, $after_desc = '
show more
'
);
or
[RSSImport feedurl="https://wordpress.org/news/feed/" after_desc="
show more
" displaydescriptions="true" use_simplepie="true"]
Enable Thumbnail Pictures:
rssfp_import( $display = 5, $feedurl = 'https://bueltge.de/feed/', $before_desc = '
', $displaydescriptions = true
);
or
[RSSImport feedurl="https://wordpress.org/news/feed/" displaydescriptions="true" before_desc="

" after_desc="
" use_simplepie="true"]
|