December 12, 2006
New Plugin - Random Quotes

WP RandomQuotes is a modification and melding of two separate WordPress plugins: WP Quotes by Dustin Barnes and RandomQuote by Abhijit Nadgouda. In fact, RandomQuote is simply a widget wrapper for WP Quotes. The problem was that WP Quotes had it’s own admin interface which actually required the WordPress user to drop a file in both the wp-plugins directory and in the wp-admin directory. This is not an elegant solution; many WordPress users are simply not technical enough to handle such an operation. In addition, the typical upgrade process for WordPress involves replacing all files in the wp-admin directory by deleting the entire folder and replacing it with the newer release’s folder. You could easily lose that functionality. Also, the RandomQuote would do nothing if the WP Quotes plugin was not in place and working. And, you had to add elements to your CSS file in order to format the quotes on your blog. Lots of “ifs”, “ands” and such. While the existing system worked, it was kind of convoluted.

So, I decided to take all three parts of the code and wrap them in to one plugin file. I had to rewrite a lot of the admin interface as it was dependent upon a lot of the code in the file that had to be dropped in the wp-admin directory. There was other code I had to change as well. It went rather quickly, though, as the original files I drew from are all stable and documented enough to hack in to. Thanks to Rob Lund for the suggestion of including a markup for specific quotes to be placed in posts and pages. I’ve added that request to the plugin’s functionality and kept a modified version of the tag from WP Quotes that allows a user to display all quotes in their database.

To see more or download the plugin, go to my wiki page here.

Filed under: Computer Stuff,
Run batted in by BillH at 2:39 pm |

4 Comments

  • Rob said:  
    (On December 12th, 2006 at 5:33 pm)

    You rock, Bill! Nice work. Some notes:

    Are your database table names different than WP-Quotes? After disabling that plugin and enabling yours, none of my older quotes show up in your plugin’s admin area. Not a huge deal, but would be sweet if there was a way to import them. I can always snoop around the tables and transfer them with phpMyAdmin.

    There seems to be a bug with the [[all_quotes]] code where it only displays n-2 of n quotes. For instance, I now have 7 quotes in my database, but only 5 show up in the all quotes page. This seems to be true as I add more quotes.

  • Rob said:  
    (On December 12th, 2006 at 5:36 pm)

    Oh also, the nifty quick tag is inserting:

    [[quote=""]]

    with the quotation marks. This doesn’t parse right. Your readme is correct with the quote marks absent.

    Awesome stuff, man.

  • BillH said:  
    (On December 13th, 2006 at 9:30 am)

    Yes, I did change the database name. I changed other things in the way the table was accessed so that the plugin will be WP 2.1 compliant for database names; the original plugin will NOT be.

    I believe the bug in the all_quotes tag is now resolved. There was an issue with blank records and how it skipped over them.

    I also changed the tag so it now does not output the quotation marks. It’s something I forgot to change in the button code but changed in the rest of the code and in the docs.

    You can download the new version from my wiki.

  • Rob said:  
    (On December 13th, 2006 at 10:01 am)

    Works really well, Bill. One note about stylesheets. IMHO, from a design point of view, I prefer to control my own CSS editing in my theme’s style.css as opposed to keeping the styling in the plugin file. Especially if the user updates the plugin version, any customization he makes to the styles in the plugin file will be lost.

    Unless there’s a way of overriding the styles in the plugin?

  • RSS feed for comments on this post.

    Sorry, the comment form is closed at this time.