Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.1   Updated Sunday, February 22nd, 2009 at 2:14pm

Recent Categories Plugin for WordPress

This plugin generates a simple list of the most recently created categories in your WordPress installation. You can specify the number of categories listed, and the titles link to the category archives. This plugin can be called from a post or page, or directly from a template file. You can also choose to show the date the category was created.

Download

  If you have found this page useful, please consider donating. Thanks!

Instructions

  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory.
  • Enable the plugin.
  • Configure the plugin options (under DDRecentCats).

Change Log

  • 02-22-09 Version 1.1 – Added options page. Can now choose to display date of category creation, and format the date display.
  • 08-28-08 Version 1.0 – First release.

Usage

There are two ways you can use this plugin. With both methods, ‘X’ is the number of categories you would like to display. They will be sorted with the most recent first.

1) In a post or page, insert the following line:

<!-- recentcats X -->

2) In a template file, insert the following code:

<?php echo dd_recent_cats(X); ?>

Important: If you use the first method, make sure you add this using the html/code editor in WordPress, not the visual editor. In new versions of WordPress, just click the ‘html’ button above the edit box. If you use the visual editor it will not work, as the actual code you entered will be seen on the page, instead of being processed by the script.

Options

Here are the options available in this plugin’s options page in the WordPress admin panel.

Show Date

If enabled, the creation date will be shown next to each category. Since WordPress does not store the actual date a category is created, the value used is the date of the earliest published post in that category.

Date Format

If showing the date, it can be customized using this option, which follows the standard PHP date format structure.

Customization

This plugin generates a standard html list. If you would like text above or below the list, you can add it to your post or page, or directly into the template file you call the function from.

Additionally, the CSS class ddrc is given to the <UL>

<ul class="ddrc">
<li>..cat link..</li>
<li>..cat link..</li>
<li>..cat link..</li>
</ul>

You can use this to customize the list display in your theme’s CSS file.