Smart Archives Reloaded: Version 2.0

Flexible post selection

You can select exactly which posts you want to display. The smart_archives() template tag now takes a second parameter, which accepts most of the arguments that query_posts() accepts.

Here is the “laziest” way to use it:

<?php smart_archives('', $GLOBALS['query_string']); ?>

If you put that code in author.php, for example, it will display the list of posts by the current author. If you put it in tag.php, it will list the posts in the current tag etc.

You can also make it display the same set of posts, no matter where it’s placed:

<?php smart_archives('', array( 'author_name' => 'scribu' ) ); ?>

The possibilities are endless.

Fewer queries

With the previous version, generating the archive page on this site required around 900 database queries. Now it’s down to 300.

No more buggy caching

Older versions of the plugin stored the generated HTML in a text file, instead of generating it on each page load. Unfortunately, this relied on two rather unreliable things: file permissions and wp-cron. Thus, it was the biggest source of problems for users. So I decided to remove file caching completely.

If you want caching back, the best solution is to use a dedicated plugin, such as WP Super Cache. It will make your entire site load much faster.

comments powered by Disqus