08May

The fine, dark art of WordPress Theme Customization

Posted by Elf Sternberg as Uncategorized

Well, that took a little bit longer than I anticipated. But, I’ve learned an important lesson and successfully brought a project in on time and budget, so I can’t complain.

When the customer says, “We tried this with the last contract but he was more of a designer than a developer. He almost got it, but couldn’t quite make it work,” don’t assume he still has that source code. Ask. That was my big mistake. It took me awhile to dig myself out of that hole, and yet when I was done I had a much better understanding of how WordPress works than I would have otherwise.

Still, the site is looking fine now. The specific request was to make the “Categories” menu show “a list of pages associated with the current category,” which involved two magic tricks: one, in WordPress, categories belong to posts, not pages. The two are separate database items. And two, once “pages have categories,” figuring out from the current page what category the visitor is in, and highlighting that category in the category list. This is a different task from doing the same thing through the current post.

I’ve learned about customized Category_Walkers (apparently, this is a Dark Art, as I’ve been able to find exactly one example other than my own that used it) and how to integrate category lookups with the WordPress metadata engine.

Comment Form

Subscribe to Feed

Categories

Calendar

May 2009
M T W T F S S
« Apr   Jun »
 123
45678910
11121314151617
18192021222324
25262728293031