Getting Rid of Lists
-
If you’re tired of messing with CSS to get your lists to look right (since WP renders everything as lists), here’s a way to get rid of them. There is an alternate list-free tag (or parameter) for each WP function that uses lists. Make these substitutions and manually delete the UL and LI markup from your index.php, and your bullet- and indent-problems will go away. Here’s what I did:
I modified wp_list_cats() by adding the parameter list=0, like this: wp_list_cats(‘list=0’)
I used get_archives() with parameters specifying BR tags instead of LI tags
I used get_links() for each link category I wanted to display, instead of get_links_list()
I manually deleted all the other UL and LI tags in the index.php file.
Now that I’ve told you the important part, I’ll rant a little bit about the use of lists in WP, which in my book is excessive. I can think of no reason to force users (except those who can figure out how to get around it) to use lists for everything. It’s unduly complicated, because unless you use the default template, the lists are going to give you headaches. For example, I like to use a DIV to control the gray boxes in the sidebars. However, this is problematic with list items, because you aren’t supposed to have DIVs within list elements in XHTML. It can be done, but it won’t validate, and it’s messy.
There are some things that should be rendered as lists, granted. I cannot think of a single reason, though, that you should render something as a list unless you want it to have bullets or be indented. When you want neither, making a list just complicates things. Yes, CSS can handle it, but that’s not a good enough reason.
- The topic ‘Getting Rid of Lists’ is closed to new replies.