Development on a Shoestring

Bible Verse of the Day WordPress Plugin

All Scripture is breathed out by God and profitable for teaching, for reproof, for correction, and for training in righteousness, that the man of God may be competent, equipped for every good work. (2 Timothy 3:16-17, ESV)

This is a plugin for the WordPress blogging software (which powers this site). It allows WordPress users to display a bible verse of the day on their site. Please read this page before leaving any questions/comments

Any version of this plugin past 2.6 requires WordPress 2.1, so if you haven’t installed WordPress 2.1 yet (and don’t intend to) please use the 2.6 version of this plugin. It is stable & functional, just no longer supported.

Installation

Download the plugin zip file (Download link is under ‘Plugin Information’). Unzip the files & place them in the /wp-content/plugins/ directory on your site. Enable the plugin on the Plugins page in the WordPress Admin, then go into the plugin options page, set the options you want and click ‘Update’. (You only have to do this if you’re changing any options, the plugin loads the default settings automatically). That’s it, the plugin is installed. Easy. Almost … too easy.

Using the plugin (aka How do I make the thing actually show up?)

Like many other plugins, this plugin creates another tag that you can put into your template somewhere. If you’re familiar with editing your site’s templates, then all you need to know is to put <?php wp_votd(); ?> somewhere on one of your template files. Usually it gets put on the sidebar, but you’re welcome to put it wherever you want. Inventive displays of creativity with the display of the VotD plugin will be highlighted here if you let me know about it.

Update in version 2.6: I have added support for the Hemingway theme’s block system, see below.
I have not ported support for Hemingway blocks to 3.0. This is because I’m planning to update it for the WordPress Widgets in the next release.

If you’re not familiar with editing your templates, instructions on how to are beyond the scope of this document, but there are plenty of great instructions and ideas on the WordPress Codex. But in short, what you should do to get started very quickly is to go into the Admin section of your blog, click on ‘Presentation’ on the menu, then ‘Theme Editor’ on the sub-menu. From there you are presented with a list of files on the right-hand side. This files are your site’s templates. I’m going to assume that if you don’t know how to edit your templates you’re still using the default template. Clilck on the sidebar.php link to bring up the code for the sidebar. At the top you’ll see

<div id="sidebar">
<ul>

After that add a new line and put this in:

<li><?php wp_votd(); ?></li>

Hit ‘Update File’ down the bottom and that’s it. If you view your site now, you should see the verse at the top of the sidebar. This may not work, however, if your server isn’t setup to allow you to edit files through the website. If on pressing ‘Edit File’ it presents you with an error message you’re going to have to edit the files manually with an FTP & text editor program. If that’s all geek to you, you’ll probably need to get some help from someone else to set this up.

Options

The plugin has a number of different options, which are set using the ‘Verse of the Day’ options page. You can select a different bible version from the dropdown list, or enter the details of any other VotD RSS feed you like. You just need to enter the version abbreviation (eg. ‘ESV’), the name of the version (eg. ‘English Standard Version’) and the URL of the RSS feed (eg. http://www.blablabh.com/rss.xml).

You can change the refresh time. Don’t though, it is a verse of the day after all. The only reason you’d use that is if you were testing something. You don’t even need to change this when you change the bible version, as it will automatically clear the cache and update for you.

You can change the display template. This is basically the code that the plugin outputs. It should be fairly self-explanitory to anyone with a passing knowlege of HTML. There are instructions on the options page explaing what the different tags display (eg. [TEXT] is where the text of the verse will display).

Technical Information

The plugin uses the magpie-rss php module that is built into WordPress to pull down the RSS VotD feed from sites like Good New Publishers (The English Standard Version) or BibleGateway (NIV, KJV, etc.). The plugin stores the verse information from the RSS feed in the WordPress options table along with a timestamp, so it knows when to update again. The user can set the plugin to update more regularly than every 24 hours but this is not reccomended, as it is a verse of the day, so the content won’t change any more regularly. If the user sets the update time to 0 a warning notice is set in the options page letting the user know that this is a Very Bad Thing

Previous versions of this plugin used a text file stored in the /wp-contents/ folder to hold the cache, but I found that far too many users were having problems with saving and retriving the cache file, mostly due to permissions problems (and hosting companies not allowing users shell access to set said permissions), so I decided to move it into the database. In doing so I found that WordPress makes DB access so redicullously simple I don’t know why I didn’t do it that way in the fist place. Pass set_options() 2 variables (a name and value pair) and it stores the value referenced by the name in the options table, and get_options() function retrieves the value. Pass set_options() an array as a value and it will serialize() it for you automagically (and get_options() will unserialize() too). So great.

Anyway, enough fanboy raving. The other major change was to create an options page rather than making the users set the variables in the code as paramaters on the wp_votd() function.

Viewing 61 Comments