SimpleRSSEmbed – my first WordPress plugin

Ok, I’ve been doing all sorts of things with WordPress for a while now, but oddly enough, I never actually wrote a plugin (although, in retrospect, I did a lot of template hacks that probably would have been easier to do as plugins). Anyway, I needed a plugin for a blog I was working on that would allow me to display the summary of N number of blog posts from another blog. There seem to be plenty of existing plugins that do this, however most of them are either horrible code (both HTML and PHP), or they don’t work with Atom feeds that don’t have descriptions. I wanted something very simple, with very clean output that would ‘just work’™. So, after trying about a dozen of them, I decided to just write my own (which turned out to be insanely easy). If I would have started down that path at first, I probably would have been done sooner.

So, if anyone is interested in this very simple plugin, here it is. Of course, it’s GPL. I expect I’ll be adding more features to it as I need, but for now this does exactly what I want with very little code to maintain.

Documentation

Download

You can get the current version from here: simplerssembed.zip

Installation

Put the contents of simpleressembed.zip into your wp-contents/plugins directory, and unzip it. This should give you a directory called ‘simpleressembed’ which has 3 things in it:

  • an empty directory called ‘cache’
  • a file called readme.txt
  • a file called simplerssembed.php

Make sure that the cache directory is writeable by your web server, or whatever user that will be executing the php scripts. The safest way (on *nix system) is to do the following (assuming that the process runs as the user ‘apache’:

[root@ simplerssembed]# chown apache: cache [root@ simplerssembed]# chmod 755 cache

Then go to the plugins tool in your WP dashboard, and activate the plugin.

Using the plugin

Once the plugin is activated, you can embed RSS feeds with the following shortcode:

[simplerssembed rssfeed='http://wordpress.org/news/feed/' rssitems='5' rsscssclass="rssfeeditem" rssdateformat="j F Y" rsslinktarget="_new"]

Parameters

The currently defined parameters are as follows:

rssfeed -> URI of the RSS feed rssitems -> The number of items to display rssmaxdescription -> The maximum number of summary characters to display rsscssclass -> The class name to give the containing <div> (per item) rsslinktarget -> The target attribute for the link to the post rsscacheduration -> The duration (in seconds) of the cache rssdateformat -> The data format (see PHP's date function)

Default values

The default values for the above parameters are:

rssfeed => 'http://wordpress.org/news/feed/' rssitems => '5' rssmaxdescription => '400' rsscssclass => 'rssitem' rsslinktarget => '_self' rsscacheduration => '3600' rssdateformat => 'j F Y | g:i a'

Example output:

This is output from the actual code above:

WordCamp US 2025: See You in Portland, Oregon!

WordCamp US 2025 is heading to vibrant Portland, Oregon, from August 26–29, 2025! Join fellow open source enthusiasts, developers, designers, and WordPress professionals from across the United States and around the world for four days of learning, networking, and collaboration at the Oregon Convention Center. Nestled in the Pacific Northwest, Portland is famous for its […]

Posted on 27 June 2025

Dropping security updates for WordPress versions 4.1 through 4.6

As of July 2025, the WordPress Security Team will no longer provide security updates for WordPress versions 4.1 through 4.6. These versions were first released nine or more years ago and over 99% of WordPress installations run a more recent version. The chances this will affect your site, or sites, is very small. If you […]

Posted on 19 June 2025

WCEU 2025: A Community Celebration in the Swiss Sun

Over 1,723 attendees from 84 countries gathered at the Messe and Congress Center Basel in Switzerland, and 20,353 more joined online for WordCamp Europe 2025. I’m personally very excited… There’s so much I want to do. I think there’s a clear pathway to 7.0 and beyond. Matt Mullenweg, WordPress Cofounder The flagship WordPress event kicked […]

Posted on 7 June 2025

Announcing the Formation of the WordPress AI Team

Today, I’m pleased to announce the formation of a new WordPress AI Team, a dedicated group focused on accelerating and coordinating artificial intelligence projects across the WordPress ecosystem. AI is already transforming how people create and manage content online. As this technology evolves, it’s essential that WordPress remains at the forefront, ensuring innovation happens in […]

Posted on 27 May 2025

WordPress Campus Connect Expands

WordPress Campus Connect, initially launched in October 2024 as a pilot program, has now been formally established as an official event series due to its resounding success. The inaugural program, spearheaded by myself, Anand Upadhyay, garnered immense enthusiasm from 400 Indian students who were eager to engage in hands-on WordPress training. WordPress Campus Connect transcends […]

Posted on 7 May 2025

Leave a Reply

Your email address will not be published. Required fields are marked *