2 Mar
Last update: version 2.5 has been released
Update Again: New version of the plugin now available
Another Update: A call for beta testers for version 2.0 of the plugin
Update: This plugin has been updated to include support for enclosures.
Previously, the VotD script on the sidebar of this site was generated by a perl script that parsed the RSS feed provided by Good News Publishers for the ESV bible.
To setup this script required you to copy the script into your cgi-bin, setup a location for the cache file, add the script to cron to run daily & then put the include tags into the code. This was all well & good for nerds such as myself who’re familiar with this, but it was a bit of a stretch for the general public. Also, I’ve found that a surprising number of hosting companies don’t allow their customers access to cron.
Getting to the point, I’ve re-written the perl script into php & turned it into a WordPress plugin. It works in a similar method to TTLB Ecosystem Cache Plugin, in that it creates a cache file and updates it every 24 hours.
The script defaults to the ESV feed and outputs the verse like this:
<p id="votd">In this is love, not that we have loved God but that he loved us and sent his Son to be the propitiation for our sins. Beloved, if God so loved us, we also ought to love one another. (<a href="http://www.gnpcb.org/esv/search/?passage=1+John+4%3A10-11">1 John 4%3A10-11</a>, ESV) (<a href="http://www.gnpcb.org/esv/share/audio/smil/?passage= 1+John+4:10-11">Listen</a>)</p>
This can all be changed (including which bible version, see Optional Parameters below), but by using CSS to style, this should be generic enough to fit most people’s needs.
Installation
To make life easy, the wp-votd plugin is listed on the WordPress Plugins Database’s “One-click install” system. If you’re not using the WP Plugin Manager, then you can download either the php file or the zip of that file from the WordPress Plugin Repository.
Update for WordPress < 1.5: as Nicole pointed out below, I failed to mention clearly that this was a WordPress 1.5 only plugin. My apologies to Nicole & anyone else who had the same problem. Long & the short of it is that 1.5 comes bundled with software that can read & parse RSS feeds (namely Magpie RSS). Now, earlier versions of WordPress lack these scripts, so there are two possible solutions: You’re more than welcome to do option 1, but because I’m such a nice guy I’ve done option 2 as well: This *should* be a transparent, seemless change
magpierss & put the wp-votd-plugin.php file in the plugins directory (overwrite your existing copy if it exists) & should also work on version 1.5 of WordPress (I’ve had it running here for testing). but it will not work with WordPress 1.5, as it creates a conflict. WordPress 1.5 users should still use the version found in the WordPress Plugins Manger (also can be found here) as you don’t need the MagpieRSS files.
Usage
After installing the plugin, all that is needed to be done is to add wp_votd() to the code to make the Verse of the Day display as you can see on the front page of this site. There are a number of optional parameters that you can use to specify which RSS feed to use and how to display it, but if you just use the plain tag wp_votd() it will work just fine.
Optional Bible Version The script comes setup for three different versions of the bible, the ESV, the NIV & the KJV. If you just stick <?php wp_votd(); ?> into your code, then it will display the ESV, but to display the NIV you need to use this: <?php wp_votd('niv'); ?>, and for the KJV, this: <?php wp_votd('kjv'); ?>. Note the single quotation marks around the version abbreviation.
As always, comments, questions and criticisms are welcome.
Optional Parameters
Unless you want to get all technical and change things, you can safely ignore this section.
The function parses the feeds using the perl script that parsed the RSS feed provided by Good News Publishers for the ESV bible.
The script uses the Magpie RSS Parser that’s been built into the WordPress 1.5 core (hence requiring version 1.5)
Function spec.
wp_votd($feed, $force_refresh, $return, $template, $die_loud)
$feed: This can either be blank (default to ESV), a url of a VotD RSS/Atom feed, or a version key for one of the pre-defined feeds:
If there are other feeds that people think should be included, please let me know. Remember you can just pass the function a feed’s url rather than one of these keys.
$force_refresh: If set to true, it will go and retrieve the verse from the RSS feed, even if it was checked less the 24 hours previously.$return: If true, the function will return the formatted verse rather than displaying it.$template: defaults to
<div id="votd">***DESCRIPTION*** (<a href="***LINK***">***TITLE***</a>***VERSION***)</div>
The ***DESCRIPTION*** will be replaced with the verse, ***LINK*** with the link to the verse on the website, etc…
$die_loud: For testing, ignore.One last thing to note is that while this is built as a ‘Verse of the Day’ script, all it’s really doing is pulling the last item of a syndication feed and wrapping the content in a div. So it should be possible to re-purpose this to display the last item of pretty much any feed you like.