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.
[?]
62 Responses for "Verse of the Day WordPress Plugin"
I tried to install this on my blog but I keep getting this error:
Warning: main(/home/kissmegr/public_html/blog/wp-includes/rss-functions.php): failed to open stream: No such file or directory in /home/kissmegr/public_html/blog/wp-content/plugins/wp-votd-plugin.php on line 19
Fatal error: main(): Failed opening required ‘/home/kissmegr/public_html/blog/wp-includes/rss-functions.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/kissmegr/public_html/blog/wp-content/plugins/wp-votd-plugin.php on line 19
Any suggestions?
Ahh, sorry, I should have made this clearer. This only works in version 1.5, as it has the RSS reading software installed.
You could download & include the Magpie RSS scripts: http://prdownloads.sourceforge.net/magpierss/magpierss-0.71.1.tar.gz?download
Hang on, I’ll add this to the post….
Beautiful plugin! I’m a real big fan of the NLT, is there any chance of that version being made available?
Glenn, AWESOME job, as always. I’ll be switching soon!
Tony,
I don’t know that the NLT is available in an RSS feed yet. Bible Gateway only offers these versions:
http://www.biblegateway.com/usage/linking/votdlist.php
You can delete my comment about how to add the NLT — as I failed to check it before I posted. Corrected comment follows that one.
I am teh loser.
Hey Glenn! You are such a nice guy!! Thanks for clearing that up for me. I’m going to try to upgrade my WP in the next week or so. I was going to go ahead and try it out in WP 1.2 though but when I click on your zip file it says that it isn’t found on the server. Just wanted to let you know. I guess I’ll check back in later.
Seems wp-plugins.org have changed the layout of the site a tad. Have changed the link, should work now.
Thanks for this great plugin! I just installed it (and didn’t break anything!) Very nice addition to the plugins collection.
Andy,
Thanks for the info.
Welcome!
I switched to Glenn’s plug-in. This is so much sleeker than the very hacked up version of Chait’s FeedRead I was using!
I changed it up a little bit, Glenn — let me know if that’s a problem. And THANKS for your hard work!
Change all you want, it’s released under the GPL so you can do whatever you want to it.
I’m just glad it’s of use to people.
How do I change the update / delta function to check the feed more than once a day? Say, every 12 hours? Mine isn’t getting updated until 3pm local time.
On (or around) line 41 there is this:
$update = ($delta >= (24*60*60));that is 24 hours (24 hrs x 60 min x 60 sec). Change the 24 to how ever many hours you want.
Alternatively if you want the file to be updated at a certain time of day. Delete the
votdcache.phpfile in your wp-content dir and reload your site at the time you want it to happen, it will then update at that time every day.Of course if you want it to happen at midnight you’ll have to be up then. But as you’ve got a little daughter Andy, you should be as familiar with the ungodly hours of the day as I am
Please forgive my ignorance when it comes to code, including CSS, PHP, etc. I’m just someone who wants some nice features to work on my blog. WP is great but sometimes, all the tech stuff is over my head.
You mention adding wp_votd() to the code. Where should this line be added? What file? I tried adding it to my sidebar.php file so it would display similar to your site but that didn’t work.
Fr. Daniel,
To add the code, place this where you want it on your blog (say, your side bar):
Should you want to manipulate it, say, change the feed, you would have:
Now, the first code is right. I’m acutally posting for 2 reasons (besides to respond to you!)
My second reason is, it seems no matter how I enter any tags, the default (ESV) is always shown. Am I entering this code correctly (per above)?
Thank you.
Ooops…it seems the comment box cut off my code. Let me try this (if this doesn’t show up, could someone help out?):
First piece: “” (take the quotes out to place in your blog code.
Second piece (to change the feed):
“”
Hope this shows up…
To show the different versions, just put the version abbreviation into the tag, like this:
<?php wp-votd('niv'); ?>Umm, maybe I am missing something but I put
Verse of the day:
into my sidebar.php but I just get the horrible error:
Fatal error: Call to undefined function: votd() in /home/catalyst/public_html/wordpress/wp-content/themes/Benevolence/sidebar.php on line 19
I am running WordPress 1.5 but am a little stumped!
Thanks
Alyn, you need to put
<?php wp_votd(); ?>into the your sidebar, after installing & enabling the plugin.Sorry - I had included
<?php wp-votd(); ?>in my sidebar (and in the above post) but I forgot that the posting stripped out my HTML… oops.So, to recap, when I paste
Verse of the Day:
<?php wp-votd(); ?>into my sidebar, it gives me the error
Fatal error: Call to undefined function: votd() in /home/catalyst/public_html/wordpress/wp-content/themes/Benevolence/sidebar.php on line 19
Not sure what the problem is.
Alyn, this is the same problem I’m having. Even with a specific version name (’esv’) in the line, I get the “fatal error” message.
<?php wp_votd(); ?>not<?php wp-votd(); ?>There has been some confusion over this, not the leaset reason being that I typed it wrong a couple of times in the post
So, in clarity the code you need to have is
<?php wp_votd(); ?>or, if you want the niv:<?php wp_votd('niv'); ?>, or the kjv<?php wp_votd('kjv'); ?>I’m very sorry for the confusion, major mea culpa!
I uploaded the files to my plug-in directory. I activated the plug-in (I am using WP 1.5). I added the code to my sidebar but nothing shows up. Any suggestions?
Hello!
I use WP 1.2
I tried installing the files and I enabled the plugin, added the code to my page and got this error:
Warning: fopen(/home/mydirectory/public_html/blog/wp-content/votdcache.php): failed to open stream: Permission denied in /home/mydirectory/public_html/blog/wp-content/plugins/wp-votd-plugin.php on line 83
Warning: fwrite(): supplied argument is not a valid stream resource in /home/mydirectory/public_html/blog/wp-content/plugins/wp-votd-plugin.php on line 84
Warning: fclose(): supplied argument is not a valid stream resource in /home/mydirectory/public_html/blog/wp-content/plugins/wp-votd-plugin.php on line 85
I had the magpierss folder and the votd file in the plugins directory as specified. When it didn’t work, I tried moving magpierss to the wp-content directory, but that took down my whole blog with an error. Any ideas why it won’t work? Thanks!
Ah, that’s a permissions error. What it means is that the web server can’t write to the cache file
/home/mydirectory/public_html/blog/wp-content/votdcache.phpIf you have access to a command-line you need to type
chmod 666 /home/mydirectory/public_html/blog/wp-content/votdcache.phpand that should fix the problem.If you don’t have command-line access, your ftp program should allow you to do the same thing.
I installed your plugin using the wp-plugin-manager one click install.
1. there is no votdcache.php file (is this normal?)
2. I got error like #24, and I tried #25 to fix it.
3. The error report were gone, but there’s nothing showed, just blank, nothing.
any ideas?
thanks and GBU for this plugin
John, try creating a blank file called votdcache.php & put it in the wp-content directory, making sure that the web server has write-permissions on that file.
If it’s not loading, try changing the wp_votd code in your template file to
wp_votd('esv',true);, which will force the script to update each time the page is loaded. (If it works you’ll probably want to change it back because it will increase load times on your pages)Thanks, it worked fine.
if I may add, I uncomment the str_replace part of the script (the one that commented “Replace HTML entities - not used”) because I use the NIV version (i think it will do for KJV also).
another thing i changed is ‘&’, ‘&’ to “&”, “&”
i did these steps because the validator at w3c complains of my site being not a valid XHTML..
i’m sure you know what i mean.
there were supposed to be an “amp;” part after the second ampersand sign in “&”, “&” ..
sorry for comment-ing all the time..
That’s cool, glad to know people are using the plugin!
The str_replace wasn’t implemented simply because I ran out of time to implement a proper entity replacer that would allow for when the feed itself had already replaced the entities, but as long as it works for you, it’s all good.
It’s a no go for me. I can’t get it to work even with the fix you gave JOhn.:(
Thanks for the extra info Glenn. #27 is what it took for it to work for me. I had to create the file,give permissions to it, change in template to wp_votd(’esv’,true); then it worked and I could change back.
I am excited to have it working. Thanks for the plugin.
I’m using WP 1.5. I installed the plugin and wrote into my sidebar template, and I got the same error message as Mena:
Warning: fopen(D:\davensusan\wp-content/votdcache.php): failed to open stream: Permission denied in D:\davensusan\wp-content\plugins\wp-votd-plugin.php on line 82
Warning: fwrite(): supplied argument is not a valid stream resource in D:\davensusan\wp-content\plugins\wp-votd-plugin.php on line 83
Warning: fclose(): supplied argument is not a valid stream resource in D:\davensusan\wp-content\plugins\wp-votd-plugin.php on line 84
Like Fr. Daniel, I know nothing about writing code. I would just like to have my sidebar look like yours. I’m told that Mena’s solution doesn’t apply to me because that’s for a Unix server, and I’m on a Windows server.
Dave, the problem is the same as Mena’s, you need to set the permissions on the file
D:\davensusan\wp-content\votdcache.phpIf this is a hosting account, talk to your support people, they should be able to step you though it (or more likely, do it for you). If not, and this is a machine you have direct access to, http://www.microsoft.com/technet/prodtechnol/windows2000serv/deploy/confeat/13w2kadc.mspx has instructions on how to set file permissions. Basically you want to give full control to the IIS user, which is usually called IUSR_[computername].
I have no idea why Microsoft decided to make the setting of file permissions be so difficult, but that’s the way it is I’m afraid.
Great idea and implementation. I am unable too change bibles though, even though I change the abbreviation in the code I inserted and even changed it via the Plugin Editor.
Any thoughts?
What version are you setting it to?
Also, note that the version abbreviation needs to be wrapped in single quote marks, ie
wp_votd('niv');Also, remember, the script only upates once a day, unless you set the second parameter to true (see comment 33 for example), so if you change the version you won’t see the change reflected on the site until the scrpit updates.
That was it! I was expecting it to refresh immediately. I also change the refresh rate to 4 hours as mentioned in above. Excellant work!
Hey everybody,
I wasn’t aware that there were so many people interested in applying a verse-of-the-day to their sites! Kudos to you, Glenn, for the plugin. I’m at work right now, but will be downloading WP 1.5 tonight when I get home. I’ll also be installing this plugin!
Thanks again
Plugin WordPress: Verse of the Day
Il plugin per WordPress Verse of the Day utilizza il feed RSS Verse of the Day (come predefinito usa la bibbia ESV, ma vi sono disponibili molte altre) per visualizzare il verso del giorno, inserito in un div che ha come id “votd” per consentirn…
links for 2005-05-06
Development on a Shoestring » Verse of the Day WordPress Plugin (tags: wordpress plugin) SUNS: Paul on the Playoffs…
Everything works! Your plugin is really great. I have one question: How do I make the text of the Bible verse fit into a format that I want?
When I put the code on my blog page it gives this error message:
Warning: fopen(d:\inetpub\cfotos\wp\wp-content/votdcache.php): failed to open stream: Permission denied in d:\inetpub\cfotos\wp\wp-content\plugins\wp-votd-plugin.php on line 94
Warning: fwrite(): supplied argument is not a valid stream resource in d:\inetpub\cfotos\wp\wp-content\plugins\wp-votd-plugin.php on line 95
Warning: fclose(): supplied argument is not a valid stream resource in d:\inetpub\cfotos\wp\wp-content\plugins\wp-votd-plugin.php on line 96
Neil, that’s a permissions error. See comment 25 for a solution.
[...] rd fonts and get smoother rendering than would be possible with simple text headlines. ESV Verse of the Day — Places the bible ‘Verse of t [...]
[...] Verse of the Day [...]
I appreciate that you keep this blog going and allow comments. To me feedback is an interesting part of a blog.
PlayMonteCarlo is Europe?s number one online casino. They offer distinctive online casino games such as (Multiplayer) Blackjack, Roulette, Caribbean Poker, Slots and even Horse Racing and Scratch Cards.
I put the download into content/plugins. I activated it. Nothing came up. I do not know where to put the code….. I use Word press 1.5.1.3 ver.
You need to put the code in one of your template files, i.e in the /wp-content/themes/
Usually it will be on the sidebar, but it can go where ever you like.
Please bear with a WP newbie - Exactly how do I control the font that appears in the sidebar?
BTW - installation was flawless. I put it at the top of the sidebar.
Thanks for a awesome plugin.
Jackie, the best way to control the font is to use CSS. If you’re not familiar with CSS you should probably have a look here and here.
But in short, the verse text is contained inside a HTML paragraph element with an id of ‘votd’. What this means is that if you open up your css document (in your case it’s wp-content/themes/ocadia/style.css) and go to the bottom of the file and insert the following:
#votd {
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
color: red;
}
it will make the VotD text 12 pixels in size, in the Verdana font and coloured red. You’ll probably want to style it somewhat different to that though
Glad to hear it all worked the way it’s supposed to!
Thank you Glenn!
That was exactly what I needed.
I am slowly but surely getting the hang of Word Press.
anyone know how to do this with straight PHP?
There is a church here in town that wants me to design a website for them.. They don’t want a blog, but they want this “Verse of the Day” thing… the NIV version..
so I was just wondering if anyone knew how to do this with straight PHP rather then thru a plugin?
thanks
great plugin, worked right out of the box
im just getting a blog set up but cant seem to get the wp_votd() function to display anything. ive tried setting the $force_refresh variable to true - nothing. thoughts?
notes: the plugin is activated, wp 1.5.2, code on sidebar (verse of the day
).
thanks for your help!
disregard.
after troubleshooting further, i found that dieloud helped. it couldnt find the file or access the file. looked in www logs and found it was looking in wp-content, not in root. moved the file, forced a refresh and wallah!
thanks, glenn for a great plugin!
Hi, i was wondering, how would you configure this if you wanted to show 2 votd’s, say, ESV on one side of my site, and KJV on the other? when I do it, it shows either one or the other on both sides, because it’s caching whichever is the active one, and displaying it on both sides
Chris, I’m really not sure, it was never desinged to run like that. I think in that case you may be better off looking at bible gateway’s javascript service, you could stick 2 of them on your site.
I had to create the cache file in wp-content, chmod 777 (I know), and then put
in the template. Still no display. No error, no verse…just nothing. Any Ideas where to go to troubleshoot?BTW, thanks allowing this support in the blog post, it is always great to see a contributer stand by his or her contribution.
Hi vetto, this plugin has been updated, please go to http://blog.slaven.net.au/archives/2005/10/17/verse-of-the-day-plugin-v25-release/ for the new version, it should fix your problem.
[...] Added Verse of the Day (Plugin) to Religion page [...]