Files
super-simple-rssreader/README.md
T

3.7 KiB

Super Simple RSS Reader

A minimal WordPress plugin that reads an RSS feed and displays it as a simple link list. Set the feed URL in WP Admin and drop the shortcode [super_simple_rssreader] anywhere you want the list to appear.

This plugin is a WordPress port of the standalone rss-feed.php template. The rendered output is intentionally kept the same.

Features

  • Admin settings page under Settings → RSS Reader.
  • [super_simple_rssreader] shortcode for posts, pages, widgets or theme templates.
  • No feed is pre-configured: you choose your own feed URL.
  • Same markup as the original file: div.rss-feed with an optional h3.rss-title heading and a <ul> of items.
  • Google News style titles are cleaned up: the trailing " - Source" is removed from the title because the source is already shown separately.
  • Responses are cached with a transient (15 minutes by default) so the feed is not fetched on every page load.
  • Output is escaped and feed URLs are validated before use.

Installation

  1. Copy the super-simple-rssreader folder (containing super-simple-rssreader.php) into wp-content/plugins/.
  2. Activate Super Simple RSS Reader under Plugins in WP Admin.

Configuration

Go to Settings → RSS Reader and set:

Field Required Description
Feed URL Yes Full URL of the RSS feed to read. The plugin shows nothing until set.
Heading No Optional heading shown above the list. Leave empty for no heading.
Max items No Maximum number of items to show. Use 0 to show all items.

No feed URL or heading is pre-filled, so the plugin outputs nothing until you enter a feed URL of your own. Only the feed URL is required; the other fields are optional.

Shortcode

Place the shortcode where you want the feed:

[super_simple_rssreader]

Shortcode attributes

Attributes override the saved settings for that single usage:

Attribute Default Description
url Saved feed URL Feed URL to read.
title Saved heading Heading text. Empty string hides the heading.
limit Saved max items Max number of items (0 = all).

Example:

[super_simple_rssreader url="https://example.com/feed" title="Latest news" limit="5"]

You can also call it directly from a theme template:

echo do_shortcode( '[super_simple_rssreader limit="10"]' );

Output markup

<div class="rss-feed">
  <h3 class="rss-title">Heading</h3>
  <ul>
    <li><a href="https://example.com/article" target="_blank" rel="noopener noreferrer">Article title</a> <span> | Source name</span></li>
  </ul>
</div>

If the feed cannot be loaded, or it contains no items, the shortcode outputs nothing.

Caching

Fetched items are cached in a transient for 15 minutes. The cache is cleared automatically when the settings are saved.

The cache lifetime can be changed with a filter (value in seconds):

add_filter( 'ssrss_cache_ttl', function () {
	return 5 * MINUTE_IN_SECONDS;
} );

Notes

  • Only standard RSS feeds (<channel><item>) are supported, matching the original script.
  • The feed is fetched with the WordPress HTTP API (wp_remote_get) instead of simplexml_load_file, so it respects the site's HTTP configuration and does not depend on allow_url_fopen.
  • Feed URLs must start with http:// or https://.

Requirements

  • WordPress 5.0 or later
  • PHP 7.0 or later

License

GPL-2.0-or-later