WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

AP Style Dates and Times

Formats the date and time of your posts and comments into Associated Press Style.

Usage

To use this plugin, you have to edit your template files, replacing WordPress' default date and time tags with the new ones listed below. You can use it on dates and times for posts, comments and post modified information.

For post dates and times

The tag <?php ap_time(); ?> will print the post's time in AP Style.

Find the <?php the_time(); ?> tag in your template files (single.php, index.php, search.php, archives.php, page.php, etc.) and replace it with:

<?php if (function_exists('ap_time')) { ap_time(); } else { the_time(); } ?>

Using the if statement will make sure the date is still printed if the plugin is deactivated.

Likewise, <?php ap_date(); ?> will print the post's date in AP Style.

Find the <?php the_date(); ?> tag in your template files and replace it with:

<?php if (function_exists('ap_date')) { ap_date(); } else { the_date(); } ?>

Here's how I use it:

I put the time before the date, so my code looks like this:

<?php if (function_exists('ap_time')) { ap_time(); } else { the_time(); } ?> `<?php if (function_exists('ap_date')) { ap_date(); } else { the_date(); } ?>`

That prints something like 1:15 p.m. Sept. 23, 2008 or noon Sept. 23, depending on the option settings.

For comment dates and times

The tag <?php ap_comment_time(); ?> will print the comment times in AP Style.

Find the <?php comment_time(); ?> tag in your comments template file (comments.php) and replace it with:

<?php if (function_exists('ap_comment_time')) { ap_comment_time(); } else { comment_time(); } ?>

The tag <?php ap_comment_date(); ?> will print the comment dates in AP Style.

Find the <?php comment_date(); ?> tag in your comments template file and replace it with:

<?php if (function_exists('ap_comment_date')) { ap_comment_date(); } else { comment_date(); } ?>

For modified dates and times

The tag <?php ap_modified_time(); ?> will print the post's modified time in AP Style.

Find the <?php the_modified_time(); ?> tag in your template files (single.php, index.php, search.php, archives.php, page.php, etc.) and replace it with:

<?php if (function_exists('ap_modified_time')) { ap_modified_time(); } else { the_modified_time(); } ?>

The tag <?php ap_modified_date(); ?> will print the post's modified date in AP Style.

Find the <?php the_modified_date(); ?> tag in your template files and replace it with:

<?php if (function_exists('ap_modified_date')) { ap_modified_date(); } else { the_modified_date(); } ?>

Example

You can see it in action at http://www.rockmycar.net. Just look at the post and comment dates throughout the site.

Questions, comments, suggestions

This is a pretty simple plugin, but 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.

Requires: 2.5 or higher
Compatible up to: 2.9.2
Last Updated: 2010-3-3
Downloads: 3,777

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1