{"id":137,"date":"2011-12-12T09:49:41","date_gmt":"2011-12-12T09:49:41","guid":{"rendered":"http:\/\/christopher.murtagh.name\/?p=137"},"modified":"2011-12-12T09:49:41","modified_gmt":"2011-12-12T09:49:41","slug":"simplerssembed-my-first-plugin","status":"publish","type":"post","link":"https:\/\/philoxopher.com\/2011\/12\/12\/simplerssembed-my-first-plugin\/","title":{"rendered":"SimpleRSSEmbed – my first WordPress plugin"},"content":{"rendered":"
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’\u2122. 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.<\/p> \n
So, if anyone is interested in this very simple plugin, here it is<\/a>. Of course, it’s GPL<\/a>. 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.<\/p>\n\n You can get the current version from here: simplerssembed.zip<\/a><\/p>\n 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: <\/p>\n \nMake 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’:<\/p>\n\n Then go to the plugins tool in your WP dashboard, and activate the plugin.<\/p>\n Once the plugin is activated, you can embed RSS feeds with the following shortcode: <\/p>\n\n The currently defined parameters are as follows: <\/p>\n\n The default values for the above parameters are: <\/p>\n\n This is output from the actual code above: <\/p>\n\n\n The second Release Candidate (\u201cRC2\u201d) for WordPress 6.8 is ready for download and testing! This version of the WordPress software is under development. Please do not install, run, or test this version of WordPress on production or mission-critical websites. Instead, it\u2019s recommended that you evaluate RC2 on a test server and site. Reaching this phase [\u2026]<\/p> Posted on 1 April 2025<\/p><\/div> WordPress 6.8 RC 1 is ready for download and testing! The scheduled final release date for WordPress 6.8 is April 15, 2025. Your help testing over the next three weeks is vital to ensuring the final release is everything it should be: stable, powerful, and intuitive.<\/p> Posted on 25 March 2025<\/p><\/div> WordPress 6.8 Beta 3 is ready for download and testing! The scheduled final release date for WordPress 6.8 is April 15, 2025. Your help testing Beta and RC versions over the next four weeks is vital to ensuring the final release is everything it should be: stable, powerful, and intuitive.<\/p> Posted on 18 March 2025<\/p><\/div>Documentation<\/h2>\n
Download<\/h2>\n
Installation<\/h3>\n
\n
[root@ simplerssembed]# chown apache: cache\n[root@ simplerssembed]# chmod 755 cache\n<\/code>\n\n
Using the plugin<\/h3>\n
[simplerssembed rssfeed='http:\/\/wordpress.org\/news\/feed\/' \n rssitems='5' rsscssclass=\"rssfeeditem\" \n rssdateformat=\"j F Y\" rsslinktarget=\"_new\"]\n<\/code>\n\n
Parameters<\/h3>\n
rssfeed -> URI of the RSS feed\nrssitems -> The number of items to display\nrssmaxdescription -> The maximum number of summary characters to display\nrsscssclass -> The class name to give the containing <div> (per item)\nrsslinktarget -> The target attribute for the link to the post\nrsscacheduration -> The duration (in seconds) of the cache\nrssdateformat -> The data format (see PHP's date function)\n<\/code>\n\n
Default values<\/h3>\n
rssfeed => 'http:\/\/wordpress.org\/news\/feed\/'\nrssitems => '5'\nrssmaxdescription => '400'\nrsscssclass => 'rssitem'\nrsslinktarget => '_self'\nrsscacheduration => '3600'\nrssdateformat => 'j F Y | g:i a'\n<\/code>\n\n
Example output:<\/h2>\n
WordPress 6.8 Release Candidate 2<\/a><\/h3>
WordPress 6.8 Release Candidate 1<\/a><\/h3>
WordPress 6.8 Beta 3<\/a><\/h3>