Subtraction Style Archives

Subtraction Style Archives, a WordPress archives plugin which emulates http://www.subtraction.com/archives/

Looking 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.

Installation

  1. Download arl_subtraction_archives.zip
  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.

Usage

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 (+)

Links

Notes

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!

Changeset

  • 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 Responses to “Subtraction Style Archives”

  1. [...] WP Plugin: Subtraction Style Archives Display your Wordpress archives in the same style as Khoi Vinh. The author also provides an example archive for this plugin. Bookmark:These icons link to social bookmarking sites where readers can share and discover new web pages. [...]

  2. [...] WP Plugin: Subtraction Style Archives Display your Wordpress archives in the same style as Khoi Vinh. The author also provides an example archive for this plugin. [...]

  3. [...]   Subtraction Style Archives,出了传统的和Ajax效果的存档页面,终于出现了一款美观而又特殊的存档插件。 archive [...]

  4. [...] Ik heb een nieuwe archief pagina in elkaar gezet met behulp van deze plugin. Alles is afgeleid van Khoi Vinh’s Subtraction. Deze link delen?These icons link to social bookmarking sites where readers can share and discover new web pages. [...]

  5. [...] Subtraction Style Archives [...]

  6. [...] Subtraction Style Archives : Create subtraction style archive easily .. if you want to see a demo, go to my archives page (i prefer this plugin rather than Clean Archives plugin because this plugin didn’t use to much query especially if you have large blog / post) other options are Clean Archives Reloaded and Extended Live Archive .. or browse the author of this plugin to see more archives plugin [...]

Leave a Reply