English Mike on September 17, 2008 at 5:13 pm
Several users have asked for the ability to remove certain words like “The” and “A”, or even “Le”, “La”, and “Les” from the front of headings in their indexes. While I have already document how you can do that with AZIndex, the solution is not easy for novice WordPress users because it involves adding PHP code to one of your blog’s theme files, and if you accidentally make a mistake when inserting the code, it’s all too easy to crash your entire blog!
So I thought that there has to be a better, safer way to do this… and there is!
Continue reading “New: The AZIndex User Extensions Plugin” »
English Mike on September 12, 2008 at 6:46 pm
Double oops.
The SQL problems a couple of users were reporting are probably not because of they are using an old version of MySQL after all. As I was wondering if there was an easy way to support users on MySQL 4.0.x, I noticed something I should have seen before — I had hardcoded the database table names I added to the SQL query to obtain the post ids to be excluded from the index. Elementary mistake — my bad.
Hopefully the new version should work for those of you who had problems on v0.6 and v0.6.1. If it doesn’t then please let me know which version of MySQL you are using, because users of MySQL 0.4.x will still have problems with the exclude feature.
English Mike on September 12, 2008 at 5:26 pm
Oops. I just installed AZIndex 0.6 on my own blog and then when I tried to publish a new post, got a nasty error message that never appeared in all the testing I did in the past few days.
Fortunately it was obvious what the problem was and I quickly fixed the issue, and hence the new version — 0.6.1. Nothing else has changed from v0.6.
English Mike on September 12, 2008 at 5:05 pm
Well, it seems that in the latest version of AZIndex I might have inadvertently used a feature of MySQL that was not introduced until MySQL version 4.1. When you use the new “exclude categories/tags” feature, the AZIndex plugin constructs a gnarley SQL query that includes something called a “subquery”, and subqueries did not exist in MySQL 4.0.x.
I actually did check to make sure that subqueries were supported in MySQL 4.x, but I didn’t realize that WordPress officially supports all the way back to MySQL 4.0.x.
So… if you find that adding an excluded category or tag to your index causes a nasty SQL error, it is very likely that your server is running a version of MySQL 4.0.x. Now, MySQL 4.1 was released in October 2004, which is almost four years ago, so I can’t imagine that there are very many web hosts who still use an even older version. If you are in that unfortunate situation, it is worth checking with your web host to see if they offer the option of upgrading to a newer version of MySQL. Usually the upgrade process is virtually automatic. I know that my cheap shared web host provides that option, and I am sure that others do also.
I would rather not have to rewrite the AZIndex code to avoid using subqueries if possible. The SQL logical is complicated enough without having to deal with even more cases, so I need to know if there are enough users still on MySQL 4.0.x without the option to upgrade to see if it is worth the risk of complexifying (that’s a word, right?) the code logic even more.
Please feel free to chime in.
English Mike on September 11, 2008 at 6:07 pm
I am please to announce that AZIndex version 0.6 has been released. Along with a number of bug fixes, I have made three major functional improvements to the plugin with this release:
- Support for excluding posts from an index using tags or categories.
- An option to include all the children of the categories you specify in the settings.
- Support for the WP Super Cache plugin for full HTML caching of index pages.
The rest of this post goes into more details about how to use each of these features.
English Mike on September 11, 2008 at 6:07 pm
Since the latest release of AZIndex (0.6) incorporates full support of the widely used WP Super Cache plugin, I thought it would be a good idea to explain how caching works with the AZIndex plugin. For most of you, especially if your WordPress blog doesn’t use a caching plugin like WP Super Cache, it may be too much information, but for those who want to get the best performance out of their blog’s index pages, read on.
English Mike on August 30, 2008 at 12:44 am
Ask and ye shall receive!
I have been going through the backlog of comments and noted that a couple of people wanted to sort their indexes in chronological order — i.e. they want the list of posts sorted by date with the most recent at the top. So I was just pondering the issue, wondering if I should really add this feature even though it’s not really something AZIndex is designed to do, when I suddenly had “D’oh” moment…
You can already do this with the current release of AZIndex! (By using a one-line custom compare function.)
Here’s how you do it:
Continue reading “Eureka! Indexes in Chronological Order” »
English Mike on August 27, 2008 at 6:32 pm
I have had a couple of questions about putting an index in the sidebar of a blog so that it is visible on every page. After a bit of testing and fiddling, it turns out that, yes indeed it is possible, and it’s actually quite easy to do. The trick is to use a sidebar widget, and here are the step-by-step instructions on how to do it:
- Log in to your blog and go to Design >> Theme Editor.
- In the Theme Files list on the right you should see an entry called something like “Theme Functions (functions.php).” Click on the link and the file will be loaded into the editor window.
- Now we have to add the following line at the top of the file to enable WordPress shortcodes in sidebar widgets:
add_filter('widget_text', 'do_shortcode');
IMPORTANT: It must be inside a PHP tag: i.e. somewhere between <?php and ?>
For example, if there is a line containing <?php at the top of the file, then add it on the following line. (Just make sure you don’t put it inside a PHP function). If the file is empty, or doesn’t have those tags, you will have to add them yourself:
<?php
add_filter('widget_text', 'do_shortcode');
?>
- Click Update File at the bottom of the page to save your changes.
- Now go to Design >> Widgets and add a Text Widget to your sidebar.
- All you have to add to the content of the text widget is the AZIndex shortcode for your index. For example, if your AZindex index has an id of 2 (check the AZIndex admin page for the id), add the shortcode:
[az-index id="2"]
- Save your changes and go take a look at your new sidebar.
These instructions assume that you are already using a theme with a widget-enabled sidebar. If you do not see the new text widget, then it’s possible you will need to “widgetize” your theme (search for that term on Google for more information). Most popular themes are already widgetized these days.
I have tried this, and it works fine, though obviously there isn’t much room for large entries in your index. There is one site I know that is using this trick to display an index of movies in their sidebar. If you try this yourself and have any questions, just leave me a comment.
English Mike on July 14, 2008 at 9:15 am
AZIndex version 0.5.3 has just be released. It’s just another interim version as I am gearing up for my summer vacation, mainly to fix a bug where the sorting of the headings was case-sensitive. I’m not sure how that one escaped detection for so long!
I also took the opportunity to add a filter to the plugin — ‘azindex_heading’ — which, if set, will be called for every heading before the index is sorted. This allows users to write a filter function that can modify the heading in ways that can’t currently be done using the AZIndex plugin — for example, if you want to strip words like “A”, “An” and “The” from the front of the heading then you can write a simple filter to do that.
Below is an example of such a filter. It will remove “The”, “An” and “A” (of various cases) and put them at the end of the heading instead — e.g. “The Great Escape” will be transformed to “Great Escape, The”. Useful for certain types of indexing:
add_filter('azindex_heading', 'my_filter_heading');
function my_filter_heading($heading) {
if (preg_match('/^(THE |The |the |AN |An |an |A |a )/', $heading)) {
$split = explode(' ', $heading, 2);
$heading = $split[1].', '.$split[0];
}
return $heading;
}
Note that this is just an example and there may be a more correct way to do the same thing, but it works as advertised. You can add your filter function to the functions.php file in your current theme. Remember to clear the index cache (from the AZIndexes admin page) once you’ve added the filter so that the altered headings will be sorted in the correct order.
If anyone comes up with a useful filter function of their own, please feel free to post it here.
English Mike on July 7, 2008 at 1:26 am
I have just added the beginnings of an AZIndex User Guide to the blog. The first installment is mostly a “Getting Started” guide for those who are just starting to use the plugin, but I hope to add full documentation for the plugin and all its many settings by the time it’s complete. Unfortunately, since there are a lot of things to talk about with AZIndex, that is going to take some time — probably a few months — but I will continue to add new sections as I write them.
Feel free to comment on the AZIndex User Guide if you spot a mistake or if you find it too confusing in places.