Quotes Collection

Quotes Collection plugin for WordPress helps you collect, manage and display your favourite quotes in your WordPress blog or website.


Features Overview

  • Admin interface: A robust admin interface to add, edit, import, export and generally manage the collection of quotes.
  • Sidebar widget: A random quote from your collection can be displayed in any widget area using the ‘Random Quote’ widget. Includes options to refresh the quote displayed in the widget manually or automatically, randomly or sequentially.
  • Gutenberg blocks: The plugin includes two blocks that can be added in pages and posts.
    1. ‘Quotes’ block to display all the quotes or a set of quotes, with presentation, filtering, paging and other options.
    2. ‘Random Quote’ block that functions similarly to the Random Quote widget, with additional presentation options.
  • Shortcode: All quotes or a set of quotes can be displayed on a WordPress page by placing a [quotcoll] shortcode. Scroll down for the usage instructions, examples and the full list of arguments.
  • The template function: To code the random quote functionality directly into a template file, the template function quotescollection_quote() can be used. Scroll down for details.

The plugin is similar, and uses ideas from (though not based on) the old wp quotes plugin by Dustin Barnes.


Click on the thumbnail for the larger image.

The quotcoll Shortcode

Quotes can be displayed in a page by placing the shortcode [quotcoll]. This will display all the public quotes ordered by the quote id.

Note that version 2.5 of the plugin comes with Gutenberg blocks, that can serve the same purpose as the shortcode, in a much more elegant manner. Moreover, if you have been using the ‘quotcoll’ shortcode, you can convert it into the ‘Quotes’ Gutenberg block with a single click. So, if you are using the block editor interface that comes with WordPress 5.0 and above, it’s recommended that you use the blocks instead of the shortcode.

If you still want to stick to the shortcode, here’s the list of attributes:

  • id (integer)
    • For example, [quotcoll id=3] displays a single quote, the id of which is 3. If there is no quote with the id 3, nothing is displayed.
    • This overrides all other attributes. That is, if id attribute is specified, any other attribute specified is ignored.
  • author (string)
    • [quotcoll author="Somebody"] displays all quotes authored by ‘Somebody’.
  • source (string)
    • [quotcoll source="Something"] displays all quotes from the source ‘Something’.
  • tags (string, comma separated)
    • [quotcoll tags="tag1"] displays all quotes tagged ‘tag1’.
    • [quotcoll tags="tag1, tag2, tag3"] displays quotes tagged ‘tag1’ or ‘tag2’ or ‘tag3’, one or more or all of these.
    • [quotcoll author="Somebody" tags="tag1"] displays quotes authored by ‘Somebody’ AND tagged ‘tag1’.
  • orderby (string)
    • When multiple quotes are displayed, the quotes or ordered based on this value. The value can be either of these:
      • ‘quote_id’ (default)
      • ‘author’
      • ‘source’
      • ‘time_added’
      • ‘random’
  • order (string)
    • The value can be either ‘ASC’ (default) or ‘DESC’, for ascending and descending order respectively.
    • For example, [quotcoll orderby="time_added" order="DESC"] will display all the quotes in the order of date added, latest first and the earliest last.
  • paging (boolean)
    • The values can be:
      • false (or 0) (default)
      • true (or 1) — introduces paging. This is used in conjunction with limit_per_page (see below).
    • For example, [quotcoll paging=true limit_per_page=30] will introduce paging with maximum of 30 quotes per page.
    • Note: if orderby="random" is used, paging is ignored.
  • limit_per_page (integer)
    • The maximum number of quotes to be displayed in a page when paging is introduced, as described above.
    • The defualt value is 10. For example, [quotcoll paging=true]will introduce paging with maximum of 10 quotes per page.
  • limit (integer)
    • The maximum number of quotes to be displayed in a single page ie., when paging is ‘false’.
    • This can be used, for example, to display just a random quote. [quotcoll orderby="random" limit=1]
  • show_author (boolean)
    • The values can be true (or 1) (default) to display the author, or false (or 0) to hide the author.
  • show_source (boolean)
    • The values can be true (or 1) (default) to display the source, or false (or 0) to hide the source.
  • ajax_refresh (boolean)
    • When set to true (or 1), a single quote will be displayed. By default, a random quote will be displayed and will be automatically refreshed every 5 seconds.
  • auto_refresh (boolean)
    • Ignored when ajax_refresh is not set to true.
    • The values can be true (or 1) (default), to refresh the quote automatically, or false (or 0) to enable manual refresh.
    • For example, [quotcoll ajax_refresh=true auto_refresh=false] will display a ‘Next quote’ link to refresh the quote manually.
  • refresh_interval (integer)
    • Ignored when ajax_refresh not set true, or auto_refresh is set to false.
    • For example, [quotcoll ajax_refresh=true refresh_interval=10] will display a random quote that will refresh every 10 seconds.
  • random (boolean)
    • Ignored when ajax_refresh is not set to true.
    • The values can be true (or 1) (default), to rotate the quotes in a random order, or false (or 0) to rotate in a sequential order, the order of sequence will be determined by the order_by and order attributes.
    • For example, [quotcoll ajax_refresh=true random=false order_by=time_added order=DESC] will refresh the quotes in a sequential manner with the latest added quoted first, and automatically every 5 seconds.
  • char_limit (integer)
    • Ignored when ajax_refresh is not set to true.
    • Default value is 500, meaning quotes with total number of characters (including white spaces) greater than 500 will not be displayed. A value of 0 implies no limit.

The quotescollection_quote() template function

The quotescollection_quote() template function can be used to display a random quote in places other than sidebar.

Usage: <?php quotescollection_quote($arguments); ?>

The list of parameters (arguments) that can be passed on to this function:

  • show_author (boolean)
    • To show/hide the author name
      • true – shows the author name (default)
      • false – hides the author name
  • show_source (boolean)
    • To show/hide the source field
      • true – shows the source
      • false – hides the source (default)
  • ajax_refresh (boolean)
    • To show/hide the ‘Next quote’ refresh link
      • true – shows the refresh link (default)
      • false – hides the hides the refresh link
  • random (boolean)
    • Refresh the quote in random or sequential order
      • true – random refresh (default)
      • false – sequential, with the latest quote first
  • auto_refresh (boolean/integer)
    • To refresh the quote automatically
      • true – auto refresh every 5 seconds
      • false – auto refresh is off (default)
      • integer – auto refresh is on, and the number provided will be the refresh interval, in seconds.
        • For example, <?php quotescollection_quote( array( 'auto_refresh' => 3 ) ); ?> will refresh the quote every 3 seconds.
  • tags (string)
    • Comma separated list of tags. Only quotes with one or more of these tags will be shown.
  • char_limit (integer)
    • Quotes with number of characters more than this value will be filtered out. This is useful if you don’t want to display long quotes using this function. The default value is 500.
  • echo (boolean)
    • To echo or return the quote
      • true – the quote is echoed, ie., printed out
      • false – the quote block is returned as a string, the user can catch the string in a variable and output it wherever they please.

Example usage:

  • <?php quotescollection_quote(); ?>
    • Uses the default values for the parameters. Shows author, hides source, shows the ‘Next quote’ link, no tags filtering, no character limit, displays the quote.
  • <?php quotescollection_quote( array( 'show_author' => false, 'show_source' => true, 'tags' => 'fun,fav' ) ); ?>
    • Hides author, shows source, only quotes tagged with ‘fun’ or ‘fav’ or both are shown. ‘Next quote’ link is shown (default) and no character limit (default).
  • <?php quotescollection_quote( array( 'ajax_refresh' => false, 'char_limit' => 300 ) ); ?>
    • The ‘Next quote’ link is not shown, quotes with number of characters greater that 300 are left out.

Download the Plugin

The latest stable version of the plugin can be downloaded from the WordPress plugin repository. (changelog)

Development can be followed at GitHub.

Released for free under the GPL.