Choose Your Theme
Warren Shea

Developers start counting at 0

Tuesday, October 26th, 2010 at 4:45 pm

So I spent a good hour or so trying to get subcategories to show up on the right panel….
It wasn’t showing up, despite putting in parameter for it (below)…so I thought maybe it was the wordpress code I’d modified. That wasn’t it either.

To show categories, you have to put:
<?php wp_list_categories(‘depth=1‘); ?>

By default, wordpress shows subcategories…so you just have to specify the depth.

So here I’m thinking all categories belong in depth 0
Subcategories belong in depth 1
Subsubcategories belong in depth 2, and so on.

And after of trying to debug this, (and I probably should have done this at the start), I modified depth to 2 and it worked.

So basically,
Categories belong in depth 1
Subcategories belong in depth 2…
and so on.

Man, I feel stupid…but…it’s an honest mistake no? I guess I’m just so used to counting at 0, especially when I see all this code….”who starts counting at 1?” I asked myself…but…the answer is non-developers. But still, this *is* still PHP code…so…man, i dunno.

Anyways. Time wasted….

I need to re-categorize everything. I hate my categories. Can’t find/do anything.

Leave a Reply