Using Filters
Filters are a way for AZIndex users with some knowledge of PHP programming to tailor the appearance and/or behavior of their indexes. For example, suppose you don’t like the appearance of the alphabetical links at the top of the index, and you can’t get it to look the way you want it to look by using a customized CSS stylesheet. Normally you would be stuck with what you have, but with AZIndex you can use the azindex_alpha_links filter to get in there and tinker with the HTML for the index before it is displayed on the webpage.
Of course, you have to write a function with some PHP code in it to do that, so this is not for every AZIndex user, but if you’re an expert PHP hacker, these are the steps you can follow:
- Find a good place to put your new PHP code. I prefer creating my own little plugin for all my tailoring needs, since there is no chance of it being overwritten when upgrading, but you could add it to somewhere like functions.php inside your theme directory.
- Add the following line to your code (not inside any function):
add_filter('azindex_alpha_links', 'my_alpha_links_filter'); - Just below that, add a new function called my_alpha_links_filter.
function my_alpha_links_filter($output) { /* My HTML modification code here */ return $output; }Now all you have to do is write the code to modify the HTML in $output to make the alpha-links look the way you want them to look. (Well, yes, that’s the hard part, but you get the idea!)
If you would rather throw away the generated HTML and start again, you can add extra parameters to the filter function which will contain all you need to build set of alphabetical links in the style of your choosing:
- First you have to modify the add_filter function call:
add_filter('azindex_alpha_links', 'my_alpha_links_filter', 10, 5);where 10 is the default priority of the filter (we don’t use it, but it has to be present in the call) and 5 is the number of parameters AZIndex will pass to your filter function.
- You also have to modify the filter function to access the extra variables being passed to you:
function my_item_filter($output, $idindex, $links, $pagelink, $currentpage) { /* My HTML modifying code here */ return $output; }where $idindex is the id of the index being displayed (in case you just want to modify one index out of many), $links is an array of the characters in the links and the page in the index they link to, and so on.
Note: If you only need to know the id of the index, then you can set the number of parameters to 2 in the add_filters call.
Now that you know everything there is to know about using filters (well, not really, but it’s enough!), you can look up the details of each AZIndex filter in the following reference pages.
renderers said:
I was suggested this blog through my cousin. I am not positive whether this submit is written by means of him as nobody else recognize such special about my problem. You’re amazing! Thank you!
Marriage Certificates said:
I was just searching for this information for a while. After six hours of continuous Googleing, at last I got it in your web site. I wonder what’s the lack of Google strategy that don’t rank this kind of informative websites in top of the list. Generally the top websites are full of garbage.
Alec Nicolet said:
Haha, I’m only buying it because it won’t get boring super-fast.
Dan Rollins said:
I have been using the AZIndex for a while to do an alphabetical post listing and it has been great! Now I want to do a chronological index listing with the same look. Is there a way to do a sort by Published date so that it looks the same way?
Here is my current alpha page index: http://strongdisciple.com/alphabetical-listing
Thanks again for this great plugin!
Dan
Filters Toronto said:
Youre so cool! I dont suppose Ive read anything like this before. So good to seek out any person with some unique thoughts on this subject. realy thank you for beginning this up. this website is something that is needed on the internet, someone with a bit originality. helpful job for bringing something new to the web!
trane filters said:
I’ve learn several just right stuff here. Definitely value bookmarking for revisiting. I wonder how a lot effort you place to create this sort of great informative website.
Five seasons filters said:
naturally like your web site but you have to test the spelling on quite a few of your posts. Several of them are rife with spelling issues and I to find it very bothersome to tell the truth on the other hand I’ll definitely come back again.
ecu repair said:
excellent points altogether, you just received a emblem new reader. What could you recommend in regards to your post that you simply made some days in the past? Any certain?
color said:
Youre so cool! I dont suppose Ive read anything like this before. So nice to seek out somebody with some authentic ideas on this subject. realy thanks for beginning this up. this website is one thing that is needed on the web, someone with slightly originality. helpful job for bringing something new to the web!
Jeff said:
Hi Mike…
Big fan of the plugin. We use it everywhere.
Not sure where to make suggestions so I thought I would try here.
We have a directory and it would be really useful for us to be able to use the category as a sub head.
This way we could have a page that show all categories grouped by a custom field.
Would love to know if this will make the list.
Jeff
Auto Injury Clinic Atlanta said:
There is clearly a bunch to realize about this. I think you made some good points in features also.
Atlanta IME Disability DOT said:
This website online is mostly a walk-via for all of the information you wished about this and didn’t know who to ask. Glimpse here, and also you’ll positively discover it.
Stone Mountain Chiropractor said:
Wonderful paintings! This is the type of info that are supposed to be shared around the web. Disgrace on the seek engines for no longer positioning this post higher! Come on over and seek advice from my site . Thank you =)
Electric Visual Goggles said:
I found your weblog site on google and verify a couple of of your early posts. Continue to keep up the superb operate. I just additional up your RSS feed to my MSN Information Reader. Seeking forward to reading extra from you afterward!…
Hipolito Mccurren said:
Well I definitely liked reading it. This subject provided by you is very helpful for accurate planning.
peter said:
using AZIndex 0.8.1 on wordpress 2.7 that was installed a few years ago by original site developer. The website is for non-profit organization, run by volunteers.
I have no knowledge/experience with this plugin and has been working up till today, when noticed site had issue.
AZIndex Plug Error 101 – required database table wp_bfafaz_indexes – donot exist
deactivate then reactivate AZIndex to correct this problem
I deactivated then reactivated plugin- got same Error
Suggestions on how this issue can be resolved would be much appreciated.
Electronic kits said:
I think other web site proprietors should take this web site as an model, very clean and magnificent user friendly style and design, as well as the content. You’re an expert in this topic!
Michael Grant said:
This plugin does in fact seem to work on wordpress 3.x.
It would be fantastic if this plugin could be updated to be able to use custom types and taxonomies. I can see by playing with the code that it wouldn’t be too difficult.
Is there any active development being done on this? Can I make some code contributions?
wellington boot racks said:
I precisely needed to thank you very much yet again. I do not know the things I would have made to happen without those solutions contributed by you directly on that concern. It became an absolute challenging circumstance in my position, nevertheless being able to view the specialized way you treated the issue made me to leap over happiness. Extremely happy for the assistance and even expect you are aware of an amazing job you are getting into training other individuals with the aid of your web page. Probably you’ve never encountered all of us.
vityas said:
I appreciate, result in I discovered just what I used to be having a look for. You have ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye