AZIndex is about to become even more useful! In a couple of days I will be releasing AZIndex v0.8.0, which 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 changes to the plugin code in this release (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 will be a few restrictions. 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 tags by category, but that won’t be possible for the time being. 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.
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