Quotation Plugin
I have written a plugin for Wordpress that allows you to display a random quote-of-the-day on your site. There does already appear to be a few quote-like plugins available but they all required you to manually create or add the quotations yourself. My plugin has a clear advantage in that it is self-contained. It pulls quotes from an RSS feed supplied by quotationspage.com.
In my opinion, the standards of quotes you get from this site are of a very high quality. Sometimes funny, sometimes political, sometimes philosophical but always witty! The plugin, once installed will select quotes at random from a possible twelve, which are updated once every twenty-four hours.
You can see the plugin in action at the top of this page on the sidebar on the homepage. It is my first ever Wordpress plugin and is still in a beta stage. The source code is heavily commented, but I am happy to answer any questions on it.
The latest version is version 0.7.3
Download now.
Installation
- Put the qqotd.php file into your wp-content/plugins directory.
- Activate the plugin on the plugin screen.
- Insert
<?php do_qquotes(); ?>in your templates (header.php is recommended).
Known Bugs
- The URL to the RSS feed could at some point change and unless the old URL points to the new, quotes will not be found
- Adverts ending in anything other than a full stop, are not eliminated. Fixed!(01/09/05 20:23:54)
- The advert remove function is also removing the initial " surrounding the quote itself.Fixed (06/02/06)
- Versions of php where allow_call_time_pass_reference was set to false cause warnings. Fixed (27/12/06)
October 5th, 2005 at 12:39 am
as you can se on the “randomness” page (sidebar at at the bottom) on http://notsokosher.net
fwrite() and fclose() don’t seem to be working. any ideas?
October 7th, 2005 at 10:59 am
Are you referring to the error:
CG-Feedread failed to save feed to disk — couldn't write to the cache_feedread directory.The fwrite and fclose must be working to some extend as you seem to have some sort of qquotes on your page. But I am not sure where the qquotes plugin is? Is it the one under “Not So Kosherific” (on the randomness page)?
Can you have a look on your web server and see if a directory called qquotes has been created in wp-content/plugins/. Did you modify the script at all?
October 7th, 2005 at 6:02 pm
sorry about that, i took it off because it was creating a lot of garble-d-gook on the randomness page. the CG-feedread is from the rss feed, gotta figure that one out as well.
I’ll make a new page called quotes with just that command in it, and you can see waht im talking about. i think it might have something to do with the writing privilages of that directory, but since i don’t own the server, it might be fairly difficult for me to configure it.
October 7th, 2005 at 6:10 pm
ok - now im just getting “qquote failed to write” 12 times then “qquote failed to read”
quite certain it is the privilages thing.
oh, and the other quotes use either sql or a pre formatted text db to store the quotes, or just dynamicaly post them from and rss feed. neither of them actually need to write something. hence why i didn’t get this error before.
October 9th, 2005 at 10:40 pm
If you have ftp/ssh access to your server could you have a look and see if a directory called qquotes has been created in wp-content/plugins/. If it has are there any files in it/are they empty?
October 24th, 2005 at 3:32 pm
nay, it is empty. i created it for the program - the only reason why it is there. i am quite certain it has something to do with read/write privilages.
December 1st, 2005 at 3:24 am
well, ’tis been quite a while, I know, but I did finally fix the problem. It did have to do with writing privs. I thought I had set qquotes to 777, but apparently doing things through FTP isn’t quite enough, I had to do it through SSH. Silly linux and their rules.
Now that it finally works, Cheers! Some wonderfuly hilarious sayings you got there.
December 28th, 2005 at 10:21 am
Hi,
trying your plugin I get
failed to open stream: No route to host in /usr/local/data/php/bb-blog/wp-content/plugins/qqotd.php on line 186is it possible to tell your plugin about a proxy ?
I guess it is because of the firewall ?
January 15th, 2006 at 4:10 pm
found your quotation pluginn after much searching for something like this, and it is perfect, works just like it should.
thanks so much.
January 20th, 2006 at 1:32 pm
Nowotny, Im not convinced it is a proxy problem. Can you get onto your webserver and try the following:
cd /usr/local/data/php/bb-blog/wp-content/plugins/
ls -l qquotes
And tell me what happens?
February 4th, 2006 at 2:45 am
i am using the plugin, it’s great, but i just noticed that there are only quotation marks (”) being written at the end of the quote.
Is this the source (quotationspage.com) or is this controlled by your plugin script?
I would either have q-marks start and finish, or none at all.
is there an easy fix…?
thanks
February 4th, 2006 at 8:21 pm
Hi eric, I’ve just been on your site and I see what you mean. It confuses me though as this should not be the case. You sure you have the latest version? You will see that my qquotes have ” at the start and finish. Maybe you got a bad batch of quotes. My advice, wait for the next set to be loaded and see if the problem goes. Keep me posted!
February 5th, 2006 at 4:09 pm
i’ve downloaded and am using the version labelled 0.7.1, the php file is labelled 0.7
I had saved a batch of 12 qquotd text files from an earlier time and they are set up with “-marks at each end, so it might be just a “bad batch”, as you say, this time.
I will watch and see how the next ones work.
By the way, thanks for turning me onto the “simpleviewer” image gallery app as well, (after poking around on your site a bit), it’s a nice setup.
February 6th, 2006 at 2:39 pm
Sorry eric, I checked things a bit more thoroughly and it appears I was myself using a different version than the one available for download. Please download the new zip file and replace the PHP file to fix this problem. You will need to wait for the next time the quotes are updated to see the change take effect.
February 8th, 2006 at 12:00 am
using the new version and clearing up some other problems that might have been related seems to have solved the problem.
very good & thanks
February 8th, 2006 at 1:16 am
i have used the new version and fixed up some other stuff that may have been related and all is good now.
many thanks
April 3rd, 2006 at 2:18 am
I’ve been trying to use your plugin… but this keeps coming up every time I activate it:
Warning: fopen(): URL file-access is disabled in the server configuration in /home/.data/user/website/wp-content/plugins/qqotd.php on line 186
Any idea what I need to do? Thanks
April 5th, 2006 at 12:02 pm
Hi michellemb! This could be quite a tricky one. Your hosting company has disabled scripts on your site from accessing external URLs, in this case the quotationpage.com. Who is your web hosting company? Could you ask them why they have PHP setup in this way as it’s quite unusual for them to have done this.
December 6th, 2006 at 9:22 pm
Thanks for the plugin - much bet than get-a-quote that I have used in the past.
Try widgtize-anything, I have widgetified the theme I chose and this plugin works really well with yours.
Cheers!
December 27th, 2006 at 4:31 am
Got this fun error upon activating plugin…
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of xml_set_object(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/.bauzeur/salesmotiv8/salesmotivation.net/wp-content/plugins/qqotd.php on line 182
December 27th, 2006 at 8:04 am
My web host had
allow_call_time_pass_reference
set to true already so I never noticed this. I have changed the call to xml_set_object() to now be pass by value and tested it under php 4.4.4.
If you re-download the zip file (0.7.3), you should find this error to now be resolved.