Quote of the day plugin



The Quote Of The Day plug-in manages quotes displayed on your WordPress or WordPressµ blog. Unlike other QOTD plug-ins that link to external web sites, the Quote Of The Day plug-in stores quotes, and related references, in your WordPress database. In addition, this plug-in conforms with the HTML 4.01 specification regarding <blockquote> and <q> tags.

Overview

There are three elements of a quote, the author, the citation, and the quotation itself. The cd-qotd plug-in administrative page allows you to manage these three elements. You may also select whether a quote is displayed using the <blockquote> or <q> (inline quote) tags, as well as, the frequency at which different quotes are displayed. Specifically, you can select to have a random quote displayed with each new page (page refresh), each hour, or each day.

Note: You can see the cd-qotd in use on this site at the bottom of the right-hand sidebar.

There are a couple of topics I want to address here. One is the proper use of the CITE attribute. The other is selecting a BLOCKQUOTE or Q (inline) quotation type. The cd-qotd plug-in allows you select either of these tags for use within your site. Your use of these elements should conform to your style guide.

The CITE attribute was designed to provide a reference to the source of the quotation. Here is the definition taken from the w3c specification.

The value of this attribute is a URI that designates a source document or message. This attribute is intended to give information about the source from which the quotation was borrowed.

Take a look at the source of this page to view the CITE attribute. As an example referencing this web site, you may elect to use a generic style, such as:
cite="Coyotes Designs. Available at: http://coyotesdesigns.com/quote-of-the-day-plugin/. 03 March 2010".


Whether you select to use either the BLOCKQUOTE or Q tag depends on the type of quotation you want to display. The intent of these tags is to cover a block-level quotation or an inline quotation, respectively. I did not code any restrictions into the cd-qotd plug-in on which tag you select. That means you can use the inline quote tag for block-level quotations.

One very important piece of information regarding the use of the inline Q tag, is whether to use quotation marks to enclose your quotation. According to the specification, quotation marks are automatically inserted by the user agent.

Visual user agents must ensure that the content of the Q element is rendered with delimiting quotation marks. Authors should not put quotation marks at the beginning and end of the content of a Q element.

Installation

The cd-qotd plug-in is installed as any other plug-in.

  1. Download the cd-qotd plug-in to your local machine.
  2. Extract the files retaining the folder structure.
  3. FTP the cd-ad-sponsor files to your WP Plugins directory. (Single and MU versions)
  4. Activate the plug-in through the 'Plugins' menu in WordPress.

You may also use the upload feature in your WordPress Plugin management page to upload the zip file and install the plug-in.

Management Page

Manage Quote Of The Day Management Page

Fig-1 Management Page

When you activate the cd-qotd plug-in, you will see the CD QOTD menu option in your Settings menu. Activation also creates the cd_qotd database table in your WordPress database, and inserts a single default quotation. This table contains all data associated with the quotations you want displayed on your site. Additional information, such as the frequency that quotes are displayed, is inserted into the options table.

Selecting the CD QOTD menu option displays the cd-qotd Management page. This page lists all currently defined quotes within the database, sorted alphabetically by author name. You may delete any unwanted quotes. The plug-in will check to see whether the quote you want to delete is currently scheduled to display. If it is, it will not be deleted. This is a temporary issue, based on the frequency you selected. Once another quote has been registered to display, you can delete the original quote.


There are also two options available, an option to add a new quotation, and the option to define the settings. I will discuss each of these options in the following sections.

Add Quote Page

Manage Quote Of The Day Add Quote Page

Fig-2 Add Quote Page

The Add Quote page displays the data fields necessary to define a quotation. These data fields are defined as follows.

Author Name
This field is where you enter the name of the author of this quotation. This field is required.
Citation
This field is where you enter the printed or URI reference for this quotation. Print references may include ISBN nomenclature, publication titles, etc. This field is optional, although highly recommended.
Quote
This field is where you enter the actual quotation that you want to present. When entering quotations, do not include quotation marks. This field is required.

TIP: I have received emails asking about embedding links within a quotation, and also about wrapping the author name within a link. The answer is, Yes. You can add normal anchor tags to both the author name and quotation fields. These links will be displayed in the quote of the day.

Settings Page

Manage Quote Of The Day Settings Page

Fig-3 Settings Page

The Settings page displays the options to define the presentation of a quotation, and allows you to import a CSV file. These data fields are defined as follows.

Display Type
This data field allows you to select either the BLOCKQUOTE or Q tag in which to display the quotations.
Display Frequency
This data field allows you to select the frequency in which to rotate through the defined quotations. You may select to have a new quotation displayed with each new page, at the top of the hour, or for each new day.
Import Quotes
This is a CSV file in the following format: "Author","Citation","Quotation". Do not include the field names as the first row. Quotes are imported for the current blog, if you are using multi-site.

Modifying Your Theme

Example Quote Of The Day Presentation

Fig-4 Example QOTD

You may be wondering why this plug-in wasn't designed as a widget. Well, two reasons. First, I didn't want to relegate the cd-qotd plug-in to only the sidebar, and two, well, see the first reason. :)


[edit]The QOTD plug-in was upgraded to function as a widget in release 1.1.0.[/edit]

In order to display your quotations you need to add the cd_qotd_quote() function within your desired theme file. For example, you can include the function call within your sidebar.php file as demonstrated on my site. (See the sidebar for an example.)

Note: The cd-qotd plug-in displays your quotations in your blog theme as styled by your definitions in the /css/cd-qotd.css file. I recommend that you at least re-define the BLOCKQUOTE element definition so that the quotation is displayed differently than other block quotes on your web site. You may elect to display your quotation across the top portion of your blog page, in which case, you would add the cd_qotd_quote() function to your header.php file. This, of course, depends on the structure of your theme files.

The syntax is:

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

No arguments are passed. This is simply a function call that outputs a random quotation in the style you define.

If you intend to display the QOTD in the sidebar or main body of a page, you will need to copy the existing block segment HTML tags that your theme uses to display the desired format, and insert them where you want the QOTD to appear. You then insert the cd_qotd_quote function inside the content area of that block. You can see an example of the block of HTML tags used by this theme by viewing the page source. Your theme will be different, so I cannot offer a tailored example. I will, however, be more than happy to assist you if you so desire. Feel free to contact me on Skype.

Conclusion

I hope that you find this plug-in beneficial to you as it has been for me. Please feel free to comment or make suggestions for future enhancements.



28 Responses to “Quote of the day plugin”

  • mh says:

    Fantastic! Thanks chap.

  • Coyote says:

    I released an update to the plug-in. It should show up in your plugins menu. Let me know if that is what you wanted.
    ~Coyote

  • mh says:

    Looking great! Thanks for the speedy turnaround.

    Unrelated question: Is there any way to make the citation a link if you plug a URI into it?

    Best,
    -m.

  • Coyote says:

    A 'citation' is an attribute, and therefore, not a user-agent rendered element. So, No. You can, however, insert links within the quotation or wrap the author in the anchor tag. See http://coyotesdesigns.com/quote-of-the-day-plugin/ for more information.

    ~Coyote

  • fazer says:

    How can I import quotes with commas in the phrase ? Could you type an example of the csv file ? Thanks in advance !

  • Coyote says:

    Hi fazer,

    Including commas within the data fields functions correctly during the import process. If, however, you experience any problems, you could prefix any commas with the backslash (\) character, which acts as the default escape character.

    Please let me know if you have any further questions.

    ~Coyote

  • David says:

    Hi,

    I've installed Quote of the Day, and I also using the Super Popup plugin to create a popup quote when someone arrives at a site. I created a page with a custom template which only calls up your function code listed above. The popup plugin calls up only that page which calls up a quote. It works.

    But I'm having a challenge styling it. My custom page template only has the template id and the function. My custom template does not call up a regular site page, but just the quote. I've tried editing your css file, and even tried adding css styling on my style sheet, and I just cannot seem to get the quotes to be other than basic Times.

    Is there some basic div that I need to "wrap" the function in so that it grabs some of the css from your or my css style sheet. I'd appreciate a little advice.

    Great plugin. My wife thanks you for a simple interface to add quotes.

    Can you give me some advice as to what I'd

  • Coyote says:

    Hi David,

    I am not familiar with your plug-in combinations, so I would need to see what is going on before I can offer any suggestions. Please e-mail me your site url, or post it here, and I will have a look.

    Thanks for the comments. Thank your wife too. :)

    ~Coyote

Leave a Reply

You must be logged in to post a comment.


Advertisement

Popular Posts

Quote of the day plugin

The Quote Of The Day plug-in manages quotes displayed on your WordPress or WordPressµ

Sponsor Ad Management User Guide

The cd_ad_sponsor plug-in was written to manage the sponsor ads that can be presented with

A WordPress Sponsor Ad Management Plug-In

I wrote the WordPress Sponsor Ad Management Plug-in to use within the WordPress and WordPr

Quote Of The Day
An ecstasy is a thing that will not go into words; it feels like music, and one cannot tell about music so that another person can get the feeling of it.
~Mark Twain