Plugin Directory

Test out the new Plugin Directory and let us know what you think.
!This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Fortunate Random Quotes

Fortunate provides a random quote or quotation (also known as a 'fortune cookie') for your blog.

Where should I display the quotations?

This is entirely up to you, however some page locations may interact in a negative way with your theme. The safest place to display is in a sidebar widget and should work with any widget enabled theme.

The default location is at the end of the main loop, which should place the fortune at the bottom of the content region in your pages.

If you use the header, the fortune will display beneath your blog description, assuming your theme provides the blog description. When using the header location, you should probably choose 1 or 2 as 'Maximum number of text lines' in the options to avoid messing up your banner with long quotations.

You may also use the page footer, but be aware that many themes place the footer content outside the themed region.

In some cases you may need to change CSS definitions to fit the results into your chosen theme. Copy the supplied 'fortunate-template.css' file to 'fortunate.css' and edit to your liking. Then visit the options page and tick the box to include the CSS file.

Why don't I see any quotations?

It is quite possible to provide search parameters which do not match any quotations at all. Fortunate does not provide any error messages when there are no matching results. Check your settings to see if you may be too specific through use of a search term or quotation size. Fortunate works best without any specific search limitations. Also be aware that the adult/offensive ratings are currently only valid for English, Spanish, and Italian. For all other languages please use 'normal (no adult/offensive content)'.

It is also possible to set the timeout settings too low to respond in a reasonable time. The default is 5 seconds, which should work for any but the most remote regions of the planet.

Advanced usage

You may call the fortunate_fetch() function directly from your page templates to provide more than one quote on a page and with complete control of options and theming.



      echo '<div class="myownfortunate">' 
      . fortunate_fetch(array('lang' => 'fr', 'numlines' => 2)) 
      . '</div>' ;

This will produce a French quote of two lines (max) and allow you to theme it using CSS as a different class than the standard quotation theme (which would correspond to class="fortunate").


      echo '<div class="fortunate">' 
      . fortunate_fetch(array('db' => 'bush')) 
      . '</div>' ;

This will provide a quote from George Bush. Please note that this database is only valid for the English language (which is the default).


      echo '<div class="fortunate">' 
      . fortunate_fetch(array('lang' => 'en',
                                  'type' => 'o', 
                                  'db' => 'sex')) 
      . '</div>' ;

This will provide an offensive quote from the English 'sex' database.

The options array is entirely optional, and will use standard defaults for any setting not supplied.

It may consist of any of the following:

  • System settings:

  • 'root' => string - location of WPINC directory

  • 'home' => string - Referral URL [your website URL]
  • 'read_timeout' => integer - number of seconds, default 5
  • 'conn_timeout' => float - number of seconds, default 5

  • Quotation settings:

  • 'lang' => 'en','es','it','fr','de','ru' - default is 'en'

  • 'type' => '' (Normal - default), 'o' (Offensive), 'a' (Any)
  • 'length' => integer - maximum length of quotation - default unlimited (0)
  • 'numlines' => integer - maximum number of lines - default unlimited (0)
  • 'pattern' => string - return quotations containing this word - default ''
  • 'regex' => string - return quotations matching this (MySQL) regular expression - default ''
  • 'equal' => integer - provide equal weight to all data sources. 0 or 1, default 0
  • 'db' => string - name of a specific database to pull quotes from - default ''

Requires: 2.7 or higher
Compatible up to: 2.8.4
Last Updated: 8 years ago
Active Installs: 30+


0 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.