Subtraction Style Archives

Subtraction Style Archives, a WordPress archives plugin which emulates for a different way of displaying your WordPress archives? Look no further, you’ve found the Subtraction Style Archives plugin. Subtraction Style Archives is a WordPress plugin which provides you with functionality to build a slick new WordPress archives page. After following the simple usage instructions below, you’ll soon have an archives page which looks similar to Khoi Vinh‘s wonderful Subtraction.


  1. Download
  2. Unzip the file to your local machine somewhere
  3. Upload the arl_subtraction_archives.php into your plugins folder (normally: /wp-content/plugins/)
  4. Enable the plugin via your administration console
  5. Edit your appropriate WordPress template file (normally: /wp-content/themes/<theme_name>/archives.php) and add calls to arl_subtraction_archives_posts() and arl_subtraction_archives_categories() where appropriate.


The arl_subtraction_archives_posts() function has the following function definition:

  1. function arl_subtraction_archives_posts($expanded_months = 3, $post_separator = "+")

For those that aren’t aware, it means that the function has two optional parameters:

  1. The number of expanded months to show. The parameter accepts any positive, non-zero integer. If an invalid value is entered, the functionality will return to the default status of three expanded months.
  2. The separator between each of the posts in the expanded months. The parameter accepts any non-zero length string as the separator. If a NULL or a zero length string are submitted, the separator will return to the default value of a plus sign (+)



As a by product of the way that WordPress currently handles permalinks, plugin authors are required to call the get_permalink() function everytime they want to display a link for a post. The get_permalink() function will issue SQL statements, as such you will incur at least one SQL statement for every post within your blog.

Depending on the size of your WordPress site, you might see slower than expected rendering of your archives page as a result of the above comment. For the vast majority of users, you probably don’t have enough content for it to matter. In the cases where you you have a lot of content, if you’re using a quality web host you will probably still not notice it.

At the start of 2007, this site has about 165 posts on it. Using this plugin on my archives page produces around 190 SQL statements and the page renders in 1.5s. Approximately 165 of the 190 SQL statements are produced by this plugin, while the others are just general WordPress queries.

As you can see, the performance certainly isn’t you should be concerned about at all; I’m making the note simply for the performance conscious WordPress user!


  • 2007-03-28:
    • Fixed bug so that it will show post(s) depending on the number of posts within a month or category
    • Fixed bug that was showing categories with no posts in them. It’s a problem because WordPress returns a HTP 404 on a category page with no posts, therefore the search engines are complaining about it
    • Removed redundant print statement with an else block to simply assign output into the $output variable
  • 2007-01-27: Fixed a bug in the SQL which was returning both pages and posts
  • 2006-11-27: Updated SQL to reference $wpdb->posts instead of the table directly
  • 2006-10-17: Fixed duplicate month link problems
  • 2006-10-16:
    • Added single quotes around the -1 value in the second half of the SQL UNION statement
    • Changed an IF statement to reflect the above -1 change
    • Changed the ORDER BY to sort the posts in descending order property
  • 2006-10-16: Removed the SQL temporary table to fix the reported Can't reopen table ssa error
  • 2006-10-04: Initial release

6 thoughts on “Subtraction Style Archives

  1. Pingback: WordPress New Plugins, Themes, & Widgets · WP Plugin: Subtraction Style Archives
  2. Pingback: BloggingPro China » Blog Archive » WordPress Plugin: Subtraction Style Archives

Comments are closed.