Ok, see the cool category button at the top there? If you’re a WordPress user, you can have them too with a neat css trick from ala and a single call to list_cats().
Actually, that’s not quite true. The list_cats() method writes out a series of <li> tags with <a> links inside them. In order to get the tabs working nicely in a cross-browser fashion, some CSS magic is required, which relies on slightly unconventional html: we have to wrap the text for each link in a <span> tag.
Of course, the list_cats doesn’t do this. And doesn’t provide a way to do it, either. Well, in the process of fixing that, I made a couple other changes I think you’ll like …
The function takes 4 additional parameters now:
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc',
$file = 'blah', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1,
$before='<li>', $after='</li>', $currentCat = '', $beforeCurrent ='<li class="current">') {
Those should be obvious, but let me be extra clear anyway. I’ve added them onto the end of the current parameters (so as to not break your existing code, if you use my changes), but really the list = 1|0 parameter should go away and be replaced by these.
- before
- this is text (or html code) which will be put directly before the <a> link in the resulting code
- after
- this is text (or html code) which will be put just before the closing </a> link in the resulting code
- currentCat
- This is the name of the current category. I usually use get_catname( $cat ) to convert the cat url parameter into text
- beforeCurrent
- If you pass in a current category, you can specify different text to go before it. Usually this is so your style sheet can highlight it the way I did here.
So anyway, on with the code changes. If you want to just get the source right now, you can just click below to go to the last page
Similar Posts:
- None Found
Awesome! I was just reading that ALA article the other day and was thinking about playing around with it to see if the effect was really worth the effort. After seeing your implementation, I stand convinced. Nice work.
One question: Is your “Huddled Messes” category a Fruedian Slip or a rather comical play on words?
After having played around with Word Press, do you objectively prefer it to Movable Type (neverminding the Open Source characteristic)? I’m finally down with all things MT, so I probably won’t change (I don’t have the free time to keep learning the latest and greatest software packages), but I’m curious what you see the pros/cons to be.
Huddled Messes is a purposeful play on words.
Honestly, the big thing for me is the fact that it’s PHP. I’m just that much more comfortable in PHP than in perl. So far as people using Movable Type switching to WordPress, I’d have to say wait. It’s still a 0.x release, and it shows: they are still making fairly substantial changes to how things work on a regular basis. So much so that I’ve downloaded stuff from CVS three times since I’ve installed this just to get new features that I “needed”
... and still half my links don’t work [
]