Plugin Directory

Changeset 355766


Ignore:
Timestamp:
03/05/2011 04:05:05 PM (15 years ago)
Author:
jernst
Message:

added the date field and the quote_display_random function

Location:
simple-quotes
Files:
2 added
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • simple-quotes/tags/1.02/index.php

    r355576 r355766  
    44 * Plugin URI: http://www.jasonernst.com/projects/quotes/
    55 * Description: Creates a custom post type for quotes which will show up in the administrative interface within wordpress. The quotes are then return randomly in an associative array using the function 'quote_random()'. Extremely simple plugin takes only a quote and the quote author. Note: The author icon is taken from the famfamfam icon pack (http://www.famfamfam.com/)
    6  * Version: 1.01
     6 * Version: 1.02
    77 * Author: Jason B. Ernst
    88 * Author URI: http://www.jasonernst.com/
     
    8585function quote_addfields()
    8686{
    87     add_meta_box('quote-author-meta','Quote Author','quote_author_meta','quote','normal','high');
    88     do_meta_boxes('quote-author-meta','normal',null);
     87    add_meta_box('quote-meta','Quote Information','quote_meta','quote','normal','high');
     88    do_meta_boxes('quote-meta','normal',null);
    8989}
    9090
     
    9292 * Adds the html to the admin page for the quote author
    9393 */
    94 function quote_author_meta()
     94function quote_meta()
    9595{
    9696    //used to get to the plugin folder
     
    9898    global $post;
    9999    $quote_author = get_post_meta($post->ID, 'quote_author', true);
     100    $quote_date = get_post_meta($post->ID, 'quote_date', true);
     101   
    100102    //create a nonce for security
    101103    echo '<input type="hidden" name="quote_noncename" id="quote_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
     
    105107                <label for="quote_author"><img src="<?=$base?>/author.png" alt="Quote Author"/> Quote Author: </label>
    106108                <input type="text" name="quote_author" tabindex="3" style="width: 100%;" value="<?=$quote_author?>"/>
    107                 <p>The quote author is the original author of the quote, and does not have to be a blog author.</p>
     109               
     110                <div style="margin-bottom:10px;">&nbsp;</div>
     111               
     112                <label for="quote_date"><img src="<?=$base?>/calendar.png" alt="Quote Date"/> Quote Date: </label>
     113                <input type="text" name="quote_date" tabindex="3" style="width: 100%;" value="<?=$quote_date?>"/>
     114                <p>All of the fields here except the quote itself is optional, you may use as much of the information in your template as you wish.</p>
    108115            </div> <!-- /form-field -->
    109116        </div> <!-- /inside -->
     
    134141 * quote["content"] is the quote itself
    135142 * quote["author"] is the author
     143 * quote["date"] is the date of the quote
    136144 */
    137145function quote_random()
     
    144152        $quote["content"] = the_title("", "", false);
    145153        $quote["author"] = get_post_meta($post->ID, 'quote_author', true );
     154        $quote["date"] = get_post_meta($post->ID, 'quote_date', true );
    146155        wp_reset_query();
    147156        return $quote;
    148157    }
    149158}
    150  ?>
     159
     160/*
     161 * Outputs a styled quote using the default style
     162 * Use quote_random() if you would like to style the
     163 * quote yourself
     164 */
     165function quote_display_random()
     166{
     167    $quote = quote_random();
     168    ?>
     169    <div class="quote"><em><?=$quote['content']?></em>
     170        <div style='text-align:right;'><?=$quote['author']?> - <?=$quote['date']?></div>
     171    </div>
     172    <?
     173}
     174?>
  • simple-quotes/tags/1.02/readme.txt

    r355576 r355766  
    55Requires at least: 3.0
    66Tested up to: 3.1
    7 Stable tag: 1.01
     7Stable tag: 1.02
    88
    99Just a simple project that flexibly prints random quotes anywhere on a wordpress page.
     
    1313<p>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.</p>
    1414
    15 <p>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 the quote_random() function which will return an associative array with both the content and author in it. For more details see <a href="http://www.jasonernst.com/projects/quotes/">www.jasonernst.com/projects/quotes/</a> for more details.</p>
     15<p>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_dispaly_random() to display a default styling or the quote_random() function which will return an associative array with both the content, author and date in it. For more details see <a href="http://www.jasonernst.com/projects/quotes/">www.jasonernst.com/projects/quotes/</a> for more details.</p>
    1616
    1717The 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.
     
    21211. Upload `simple-quotes` directory to the `/wp-content/plugins/` directory
    22221. Activate the plugin through the 'Plugins' menu in WordPress
    23 1. Place `<?php $quote = quote_random(); echo $quote['content']; echo $quote['author']; ?>` in your templates
     231. Place `<?php $quote = quote_random(); echo $quote['content']; echo $quote['author']; echo $quote['date']; ?>` in your templates if you would like to style the quote yourself or
     241. Alternatively place `<?php quote_display_random(); ?> in your template to have the default quote style displayed
    2425
    2526== Frequently Asked Questions ==
    2627
    2728== Changelog ==
     29
     30= 1.02 =
     31* Added an optional date field for the quotes
     32* Added a function `quote_display_random()` which will display a default styled quote to make it easier to use
    2833
    2934= 1.01 =
  • simple-quotes/trunk/index.php

    r355576 r355766  
    44 * Plugin URI: http://www.jasonernst.com/projects/quotes/
    55 * Description: Creates a custom post type for quotes which will show up in the administrative interface within wordpress. The quotes are then return randomly in an associative array using the function 'quote_random()'. Extremely simple plugin takes only a quote and the quote author. Note: The author icon is taken from the famfamfam icon pack (http://www.famfamfam.com/)
    6  * Version: 1.01
     6 * Version: 1.02
    77 * Author: Jason B. Ernst
    88 * Author URI: http://www.jasonernst.com/
     
    8585function quote_addfields()
    8686{
    87     add_meta_box('quote-author-meta','Quote Author','quote_author_meta','quote','normal','high');
    88     do_meta_boxes('quote-author-meta','normal',null);
     87    add_meta_box('quote-meta','Quote Information','quote_meta','quote','normal','high');
     88    do_meta_boxes('quote-meta','normal',null);
    8989}
    9090
     
    9292 * Adds the html to the admin page for the quote author
    9393 */
    94 function quote_author_meta()
     94function quote_meta()
    9595{
    9696    //used to get to the plugin folder
     
    9898    global $post;
    9999    $quote_author = get_post_meta($post->ID, 'quote_author', true);
     100    $quote_date = get_post_meta($post->ID, 'quote_date', true);
     101   
    100102    //create a nonce for security
    101103    echo '<input type="hidden" name="quote_noncename" id="quote_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
     
    105107                <label for="quote_author"><img src="<?=$base?>/author.png" alt="Quote Author"/> Quote Author: </label>
    106108                <input type="text" name="quote_author" tabindex="3" style="width: 100%;" value="<?=$quote_author?>"/>
    107                 <p>The quote author is the original author of the quote, and does not have to be a blog author.</p>
     109               
     110                <div style="margin-bottom:10px;">&nbsp;</div>
     111               
     112                <label for="quote_date"><img src="<?=$base?>/calendar.png" alt="Quote Date"/> Quote Date: </label>
     113                <input type="text" name="quote_date" tabindex="3" style="width: 100%;" value="<?=$quote_date?>"/>
     114                <p>All of the fields here except the quote itself is optional, you may use as much of the information in your template as you wish.</p>
    108115            </div> <!-- /form-field -->
    109116        </div> <!-- /inside -->
     
    134141 * quote["content"] is the quote itself
    135142 * quote["author"] is the author
     143 * quote["date"] is the date of the quote
    136144 */
    137145function quote_random()
     
    144152        $quote["content"] = the_title("", "", false);
    145153        $quote["author"] = get_post_meta($post->ID, 'quote_author', true );
     154        $quote["date"] = get_post_meta($post->ID, 'quote_date', true );
    146155        wp_reset_query();
    147156        return $quote;
    148157    }
    149158}
    150  ?>
     159
     160/*
     161 * Outputs a styled quote using the default style
     162 * Use quote_random() if you would like to style the
     163 * quote yourself
     164 */
     165function quote_display_random()
     166{
     167    $quote = quote_random();
     168    ?>
     169    <div class="quote"><em><?=$quote['content']?></em>
     170        <div style='text-align:right;'><?=$quote['author']?> - <?=$quote['date']?></div>
     171    </div>
     172    <?
     173}
     174?>
  • simple-quotes/trunk/readme.txt

    r355576 r355766  
    55Requires at least: 3.0
    66Tested up to: 3.1
    7 Stable tag: 1.01
     7Stable tag: 1.02
    88
    99Just a simple project that flexibly prints random quotes anywhere on a wordpress page.
     
    1313<p>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.</p>
    1414
    15 <p>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 the quote_random() function which will return an associative array with both the content and author in it. For more details see <a href="http://www.jasonernst.com/projects/quotes/">www.jasonernst.com/projects/quotes/</a> for more details.</p>
     15<p>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_dispaly_random() to display a default styling or the quote_random() function which will return an associative array with both the content, author and date in it. For more details see <a href="http://www.jasonernst.com/projects/quotes/">www.jasonernst.com/projects/quotes/</a> for more details.</p>
    1616
    1717The 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.
     
    21211. Upload `simple-quotes` directory to the `/wp-content/plugins/` directory
    22221. Activate the plugin through the 'Plugins' menu in WordPress
    23 1. Place `<?php $quote = quote_random(); echo $quote['content']; echo $quote['author']; ?>` in your templates
     231. Place `<?php $quote = quote_random(); echo $quote['content']; echo $quote['author']; echo $quote['date']; ?>` in your templates if you would like to style the quote yourself or
     241. Alternatively place `<?php quote_display_random(); ?> in your template to have the default quote style displayed
    2425
    2526== Frequently Asked Questions ==
    2627
    2728== Changelog ==
     29
     30= 1.02 =
     31* Added an optional date field for the quotes
     32* Added a function `quote_display_random()` which will display a default styled quote to make it easier to use
    2833
    2934= 1.01 =
Note: See TracChangeset for help on using the changeset viewer.