DonkieQuote
General
Description
DonkieQuote is a plugin that manages quotes that you can display on your blog. It also comes with a template tag that you can use to display a random quote. DonkieQuote was originally created for Beer-Roll.
Licence
This plugin is available under the BPL (Beer Public Licence). You're free to use this code, as you see fit. It comes as is, with no warrenty. Optional compensation for the author should take the form of a good beer. ;)
Author
Chris Shaffer <kickthedonkey @ gmail DOT com> Feel free to contact me about this plugin.
Download
Get the plugin here:
Install
Database
First things first. You need to create the table that DonkieQuote uses to store the quotes. Here is some SQL to use:
CREATE TABLE `wp_quotes` ( `quote_id` int(11) unsigned NOT NULL auto_increment, `quote_author` int(4) NOT NULL default '0', `quote_text` text NOT NULL, `quote_src` varchar(150) default NULL, `quote_src_url` varchar(255) default NULL, `quote_added` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`quote_id`), KEY `quote_author` (`quote_author`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;
You can change the name of the table if you like (default is wp_quotes). However, if you change the name of the table, you'll need change the Quote Table field under Options->Quotes in the Wordpress Admin panel.
Plugin Installation and Activation
With the table created, drop donkieQuote.php in your plugins directory (path/to/wordpress/wp-content/plugins/).
Then, login to the Wordpress admin section, go to Plugins, and select Activate for DonkieQuote.
Setting Options
Now, go to Options->Quotes. There are three options here, that should be self explanatory. If you created a table of a different name than 'wp_quotes', be sure to change the Quote Table field to that value.
Create Your First Quote
Everything should be good now for you to create your first quote. In the Wordpress admin panel, select Write->Quotes. You'll get a form that you can complete. The only required field is the Quote field. Click save. If everything was installed right, you should now have a quote in your database.
Displaying Quotes
Okay, now you've got a quote in your database. You maybe wondering how you display it. DonkieQuote comes with a simple template tag that you can use:
<?php do_random_quote(); ?>
Just add the above to the template file of your choice. The above tag will, by default, generate the following HTML:
<div class="dq_quote">{quote_text} -<a href="{quote_src_url}">{quote_src}</a></div>
The div tags and the seperator hyphen are customizeable. Lets say I wanted span tags around my quote, with a colon as the seperator. I would call this tag:
<?php do_random_quote('<span class="my_quote_class">', '</span>', ' : '); ?>
And that would generate:
<span class="my_quote_class">{quote_text} : <a href="{quote_src_url}">{quote_src}</a></span>
Note: If there is no quote source url for that particluar quote, the link will not be displayed. If there is no quote source, 'Unknown' will be displayed for you.
Attachments
- donkieQuote.php (18.4 kB) -
donkieQuote 0.2.2a
, added by GURT on 02/16/06 05:16:40.
