AZIndex v0.8.0 has been released and includes several substantial upgrades, but the one most people are waiting for is the ability to sort posts by tag and category names. Yes, even if a post has gazillions of tags, it will appear a gazillion times in the index, if you select tags as your headings.
[WARNING: I have made a lot of complex changes to the plugin code in this version (remember, the plugin is still under development!) and even though I have done a lot of testing, there may be a few teething problems in the first few days. If you are using AZIndex as a critical part of your blog, please test the new version with your index first to make sure it is all working]
There are a few restrictions to sorting by tags or by categories. First, this does not mean you can create an index of tags or categories–they will still be indexes of posts. Next you can only specify tags and categories as headings–not sub-headings or descriptions. I understand that a few people will probably want to index their posts by tags and then by category, but that is not be possible. Also, if you exclude a tag or category from the index, any post with that tag or category will be excluded, even if it has a tag or category which is still in the index.
For examples of indexes sorted by tags and categories, please see the new AZIndex Gallery.
Another change in v0.8.0 I have already warned people about is the renaming of some array keys which will definitely impact people who have been using their own “custom comparison” function in their indexes. If you are one of those people, you will have to make the following changes to your code:
For example, in this sample function:
function my_compare($item1, $item2) {}
you will have to change the key names used to access the value in arrays $item1 and $item2 as described in the table below (changed names in bold):
Old Name | New Name | Description | |||
---|---|---|---|---|---|
id | id | Post id | |||
– | initial | First letter of sorted heading (new) | |||
fullhead | head | Displayed heading | |||
head | sort-head | Sorted heading | |||
subhead | subhead | Displayed subheading | |||
sortsubhead | sort-subhead | Sorted subheading | |||
desc | desc | Displayed description | |||
sortdesc | sort-desc | Sorted description | |||
– | key | Category/tag id (new – only if category/tag selected as the heading) |
I have also retired the azindex_heading filter, replacing it with the azindex_item filter. This new filter makes all the information about an item that is used for sorting and displaying the index available for the filter to change. The filter will take one parameter, a mapped array, with the key names exactly as those in the table above. So, if you have been using the azindex_heading filter, all you need to do is switch to the azindex_item filter and use $item[‘head’] or $item[‘sort-head’] (depending on whether you want to change the way the item is sorted or the way it is displayed. Full documentation of the new filter will be provided online.
New filters are:
- azindex_item (see above)
- azindex_display_index: called with the final HTML of the index page, just before it is delivered.
- azindex_alpha_links: called with the HTML of the alphabetical links
- azindex_page_links: called with the HTML of the page links
Finally, the new AZIndex website is online at azindex.englishmike.net and all support for AZIndex will be moving there. I will make more detailed announcement about the move tomorrow.