Description
This plugin provides the ability to have randomly selected quotes displayed on the admin page, by using a shortcode or by using a sidebar widget. The quotes include user-entered quotes, and can optionally include excerpts from a user-chosen category and can also optionally include links from a user-chosen links category There also is an option for including the lyrics from “Hello Dolly”. The plugin can be used for random quotes, rotating testimonials, rotating random affiliate links, or random featured posts. It was inspired by the Hello Dolly plugin (hello.php) that comes bundled with WordPress.
Screenshots
Demo
Here is a demo of quotes in an unordered list. Refreshing the page will randomize the quotes.
- You’re still goin’ strong
- You either die a hero or you live long enough to see yourself become the villain.
Harvey Dent — Batman: The Dark Knight - I’m Luke Skywalker, I’m here to rescue you.
- Transform and Rollout
- Well, hello, Dolly
- You are master of all you survey. Ursa (Superman II)
So I was yesterday. And the day before. General Zod (Superman II)
Download
Click here to download nice-quotes.zip.
Licensing
The Nice Quotes Rotator free WordPress plugin is licensed under the GNU Public License v2.0 (GPL2). You are free to use and modify the plugin as you see fit.
Changelog
- 0.1 – Initial public release (2010-10-11)
- 0.2 – fixed the shortcode to match the documentation (now both [ nicequote] and [ nice-quote] work. It is recommended that you use the one without the dash.
- 0.3 – Added two attributes to the shortcode. tagoverride which overrides whichever option is set in the options page for which HTML tag to use. This is useful for changing the tag when something should be inline or block. additionalclasses is used for adding additional CSS classes to the nicequote. See This page for a listing of built-in WordPress classes, for reference.
- 0.4 – Fixed an error caused in the last update.
Donate
Coders love caffeine — and I’m no exception
If you like my free plugins, feel free to donate. Doing so allows me to continue work on this and other great WordPress plugins, themes, etc.


The documentation tells us that the shortcode to use is “[nicequote]” but it seems that it actually needs to be “[nice-quote]”
Thanks for the plugin!
Eric,
I appreciate the comment and have updated the code to a newer version that can use [nicequote] as noted in the documentation.
I also replied to your Thread on the WordPress forum.
Thanks again for the bug report, and comment.
It doesn’t work on my site when I update it to new version.
Sorry, there was a minor error in the code; the newest build (0.4) now works.
Thanks for the error report, I appreciate it.
I need the [nicequote] working in a Widget of Text, and not only in the actual Nice Quotes widget.
Is it possible?
Can the shortcode
[nicequote]work in a text widget? Anyplace you can use a shortcode you can use the[nicequote]shortcode.Are you trying to use it in the default text widget that comes with WordPress or something else?
The default text widget (found in
wp-includes/default-widgets.php) that comes with WordPress is run through the ‘widget_text’ filter.PS. I was looking again through the docs for the do_shortcode function and it suggests:
// Use shortcodes in text widgets.add_filter('widget_text', 'do_shortcode');
You can use the code from the docs if it is a time-sensitive thing; I have started working on a new plugin to enable shortcode parsing in text widgets along with converting smilies. It will be available as soon as I have the documents (readme files etc) written up and get the svn directory from WordPress.org.
Javi, I created a plugin to allow shortcodes and smilies in the Default text widget called ‘Allow Shortcodes in Text Widgets’. You can either download it from this website or download it from the WordPress.org plugin repository.
Any plans to include a template function? Shortcodes are kinda hard to use in header.php for display of quotes next to the site title =)
Björn, I don’t have any plans currently to add a template function, but you can call use either the convert_shortcode function or use the return_nice_quotes function.
There are several ways you can include the quote-rotator in php.
Firstly, WordPress has a function that converts all shortcodes to the output from the shortcode’s handler(s):
You can also pass the attributes in the shortcode:
Second, you can call the function
return_nice_quotesused to create the shortcode in php. You may want to use to call it in a if function_exists( ) condition so that if you ever decide to disable the plugin, it won’t bring down your site by attempting to call a non-existent function.Thirdly, you can do the same as above but pass in the same arguments that you could with the nicequote shortcode:
I just re-read you question, if you are trying to get a quote to appear and are not trying to have a HTML object you can call the
nice_quotes_get_quotefunction.About php code in the theme fiels.
I put
echo do_shortcode(‘[nicequote]‘);
or
if (function_exists(‘return_nice_quotes’)) {
echo return_nice_quotes();
}
into the theme.
they just show these words, not the nice quotes.
Hunter, You need to pass the code through the PHP interpreter, by wrapping the code in
<?phpand?>.If what you are trying to do is the same as what Björn is trying to do by putting it in a <title> tag:
Great plugin! Although even having quite a lot of quotes to display, some times it doesn’t display anything, just an empty ‘widget’ box.
Any ideas or suggestions?
Thanks!
Modcorrupt, the most obvious thing that comes to mind is to check and make sure that you don’t have an empty line in your custom quotes.
Also, if you have the option for for post excerpts to be included from a category, make sure none of the excerpts have a non-breakable space in them. When you view the source of the page what do you get?
It is possible that it may be a SQL problem or that I missed something.
No empty lines, but this is how I have it in the options:
“Experience hath shewn, that even under the best forms of government those entrusted with power have, in time, and by slow operations, perverted it into tyranny.” – Thomas Jefferson
“For a people who are free, and who mean to remain so, a well-organized and armed militia is their best security.” – Thomas Jefferson
Etc. Shall I take out the breaks and just have an empty line between quotes? Or is this okay?
Thanks!
Sorry, the break tag didn’t show up between the quotes on this page. So I have between them. Hopefully this one shows up.
Anyhow, I have the break tag in between all the quotes.
Ok, never mind. My bad. I took out all the breaks and it’s working perfectly now. Had a ‘brainfart’ moment there and didn’t quite get it. It was pretty late at night when I installed it and started adding quotes. Heh.
Cheers & Thanks again. Great plugin!
Modcorrupt, I am glad you got it working.
For reference, the plugin calls the explode function in PHP to populate the array on the newline (/n) character. Each carriage return should be a new quote.
It appears that the .niceQuote functionality does not work style the results of the Widget? Is there anyway to style the output of the widget?
Thanks
Which functionality isn’t working?
The niceQuote has a style attribute of niceQuote; To style all niceQuotes, you could use:
.niceQuote {
// css stuff here.
}
To do only the stuff in the sidebar use, most blogs would use:
#sidebar .niceQuote {
// css stuff here.
}
Keep in mind that inline level elements and block level elements behave differently.
Changing the way quotes are nested in the widgets is now on my list of things to do. The widget will probably take a space-delineated list of tags, instead of the ordered-lists.
Hi.
I am trying to get this working on my site. I have it in the sidebar, and I can get it to display the quotes directly added to the settings page. But I cant get it to show the quotes from a posts category even though I have “A random post excerpt” selected in the what to show, and my category selected in the “Excerpts from the following category…”
Any idea what I have missed or why its not working?
I am using WordPress 3.0.1.
I have a random quote show up, but sometimes, it doesn’t show anything. I refresh and eventually it will show a quote. And there is no rotation at all. What do I need to do to get the rotation?
Okay, I figured out why I was getting the blank quotes, but still can’t get it to rotate. Help would be appreciated.
You aren’t caching the page either server-side or locally are you?
Try command/control – shift – r.
Hi, just wondering if you have an update regarding Matt’s comment about styles when used in a widget on sidebar? I can’t seem to get my css working. I now see that the quotes take on the order list style. So my issue is that I want my ordered lists to be indented 20px, however I do not want my quotes to be indented at all.
Can you assist? I’m getting frustrated with figuring out the CSS.
THANKS!
The widget should have a class of widget_nqwidget. If you want to only change the lists in the nice-quote widgets you would have a rule similar to:
.widget_nqwidget ul {
margin:0px;
}
If you are using Firefox, Firebug and Web Developer toolbar work wonders and are very useful. I’m sure other browsers have other tools that may be similar.
This is a neat plugin, thanks!