wp-quote02

WordPress Quotes

 

Project Description Project Description:

Just a simple project that prints random quotes anywhere on a wordpress page. Essentially it is just a custom post type that includes the quote and the author. A single function call returns the random quote which can then be displayed wherever you like on your pages. Requires at least version 3.0 of WordPress since I think that is when the custom post types were implemented.

To use the plugin just add the quotes using the WordPress admin interface on your site. Then to get the quotes to display on the site, call:

quote_display_random()

to display an default styled quote or the quote_random() function which will return an associative array with both the content and author in it like this:

$quote = quote_random();
echo $quote["title"];       //the quote title (if you choose to display this)
echo $quote["content"];  //this is the quote itself
echo $quote["author"];    //this is the author
echo $quote["date"];      //this is the qutoe date

The reason why this format was chosen, was to create the most flexibility for use in a template. It is easy to stick these inside of a div or apply css styling to it.

Update: Many people have asked questions about where to put the above code in their templates. If you would like the code to show up in your header, look for a header.php file in your template source. Next look for a section with something like this:

<?php bloginfo('name'); ?>

Usually you can insert it somewhere near this to get it into your header.

Alternatively, if your theme / template uses widgets, the simple quotes plugin also supports this, so you can add random quotes even easier for those without much experience working with php / html / css.

Here is the plugin page on the wordpress plugin repository: http://wordpress.org/extend/plugins/simple-quotes/

Project Todo List Project Todo List:

  • Make the widget look more customizable
  • Add more optional fields
  • Add the ability to get the next quote via Ajax or with a link (as suggested in comments)
 

Project Languages Project Languages:

php

Project Started Project Started:

February 21, 2011

Project Started Project Modified:

June 16, 2011

 

Source Code Browse Source:

Here you can browse the source available for the project. Note, if your web browser does not support javascript, the code will open in a new window. You can download the entire source using the .tar.gz file in the listing below.

  • Project Folder simple-quotes
  • screenshot-2.png screenshot-2.png
  • index.php index.php
  • quote.png quote.png
  • author.png author.png
  • screenshot-4.png screenshot-4.png
  • readme.txt readme.txt
  • align.png align.png
  • screenshot-3.png screenshot-3.png
  • calendar.png calendar.png
  • screenshot-1.png screenshot-1.png
[ Top ]
 

Project Screenshot Project Screenshots:

wp-quote02
wp-quote01
wp-quote