WordPress Plugin: Subtraction Style Archives

Subtraction Style Archives, a WordPress archives plugin which emulates http://www.subtraction.com/archives/Looking for a new way to display your WordPress archives page? Look no further, you’ve found the Subtraction Style Archives plugin. The Subtraction Style Archives plugin provides functionality which will allow you to generate an archive page similar to that on Subtraction.

There is a permanent page for the plugin which describes:

  • where to download it
  • how to install it
  • how to implement it in your own web site
  • some notes on the plugin
  • a changeset for the plugin

If you have any questions, problems or suggestions about the plugin; feel free to drop a comment about it.

47 thoughts on “WordPress Plugin: Subtraction Style Archives

  1. Bakkel,

    I wonder if that has something to do with the temporary table not being available when the second SQL statement is executed. Temporary tables are temporary to your database session (generally), which means if you were to reconnect to the database (or get a different connection to PHP in this case), that the temporary table would not be available.

    When I decided to use the temporary table, I wasn’t sure if it was going to work; however after having it running on my site for over a month – it didn’t generate any errors.

    Quick question, do you use any of the caching type plugins for WordPress at all? I haven’t looked into how they work under the hood, however if they some how cached the database data, out of the database; then that might very well cause the error you’re seeing.


  2. I’m fascinated with this Plugin. I don’t see an argument for adding post links under categories, or how to add the category description. An archive list by date is so “old style”, since it really doesn’t help searchers find anything since they don’t care when they wrote it, they just want it, and that’s where category structure carries more weight.

    Is there an option to include post links under the categories?

  3. @al: negative on the catching plugins. I wish I good give you more data, but I’m no programmer. I really have no clue what is causing this.

  4. Looks like I’m up against the same issue. I’m looking through the SQL statements in the code, but nothing seems to jump right out. The error is a documented MySQL error having to do with multiple calls to the same temporary table (http://dev.mysql.com/doc/refman/5.0/en/temporary-table-problems.html).

    I’ll have to try it on a dummy database and see if maybe some of my plugins might be causing an issue.

    @Al – Is your code any different from what you posted? Do you run any special plugins?


  5. Patrick/Bakkel,

    Is it possible for you to tell me the version of mySQL (ie: 3.23, 4.0, 4.1, 5.0) that your web site is run on? It appears that there are some caveats in using the temporary tables with different versions of mySQL, which I may be able to resolve without too many problems.


  6. aba/Ron,

    Out of interest, when you installed WordPress – did you choose to prefix your tables with something? My installation has the default table names, so I have a wp_posts table. If you chose to prefix them, then you might have prefix_wp_posts, which might explain why the plugin isn’t returning any posts.

    If you can confirm, I’ll make the appropriate changes.


  7. Al

    I did not put any prefix for the tables, so that is not the problem. I also did looked at the code, and tried some things with uppercase and lowercase (in the code there is wp.id, and I tried wp.ID) but that doesn’t change anything. Strange .. i also can’t verify if the temporary table is correct ..

  8. Ron/aba,

    I’ll try and get a copy of mySQL v4.1.x installed in the tonight and see if I can reproduce your error.

    In the mean time (and I don’t know if this is possible for you), what does mySQL do when you execute the two SQL statements within something like phpMyAdmin or one of the mySQL GUI administration utilities?


  9. I also noted in the SQL code, after the UNION statement, line 46 reading:

    $sql .= "FROM wp_posts wp ";

    Looks a bit funny. Is that intended to omit the “AS”?

    Looking at a similar statement above on line 35:
    $sql .= "FROM wp_posts AS wp ";

    I don’t believe this is the trouble, but I thought it might affect other things.

  10. Thinkdreams,

    Ordinarily, you don’t need to specify the AS keyword when assigning an alias to something.

    I’m a bit new to some of the finer points of mySQL, so it could have been causing a problem. Did you add the alias in and try it again by chance?


  11. I’ve installed mySQL 4.1.21 (Community Edition) and I can reproduce the error that you are seeing.

    Now I just need to find an elegant work around for it!


  12. Cool. Let me know when you do have it working and you need help testing. I’d be glad to be your guinea pig.

  13. Interestingly enough, I reloaded the archives page today, and it show up with “None Available” but no error message. The plot thickens…..

  14. All right. Now we’re getting somewhere. I removed the lines 39-48 (Union statement to just before Order BY Statement, which is the 2nd reference to the temporary table) and it displays data. Only the three first entries. So it is the duplicate call to the MySQL temp table that’s hosing the query. Hmm.

    Let me see if I can get the Union statement to work properly from here, but at least I got it to show something anyway.

  15. Eby,

    Thanks for the link to the bug.

    So it appears that it isn’t possible for me to work around the ‘fix’ that was done in 4.1.x+ version of mySQL.

    I will remove the temporary & rewrite that section of the plugin over the weekend and release it. Thank you for everyones patience while we sorted out what the bug was in the SQL & mySQL.


  16. I have just uploaded version 0.3 new copy of the plugin, which does not use the temporary table.

    For anyone that already has it installed, it’ll just be a matter of uploading a new copy of the plugin – your theme files don’t need to change at all.

    I’d really appreciate it if everyone could drop a comment back to confirm that it has resolved the error for everyone. As soon as that has been cleared up, I’ll move onto adding a few more features into the plugin.


  17. version 0.3 works for me. I only altered the in because of my template. check the result here.

    One thing wonders me. The first 3 months are displayed correct, but after month 4 the month name is followed by the word ‘month’ with a link to my archives page below it. I don’t see this in your archives page.

  18. Everything works OK for me too, with the exception of “month” in all the months after the first three in the “expanded months” variable.

    see Archives

    Looks great!

    Any ideas Al?

  19. ThinkDreams,

    I believe we’ve found another difference between my older version of mySQL and the newer ones again.

    In my SQL statement, I UNION two SQL statements together. In the second half, I specify the value of some of the columns and rely on that value being a very large number. It appears that when your server executes the code, that it doesn’t return the ‘very large number’ that mine does and enters into a block of code it shouldn’t have.

    I’ll fix that up this evening and release it again. Who would have thought that so many fundementals would have changed between two versions of mySQL?


  20. I have just uploaded Version 0.4 has been uploaded, which should hopefully fix the problems people where having with the additional month link being displayed.


  21. So I’m still having a strange issue. I get repetitive entries for the months beneath the first three. It isn’t a consistent amount per each month either. See Archives

    Boy, they really changed things when they went to my version of MySQL. Anyone else experiencing what I’m getting?

    I’m working on debugging it, so if you see strange numbers, etc. beside the entries, that’s me. Debugging.


  22. After looking at it again, I noted that it has the same number of entries as there are blog posts for that month. So if July 2006 has 4 posts, there are 4 listings for July 2006.


  23. And actually, checking your site, it looks like your site has the bug too. I can’t figure out what’s causing it, but I may put another if/then statement in there to check for duplicates (if I can get it to work properly.)

  24. Cool. I look forward to it. I have almost all the CSS styling done on the site.

    See Archives

  25. Yes. Works great for me too. I have finished the CSS styling on it as well.

    See Here

    I also added a function to display tags, using an ultimate tag warrior built-in function.

  26. Logan Leger,

    I have updated the plugin to reference $wpdb->posts instead of the wp_posts table directly.

    You can find the latest release for the plugin ont he permanent page for the plugin.


Comments are closed.