XmasB Quotes

This plugin/widget lets you add and show random quotes to your Wordpress blog with ease. The plugin uses MySQL to store quotes.
You can specify an image for each quote, default image for quotes, and the option to disable images altogether.

Installation

This section describes how to install the plugin and get it working.

1. Upload directory “xmasb_quotes” to the `/wp-content/plugins/` directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress
3. Add the widget to your sidebar
4. That’s it!

By default the plugin looks for an image in the folder named “images” with a name that matches the author and extension “.gif”, eg. if the author is “Bart”, the plugin will look for the file named “bart.gif”. If an image is found it is used, else the quotes is shown without an image or default image if specified.

You can add, edit and delete quotes under Edit - XmasB Quotes.
The options for each quote:

Quote - The actual quote.
Author - The author of the quote. This is optional.
Image - The image to be used. If left blank, the name of the author will be used to search for an image. If not found, and default image is specified, the default image will be used.
Visible - Set this to “No” if you want to hide a quote without deleting it.

Set more general options under “Options - XmasB Quotes”.
Options available:

Show Images - Uncheck this to disable images shown with quotes.
Default Image - If specified this image will be used if no image is found for author or specified image for quote. If left blank, quotes without images will not show an image.
Show link to author - Shows a link to xmasb.com and my plugin in the widget. Turn off if you want to.

The title for the Widget is set directly in the Widget under “Presentation - Widgets”.
Title - The title to show with the Widget. Default is XmasB Quotes.

For easier management of version and statistics the plugin is hosted at Wordpress.org.

This blog is using the Widget as you can see to the right.

Stumble it!

(Klikk her for å få den norske versjonen.)

78 Responses to “XmasB Quotes”

  1. Gravatar
    kevin Says:

    After downloading and following your install instructions, the database is never added. Also, the .css file is blank in the zip file.

  2. Gravatar
    XmasB Says:

    The table should be created, but I found a bug when inserting the content right after the tables is created. The table that should be created is named wp_xmasb_quotes, assuming you have the standard “wp_” prefix.

    I have fixed this and added some content to the css file in version 0.6.1.

    As you can see it still versioned < 1, because I need to test it with more people. It works nicely at my own blog, but I need others to test it as well. Feedback like this helps a lot when ironing out the bugs that I have overlooked. Thanks for trying the Widget.

  3. Gravatar
    kevin Says:

    I am still having issues when activating the plugin and database creation. The plugin activate okay, but when I go to the manage - XmasB Quotes area I see the message:

    Last 10 quotes added
    WordPress database error: [Table 'donnas3_wrdp1.wp_xmasb_quotes' doesn't exist]
    SELECT * FROM wp_xmasb_quotes order by id desc limit 10

    No quotes found!

    Could this be because of the structure of my database? The database name is donnas3_wrp1. This is the way my host creates it.

    Thanks for any suggestions.

  4. Gravatar
    XmasB Says:

    The name of your database is donnas3_wrp1, and the table for XmasB Quotes is named wp_xmasb_quotes. Have you manually checked if the tables is actually created?

    The code checks if the table exists and creates it if not found. I have to look more into this, but if you could check if the table is created or not, that would help a lot. It looks like it is not, but I don’t know why at this point. Thanks again for trying out my Widget.

  5. Gravatar
    kevin Says:

    It doesn’t create the database.. Please let me know what you think it is? Thanks

  6. Gravatar
    XmasB Says:

    I have done some minor adjustments to the plugin concerning the creation of the table. The plugin uses the dbDelta() function to create the table. this should also go well with any future changes to the table. Not very likely to happen, but just in case.

    Kevin, this means that the check I used to see if a table exists has been removed. If your problem was related to this check, everything should be fine. If not it would be a good idea to check if your Wordpress user on MySQL has the privileges to create tables. I suspect this could be the case.

    The latest version is 0.7. I’m also looking into options for export and import of quotes. This would be great for backup and “trading” of quotes.

  7. Gravatar
    kevin Says:

    I installed ver .70 and am still having the database creation issue. It for some reason doen’t create the table. The account does have permsission to create, but for some reason doesn’t. I have been able to manually create the table and then manually populate it. I did need to change line 69 from “where visible=true” to “where visible=1″ to make the quotes show up in the widget.

    suggestions for a feature:
    random type
    1. random every page load (1,4,3,2) no order
    2. ordered every page load (1,2,3,4)
    3. Change once daily

  8. Gravatar
    kevin Says:

    One more quick question, as I am pretty new to PHP and CSS. How did you make the structure in your sidebar for the quotes with the image on the first line, the quote on the second and the author in the third? I found and change my text color, but the default layout is the image on the left and the text right next to it on the right.

  9. Gravatar
    XmasB Says:

    I haven’t done any formatting to get the layout I have on this page, except centering of the image. Even if I remove the formatting for centering, the image, quote and author is still shown on separate lines. I have included the xmasbquotes.css which contains the classes for styling the layout. For most blogs, the default layout is the one they want. That is why the css is almost empty.

    Thanks for not giving up. I’m not sure why the table couldn’t be created, but glad you managed to fix this manually. I haven’t heard anyone else have this problem, but will test this more.

    I will look into more features when I get the time. Hopefully you have upgraded to Wordpress 2.3 and will see an update when a new version is available. I might implement something tomorrow, but can’t promise anything.

    Btw, do you know version of PHP you are using?

  10. Gravatar
    kevin Says:

    MySQL ver 4.0.25-standard PHP ver 4.4.4 Thanks

  11. Gravatar
    XmasB Says:

    Ok, I was hoping the problem was old software. But that looks just fine. Thanks for checking.

    I’m running MySQL ver 4.1.21 and PHP ver 4.4.7. Although “where visible = true” works for me, I replaced this with “where visible = 1″ just in case. Works for me either way, but now it’s the same as in the table.

  12. Gravatar
    Daniel Says:

    That’s nice — I like that you included an image option to tie-in visually with quotes. Very slick.

  13. Gravatar
    XmasB Says:

    Thanks, Daniel. I have been meaning to include some additional features this week as well, but work is taking all my time.

  14. Gravatar
    Perraco Says:

    Hello, I would like to know how can I use this plugin without using a Widget, I would like to type it straight into my template as this one does not support Widgets.

  15. Gravatar
    XmasB Says:

    You can use this code for inserting a random quote (only where php is supported):

    < ?php if (function_exists('xmasb_random_quote')) {
      xmasb_print_random_quote();
    } ?>

    This only shows the contents of the widget (a random quote and image). Be sure to wrap it with whatever formatting you need.

    I will add a tag to insert quotes into posts and pages in the next update. Using the functions from the plugin directly in Wordpress is not recommended because they can change in updates.

  16. Gravatar
    Perraco Says:

    Hello again, thanks for your solution.
    I wanted to give an idea but I don’t know if its very good, for me would be very useful, would nice to have in the administration page of the plugin a text box for each section: quote, image and label (3 text boxes) and then to be able to type freely on each textbox the CSS formating code for it, if the box is empty a default CSS formatting is used but if we espicify CSS code then this one is used overwriting the default. Like this we don’t need to change the CSS file of the theme and all can be handled from the plugin administration page. Thanks for this great plugin.

  17. Gravatar
    XmasB Says:

    Not a bad idea at all. I will try to include this soon. I think I might include an option to enable/disable advanced options as well.

    Thanks for the feedback, Perraco.

  18. Gravatar
    Perraco Says:

    I’m glad you liked the idea, I hope is not a problem, I thought maybe is better four textboxes for CSS, the fourth would for be the actual entire quote box, like that we can handle the margin, the padding, the background, etc. Thaks again

  19. Gravatar
    XmasB Says:

    Sounds good. I will look into it.

  20. Gravatar
    Merlijn Says:

    I don’t see the option to disable the images on my site, I did it now by deleting the images themselves. When I open the option in the widget itself it only show the name of the quote widget

  21. Gravatar
    XmasB Says:

    I’m sorry. I forgot to update the instructions I think. The options are moved, and should be found under Options - XmasB Quotes. I will update this with a little update I plan on releasing tomorrow.

  22. Gravatar
    Richard Says:

    I installed the plugin and now I am trying to add the widget to the sidebar. I am new to wordpress so how do I add a widget to the side bar? Seems simple but don’t seem to be able to find the answer.

    Richard

  23. Gravatar
    XmasB Says:

    In order to use the Widget you need to have a Widget-enabled Wordpress installation. If you have Wordpress 2.2 or later, widgets are part of the Wordpress core and you should have everything you need. You theme must also be widget enabled.

    Adding a widget to the sidebar is usually really easy. in your Wordpress dashboard, go to Presentation. There you should find a sub menu for Widgets. In this menu you should be able to arrange sidebars according to your current theme.

  24. Gravatar
    Pablo Says:

    This plugin is working good for me. Thanks a lot!

    But I have a question:

    How can I omite the simbols ” ” that envolve the quote? I don´t want them by default !!!

  25. Gravatar
    XmasB Says:

    Thats good to hear, Pablo. The ” ” symbols are there because of the q-tag that envelopes the quote. I will make this optional. I will try to release an update very soon. If you just remove the q-tag from the code, they will disappear. If you don’t want to wait for the release.

  26. Gravatar
    Pablo Says:

    Ok, I´ll wait.

    Ah, and I realise that in the quote edit box I can write html code also. Good for this plugin!

    Congrats.

  27. Gravatar
    XmasB Says:

    Thank you, Pablo. I will try to fix this as soon as possible. Hopefully within a few days. This is not the only request on my list of things-to-do. :)

  28. Gravatar
    Steve Says:

    What an awesome plug. Props to you. I installed it with no problems and it adds a great functionality to my site. Thanks for the good work.

  29. Gravatar
    XmasB Says:

    Thanks Steve.Nice to see the plugin being used. I’m gonna add more functionality and customization options soon. Version 1.0 is not far away.

    I really like the design on your site.

  30. Gravatar
    antis3ptic Says:

    Great plugin. but i think, you must add javascript file on admin pages only, and maybe you can create input like before ” and after ”. It will be better than

  31. Gravatar
    XmasB Says:

    Thanks, antis3ptic. I will add the option to input before and after the quote. I will think about adding the javascript too, but this is not mirst priority.

  32. Gravatar
    PurpleMinded Says:

    Is there a way to implementt this “directly” by manually inserting code into the sideabar.php file instead of through the widget panel? Thanks!

  33. Gravatar
    XmasB Says:

    I have included an option for this. Insert “[XmasBRandomQuote]” (without the ” “) where you want the quote to appear. Please note that is not documented because I haven’t tested it properly. But as they say: It works on my machine. This code should work in posts and sidebar. Title is not included when this is used. It is still in testing and may be altered in future releases.

  34. Gravatar
    PurpleMinded Says:

    XmasB,

    Thanks for the reply. Didn’t do anything other than just display[XmasBRandomQuote] in the sidebar. I’m a WordPress/php newbie… do I literally just paste [XmasBRandomQuote] into the sisdbar.php file with no other syntax of any kind?

  35. Gravatar
    XmasB Says:

    My bad. I was thinking about inserting into post only. That code only works for content going through the wordpress process. Sorry about that.

    To insert a quote in the sidebar.php, use the php function “xmasb_print_random_quote()” where you want the quote to appear. This should give the same result as with the code given above. Title is not included, so you may need to add this as well.

    Most likely I will not change the name of this function, but I may someday. Just a heads up. If I change it, I will write it in the changelog of the plugin. It would be smart to wrap the function in a “function_exists()” function, in case I change it in a future release. That way your wordpress installation won’t crash if the function is not found.

    Thanks for using the plugin.

  36. Gravatar
    PurpleMinded Says:

    OK, that’s much better. That worked. A little more tweaking and I’ll be able to implement this. Thank you!

  37. Gravatar
    Kutsalodun Says:

    Thanks bro for this great plugin

  38. Gravatar
    XmasB Says:

    Thank you for using the plugin, PurpleMinded.

    Thank you, Kutsalodun.

  39. Gravatar
    K Says:

    I’m using this and was wondering if you can make the images to show around the text (to the left or right) rather than on the top.

  40. Gravatar
    XmasB Says:

    I’m planning on adding the option to edit the css directly in the dashobaord. I’m still not sure how I would add this feature. Most likely I will add a choice between simple or advanced settings. Hopefully I will find time to release a new version of the plugin soon.

    For now, you can edit the xmasbquotes.css file if needed.

    Thanks for using my plugin.

  41. Gravatar
    Gianluca Says:

    Brilliant plugin :-) Thanks for your time

  42. Gravatar
    XmasB Says:

    Thank you for using it, GianLuca.

    I wanted to update the plugin with some functions (and fulfill some requests) and new layout, but we have been blessed with a firstborn. Naturally, this have taken up most of my time lately. But an update will be available soon.

  43. Gravatar
    Carolyn Bahm Says:

    Hi, I can use the WordPress interface but don’t understand php, so I don’t know how to edit the “xmasb-quotes/xmasbquotes.php” file in order to insert the actual quotes. Can you give me some newbie step-by-step instructions? Or perhaps you are working on a newbie-friendly interface for entering quotes? Thanks for any additional information.

  44. Gravatar
    XmasB Says:

    Hi Carolyn,
    you insert quotes in the Wordpress dashboard (under Edit - XmasB Quotes). Options for the plugin can be found under Options - XmasB Quotes.

    The best way to use the XmasB Quotes plugin is to use the widget in a widget-ready theme. The theme you are using (Bluebird) support widgets, so you should be able to find the widget for XmasB Quotes under Presentation - Widgets. This is also where you edit the title for the widget.

    You do not need to edit xmasbquotes.php (try to avoid it completely, as your changes will be lost in any future updates).

    Hopefully this helps. I’m going to rewrite this page and the readme file to reflect updated changes and be more easy to understand.

  45. Gravatar
    Dave Silva Says:

    Howdy! I found this plugin useful, but I have some questions…

    If I add the “xmasb_print_random_quote();” code, it works. But if I add it in a if function_exists thing, it doesn’t do anything. Did you change the name of the function?

    Also, is there a way to get this to output nothing but pure text? I want to use this to add random page titles to my site, but I noticed it added a div class statement before and after the random quote I chose, which shows up in the browser title window. I dunno if I made sense. Aheh.

    Thanks, though!

  46. Gravatar
    XmasB Says:

    I have not changed the name of the function. It is still called “xmasb_print_random_quote()”. I am going to rewrite the entire plugin soon, which may involve new names for the functions used. The reason for this decision is to make uses like yours easier to manage. this includes easier options for printing/getting only quotes and easier management of quotes in the dashboard.

    I will include options for outputting quotes in pure text with next version. Along with some other features I’m planning on. Hopefully, I will find time within a week or two.

    Thanks for trying the plugin, Dave.

  47. Gravatar
    Dave Silva Says:

    Well, for some reason Wordpress isn’t recognizing the fact that “xmasb_random_quote” exists. Odd.

    Thanks for your work on this! I’ll just fall back on my old method - a small javascript er, script, for now. :)

  48. Gravatar
    XmasB Says:

    The function “xmasb_random_quote()” does not exist. Try using xmasb_print_random_quote()” instead. But beware that I most likely will change the code for this plugin soon. The names of the functions can change names as well.

  49. Gravatar
    Dave Silva Says:

    I understand. For now I’ve er… edited your plugin a bit to remove the div and after the quote. It’s only for private use, and as soon as you release a newer version of the plugin, I’ll use it and delete my hacks.

    Thanks. :)

  50. Gravatar
    XmasB Says:

    You can do whatever you want with the plugin, Dave. I edit the plugins I download all the time. :)

  51. Gravatar
    Davin Says:

    Hi XmasB,

    Just getting started with the plugin and my site. I was wondering if you’ve encountered a situtation where the plugin text bleeds over the margins of the column (click on my website to see it). Any advice would be appreciated - my layout it widget ready. Thanks for creating such a great tool!

  52. Gravatar
    XmasB Says:

    Hi Davin,

    your stylesheet has the sidebar set to 334px in width. This is more than you need, which causes the text to bleed over the margins on the right. Try setting it to 250px, I think that looks good on your site (I have already tried this using Firebug on your site).

    Also, I think it would look better if you add 12px to the left padding of the classes “xmasb_quotes_quote”, “xmasb_quotes_author” and “xmasb_quotes_link” (or just leave the link out by selecting it away in the options page).

    Here’s a preview of the changes:
    XmasB went overboard on The Perfect Silence

    I might have gone overboard in this. Kinda slow in the office today…

  53. Gravatar
    Davin Says:

    XMasB,

    Thank you so much for the very quick advice! Much appreciated!! I was also going to float the image to have the text wrap around it - seems a little more natural that way. WHen I do this, all the widgets and text in the sidebar keep floating too. Any suggestions for getting just the image to float?

  54. Gravatar
    XmasB Says:

    I believe you could just set “float: left/right” on the class “xmasb_quotes_image”. I think that would work. As you can see on my site, I prefer to have it above and centered.

  55. Gravatar
    Peach Says:

    I really like this plugin. When I started looking for a quotes plugin I was worried I’d have to write my own, but this is exactly what I wanted. Thanks so much!

    Minor bug: in xmasb_quotes_get_quote, the htmlbeforeauthor and htmlafterauthor variables are not used. Instead, you have strong tags hard coded around the author. I’ve had to fix it twice now ;) But it is an easy fix.

    Thanks again for a great plugin!

  56. Gravatar
    XmasB Says:

    Thanks for letting me know, Peach. I will try to fix this as soon as possible. And thanks for using the plugin.

  57. Gravatar
    jerry Says:

    hello i have your nice plugin activated in the side bar, I would like to add a link called “next” that will refresh only the plugin and give another quote,
    i ‘m a little confused, anyhelp would be appreciated…
    thanks

  58. Gravatar
    XmasB Says:

    I have been thinking about that feature, jerry. Today, this is not possible with the current plugin (v 1.1.2). I’m planning to rewrite the plugin to improve the code. I will add several new features when I do this, and also plan on supporting ajax (which lets me do what you request) for smoother visuals.

    I’m way behind in my plans for this plugin, but will hopefully find time to work on it soon. For the time being, a newborn and my work takes up pretty much all of my time. :)

  59. Gravatar
    jerry Says:

    ok then I hope you will get time for this release.
    I will check from time to time.

  60. Gravatar
    XmasB Says:

    Thanks for trying out this plugin, jerry. I will try to find the time.

  61. Gravatar
    sonden Says:

    Hello,

    I just installed your promising plugin but when i try to add a quote in manage/Xmas BQuote it doesn’t show up in the statistics section saying “No quotes found”. Any idea what could be the problem?

    cheers

    sonden

  62. Gravatar
    XmasB Says:

    Hi Sonden,

    the last 5 quotes added should be available in “Edit - XmasB Quotes” in your Wordpress dashboard. If you have added the quote properly it should show up there right after being added. If it’s not there, there is a chance an error has occured.

    If nothing shows up, look for an error when adding the quote. Any errors should appear just below the menuline.

  63. Gravatar
    sonden Says:

    Hello again,
    Thank you for your quick reply!
    I reuploaded and reactivated the plugin and it does exactly the same thing as before. When adding and saving a new quote they are not showing up - neither in the dashboard nor in the statistics section. There is also no error message.

    Is it maybe the version of wordpress i am using (2.3.3) that is incompatible?

    Best Regards

    sonden

  64. Gravatar
    XmasB Says:

    This sounds strange. Do you get the message saying the quote has been added?

    I’m using Wordpress 2.3.3 as well without any problems.

  65. Gravatar
    Stephanie Says:

    I just installed the newest version on WordPress 2.5 and am seeing the same thing as sonden. There is no message saying the quote has been added, and there is no error message. I checked my database — the xmasb_quotes table has been added, but is empty even though I’ve added half a dozen quotes.

  66. Gravatar
    Stephanie Says:

    I just noticed that the table is named ‘xmasb_quotes’ — that is, it isn’t using the prefix, even though I see that according to your code, it should be.

  67. Gravatar
    XmasB Says:

    Thanks for letting me know, Stephanie.

    I have tested against my testblog that I have upgraded to Wordpress 2.5. Everything works fine there. I suspect that the problem occurs when creating the table for the plugin, but I have not yet tested this. I will look into this as soon as I can. I will email you when I find an answer, as well as post a comment here.

  68. Gravatar
    XmasB Says:

    Found a bug introduced with Wordpress 2.5 that caused the prefix to be dropped when creating the table. It has been fixed. I have tested and everything works fine.

  69. Gravatar
    Stephanie Says:

    Thanks! Deactivated, reactivated, and now it’s working.

  70. Gravatar
    XmasB Says:

    Good to hear, Stephanie.

    Thanks for pointing out the errors for me. I will be sure to tribute you on my page for this plugin.

  71. Gravatar
    Don Says:

    My database was not created. I went into phpMyAdmin and tried to create the table manually. Got the following error message “#1101 - BLOB column ‘author’ can’t have a default value”. TINYTEXT is a type of TEXT column, which is a type of BLOB. They cannot have default values. http://dev.mysql.com/doc/refman/4.1/en/blob.html

    This is probably why the database doesn’t get created. The easiest way to “fix” this is to just get rid of the DEFAULT clause of the SQL create statement since the PHP code already makes sure that spaces ‘ ‘ are put into those fields if they weren’t specified in the management form.

  72. Gravatar
    XmasB Says:

    Thanks Don. I have not heard any reports of this being a problem before, but the documentation on mysql is clear. You are probably not te first one experiencing this. I have removed the default value for the table in version 1.1.6.

  73. Gravatar
    Rick Says:

    Using 1.1.6 and wodrpress 2.5

    It shows no quotes found on activation. When I add one, it accepts it, but still shows no quotes found.

  74. Gravatar
    XmasB Says:

    Thanks for letting me know, Rick. Could you please tell me what version of PHP and MySQL you are using as well? I will look into this as soon as I can.

  75. Gravatar
    Rick Says:

    Operating system Linux
    Service Status Click to View
    Kernel version 2.4.21-32.ELsmp
    Machine Type i686
    Apache version 2.0.63
    PHP version 5.2.5
    MySQL version 4.0.27-standard

  76. Gravatar
    XmasB Says:

    Shouldn’t be a problem as far as I can see there. I will look more into this tomorrow. So far you are the only one reporting this problem, but that doesn’t mean that there is no bug. Nobody’s perfect. :)

    Have you checked if the table has been created correctly? The name of the table should follow your default settings, typically starting with “wp_”. If that is the case, the table should be called “wp_xmasb_quotes”. See if the name is similar to your other tables from Wordpress.

  77. Gravatar
    baron Says:

    hi there .thanks for plugin:

    Does anybody know if tis script is compatible with Wordpress 2.5.1 ?

    Thanks in advance for any help on this!

    best regards

  78. Gravatar
    XmasB Says:

    Hi baron,

    I use the plugin on this site (powered by WordPress 2.5.1). It is compatible with this version.

Leave a Reply