Monday 25 July 2005 @ 9:26 pm
I have a random quote plugin to throw into the fray. It’s getting pretty popular now, thanks to everyone who uses it and says it doesn’t suck
Features
- It uses the database to store quotes, not a text file.
- It has a spiffy administrative interface (screenshot).
- You can call up a random quote, or a specific quote in your pages
- New: You can make a page with all your quotes.
- You can turn certain quotes “off,” without actually deleting them
- The quote layouts are done with CSS, so you can stick them anywhere and style them yourself (or follow my instructions below)
Installation Instructions
- Download the latest version (1.3) here.
- Get all the files out of the archive
- Copy the file wp-quotes.php to your wp-content/plugins/ directory
- Copy the file edit-quotes.php to your wp-admin/ directory
- Go to the Plugins section of your WordPress admin, and activate the plugin
- Go to the Manage section, and click on “Quotes.” It will create the database and add a few quotes to get you started.
- This part might be tricky. You have to decide where to stick your quotes, and modify the theme file to do it. Here’s an example for putting the quote in the sidebar like you see on this site:
- In your admin interface, go to the Presentation tab, then click on Theme Editor
- Click on the Sidebar Template link on the right hand side.
- Find out where you want to stick your quotes in the code, create a heading for it, then insert the following:
<?php wp_quotes_random(); ?>
API
wp_quotes_random();: Displays a random quote, in a div with classes as indicated in the installation instructionswp_quotes($id);: Displays a specific quote by quote ID. Useful if you want to embed a quote in a page, maybe?<!--wp_quotes_page-->: Putting this in any post or page entry will spew the entire list of quotes in your database
Of course, you can customize everything about this through CSS. Here’s the classes and IDs to use:
CSS Customization
- The Random Quotes
- The quote is identified and enclosed by a div, CSS element id wp_quotes.
- The actual quote is in a div, of the class wp_quotes_quote.
- The author is in a div, of the class wp_quotes_author.
- The Quotes Page (example)
- The quote is identified and enclosed by a div, class wp_quotepage.
- The actual quote is in a div, of the class wp_quotepage_quote.
- The author is in a div, of the class wp_quotepage_author.
- The horizontal rules are of the class wp_quotepage_hr. You can turn it off by setting
display: nonein the CSS. - The Powered By blurb is a div, of the class wpquotes_poweredby. I’d like you to leave it, but hey, I understand, so you can make it disappear just like the hr above.
The CSS I use on this site
#wp_quotes
{
margin-left: -10px;
}
#wp_quotes div.wp_quotes_quote
{
}
#wp_quotes div.wp_quotes_author
{
text-align:right;
font-style: italic;
margin-top: 5px;
}
div.wp_quotepage
{
font-size: 14px;
width: 80%;
margin-left: 40px;
}
div.wp_quotepage_quote
{
}
div.wp_quotepage_author
{
margin-left: 40px;
font-style: italic;
}
hr.wp_quotepage_hr
{
width: 70%;
margin-top: 15px;
margin-bottom: 15px;
margin-left: 15px;
}
div.wpquotes_poweredby
{
text-align: center;
font-size: 0.8em;
margin-top: 12px;
}
Revision History
- 1.3 - September 1, 2005
- Another css screw-up fixed, as well as proper instructions
- 1.2 - August 12, 2005
- The CSS class id wp_quotes was screwed up, this is just a fix for that.
- 1.1 - August 11, 2005
- Added the <!–wp_quotes_page–> for page of quotes functionality
- Now inserts a few quotes into the database
- 1.0 - July 27, 2005
- Initial Release!
Troubleshooting
- I can’t see the quote editing/adding form!: See this post.





[…] Here is a random quote plugin that let’s you manage the plugins yourself. […]
I get undefined function error. Where is the function ‘…random()’ supposed to be defined?
It’s defined in the wp-quotes.php file. Make sure you’ve activated the plugin on your plugins page. And make sure it’s wp_quotes_random().
If it’s still not working, let me know, maybe I can help you out more.
Works great! Thanks!!
I use it for now on a testsite, because i have to add 100 more quotes
I think there is a problem with the CSS, i added it to my theme-css, but it dont come up with the classes..,i will check it tomorrow.
it’s not working for me either. this shows up on my page:
It’s activated
Try removing the spaces from the tag code.
ie…
Use this instead
For some reason when exectuted the tag with the spaces fails to produce. It works once the spaces are removed. : )
Hey –
You’re absolutely right. There should be no space between the < and the ?. It should be <?. I’ve corrected the instructions, thanks for pointing this out.
I just started using Word Press. This was so easy to install & to start using. Thank you for a great plug-in
Thanks
I am using this on my site right now
http://www.thegoogleblog.com
I may be putting my quote list up for download in SQL and/or CSV format later this week (by 8/7 most likely). I’ve got a lot of requests for this, so people can start off with more than nothing. I’ll let you all know when that’s available and ready. I might create another plugin out of it.
OK great plugin, except I have a problem using it on my online blog.
Here is the background. One a WP blog set up offline on my home box it works OK. The blog is WP ver 1.5.1.2
My online blog is WP ver 1.5.1.3. The plugin activates and the table is in the data base as advertised. When I go to the manage > quotes screen it shows the “add quote” section empty. The title is there but no display of a text box or other options as my offline blog has.
Below that is the “manage quotes” section and obviously because no quotes are added as yet it just says “You haven’t entered any quotes yet.”
Is it possible the “Admin Tiger” (www.orderedlist.com) CSS I use for the admin section of the online blog is causing it? If so it would be the first time it has caused a problem and I use a very long list of plugins.
As I said I use a long list of plugins and if one of those is causing the problem it might be easier if you check this page rather than listing them here.
http://cranialcavity.net/fullthrottle/wp/index.php/comment-policy/wordpress-plugins-utilized/
Thanks.
Hey –
I tested it with the Tiger Admin (which is a pretty cool plugin, I might use it more often..), but it worked fine. Can you load the page up, and do a view source and send that to me at vermicin @t gmail d.t com? Or give me an account on there so I can troubleshoot it? I promise not to mess anything up
Dunstan I sent the source code you requested a number of hours ago, are you in receipt of it?
Since then I have re-installed the plugin but that has not cleared up the previously reported problem.
Hey Marc –
I tried to email you back, but it’s bounced several times. The source code looks fine, so I’ll need a login.. email me at the same address with the info and I’ll take a look at it.
(this section of the site is not live yet.)
The quote is working fine — but I can’t get it to “attach” to the stylesheet. I tried putting it in the theme’s style sheet, and I also tried putting it in the header of the index.php file.
Any suggestions?
Thanks
Ah, I figured it out. Styles are working now!
Great plugin!
Nice- was going to try something like this myself, but as life is short I gladly used yours (it’s better than I would’ve done anyway).
Couple of things that I think would help users (especially those not so clued up with how WP and MySQL work):
-> Mention in the installation that you they have to initialise the plugin.
-> Load an example comment into the db for users, otherwise a MySQL error appears (empty table) until you put somethign in there. That’d also make it clearer what’s going on in the admin.
-> Tell people where to find the comments in the admin.
Cheers. c*
That’s a great idea, chillstar. I’ll integrate that into the next revision!
Absolutely LOVE it! My only issues is thus:
I cannot get the author of the quote & quote on the same line for some odd reason. Let me know. Shoot me an email.
[…] wp-quotes […]
Say, way cool plugin!
I am not able to edit the css? I have added your css and still it seems it doesn’t apply?
Here is what it reads when viewing the source:
The most extraordinary thing in the world is an ordinary man and an ordinary woman and their ordinary children.
G.K. Chesterton
Any ideas on this?
tGriff
The most extraordinary thing in the world is an ordinary man and an ordinary woman and their ordinary children.
G.K. Chesterton
The source
Hmmm,
when I send the source it doesn’t show up on this comment.
The source says the div is named “wp_quotes\”" the div class=”wp_quotes_quote” the author is: cass=”wp_quotes_author”
Nice plugin! It’s fun to use.
One thing I’ve noticed (version 1.2) on my installation is that when I login and go to add a quote, it just returns to the Manage Posts page in the panel without adding the quote or giving any kind of message. However, if I click Edit for an existing quote and save it without making any change, then I’m able to add new quotes fine.
It’s odd, though, that no one else has mentioned this. Maybe it’s something with the way PHP is set up on my host (Dreamhost).
Also, another nice addition might be to add something like a “source” field, so that, in addition to the author, you could add the TV show, movie, or song that it comes from when quoting from such a source.
I downloaded version 1.2 but it is still labled as 1.1 in the file so I am not sure if it is indeed 1.2 mislabled or still 1.1
In any event, thanks for the great plug-in.
Also, I am embedding the quote into the sidebar like so:
I get xhtml validation errors, which seem to indicate that maybe it is expecting to return to a section?
Any suggestions how to edit your spew quote section to address that?
Matt: It should tell you that the quotes were added.. that seems like a weird bug.
xyth: yep, it’s mislabled.. its 1.2
I can’t see your code, so I don’t konw what’s wrong… but as far as I can tell, the xhtml is correct…
I looked at your site, and you have something like this:
<h2>heading</h2>
<ul>
{your stuff}
</ul>
basically, get rid of the UL tags, and it should validate fine .. the UL without an LI tag is an invalid nest in xhtml, so it’ll probably freak out
The ul tags are nested inside LI tags in my sidebar. If I remove the ul tags and leave the li, it validates, but the content is placed wrong. Just wasn’t sure if your code might be fussy if it landed inside a li / ul nesting. I will fiddle with it. Thanks again.