Business Card: bowen@dwelle.org
Smoothbeats.com
KALX Berkeley    WSUM radio

WFMU radio

After a bit more WP hacking, I’m starting to agree that the code is “pretty darn ugly”:http://neo.dzygn.com/archive/2004/05/switching-to-wordpress. Partly that’s PHP’s fault; it tends to encourage a very *BASIC* style of coding, but the code certainly could be cleaner and more understandable.

For example, I just now wanted to figure out how to display field labeled as “tagline” on the General Options screen. I had to grep the source for the _bloginfo_ function, which is in template-functions-general.php. _bloginfo_ calls _get_settings_, passing along a named parameter that is *DIFFERENT* than that which it was called with — bloginfo(’description’) calls _get_settings(’_blogdescription_’). But of course I didn’t know this was the field I wanted yet, because “description” isn’t “tagline,” is it? Looking at _get_settings_, it calls _get_alloptions_, which reads from _$tableoptions_. Of course, if I wanted to find out the real table name, I’d have to find where that variable is defined, but by now I know to go straight to mysql. Opening up PhpMyAdmin, I browse the _options_ table, and find my tagline text in the _blogdescription_ field. So now I know to call bloginfo(’description’) when I want the tagline, I mean blogdescription. *Ugh, Ugh, Ugly.*

Support for categories is pretty weak, and I’ve already had to do a fair bit hacking to make them really work. Lots of functions return chunks of HTML with embedded formatting, etc — not good behavior in my book. I don’t know much about CSS, but the stylesheet seems more complicated than it needs to be. Who needs seven layers of inheritance? At some point I’ll go back and rip out all the extra styles.

There isn’t a builtin function for displaying a list of recent posts, so I grabbed “this one”:http://mtdewvirus.com/wp-hacks. It didn’t provide for limiting the list of recent posts by category, so I made a v1.02 — you can “download it here”:http://www.dwelle.org/index.php?p=139.

2 Responses to “More on wordpress”

  1. Mark Wubben says:

    Hi Bowen,

    I am wondering, have you based your statement “It turns out the code is pretty darn ugly.” on my post or is it your personal opinion as well? Please clarify, because it is my personal opinion.

  2. Matt says:

    If you looked at the documentation for bloginfo() or just did a fulltext search on the wiki for “description” you wouldn’t have had to jump around so much. For grabbing posts you might want to check out the get_posts function or in post-1.2 the query_posts() function.

Leave a Reply