=== AP Style Dates and Times === Contributors: Tom Chambers Donate link: http://www.rockmycar.net/ap-style-dates-and-times-plugin/ Tags: date, time, format Requires at least: Tested up to: 2.7 Stable tag: 1.1 Formats the date and time of your posts and comments into Associated Press Style. == Description == This plugin changes the format of the dates and times of your posts and comments to match Associated Press Style. This is perfect for news and magazine sites running WordPress and for those blog writers with a penchant for style consistency. Here's what it does. * Adds periods to "am" and "pm" so they become "a.m." and "p.m." * Removes extraneous zeros when the time is at the top of the hour. "1:00 p.m." becomes "1 p.m." * Changes "12:00 a.m." to "midnight" and "12:00 p.m." to "noon." * If the date of the post is the same as the current date, it prints "today" instead of the date. Technically that's not an AP Style rule, but a common newspaper style nonetheless. You can force it to print the date using parameters. * Correctly abbreviates months in the date to match AP Style rules. Those are: "Jan." "Feb." "March" "April" "May" "June" "July" "Aug." "Sept." "Oct." "Nov." "Dec." * If the post year is the same as the current year, the year does not print in the date output to adhere to AP Style rules. Therefore, if your post was published at 1:13 in the afternoon on September 22, 2007, this plugin will make the time look like "1:13 p.m." and date look like "Sept. 22, 2007" == Example == You can see it in action at www.rockmycar.net. Just look at the post and comment dates throughout the site. == Installation == 1. Download plugin 2. Unzip & upload to `/wp-content/plugins/` 3. Activate in the plugins admin menu VERSION IÕve only tested it with WordPress version 2.7, however, I donÕt see why it wouldnÕt work on older versions. If you find that it doesnÕt work with an older version, let me know. == Usage == Folks like to list their dates and timestamps differently, so there's separate tags for date and time. FOR POSTS will print the post's timestamp in AP Style. will print the post's date in AP Style. As an example, on my site, I replaced with: " " If you don't want to list the timestamp, just don't insert in your template. FOR COMMENTS will print the comment's timestamp in AP Style. will print the comment's date in AP Style. As an example, on my site, I replaced with: " As with posts, if you don't want to list the timestamp, just don't insert in your template. == Parameters == The ap_date() and ap_comment_date() tags default to use the word "today" when the post or comment date is the current day. Technically that is not an AP Style rule, but many newspapers use "today" for the current date. If you would rather use the actual date, send "$today=false" as a parameter, like this: You can also tell the tags to capitalize the words used. The plugin defaults to all lower-case letters. If you want "Today" to be capitalized, send the parameters "$today=true" and "$capitalize=true" like this: NOTE On the date tags, you MUST send the "$today=true" parameter with the "$capitalize=true" parameter. If you want "Noon" and "Midnight" to be capitalized when printing the timestamp, send "$capitalize=true" as a parameter, like this: NOTE This plugin will NOT affect the way the standard date and time tags work. == Questions, comments, suggestions == This is a pretty simple plugin, but I'm a complete novice at php, so if you find anything wrong with it, please let me know. Also, if you have suggestions to improve it or comments, don't hesitate to let them be known. == Changelog == 1.1 Jan. 27, 2009 * FIX: Made it so the plugin checked the year when calculating whether the post or comment date is the current date. * ADDED: Option to not use "today" when the date is the current date. * ADDED: Option to capitalize words "Noon" "Midnight" and "Today". 1.0 Jan. 21, 2009 * Original plugin released