Support » Fixing WordPress » alphabetizing caegories by last name but displaying full name?

  • The problem with the following wp_list_cats is obvious:
    J comes before C. How can I alphabetize these cats by last name? Ideally I’d make the category names just the last names and display the Cat Descriptions, where I’d put the full names. But I can’t get that to work.

    Or I’d name the categories with the URL to an image like ‘images/lastname_thumb.jpg’ but I can’t figure out a way to make that work either (I’d need to nest each cat name in an img tag to get that to work.)

    I’d actually prefer the second since I’d like to use custom icons for each category.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The template tag, wp_list_cats, only allows you access to sort_columns ID or name.

    Now this is funcky, but if you aren’t constantly adding new Categories you might try it.

    Using phpMyAdmin on your wp_categories table make your cat_name fields be:

    <!--CAO-->Maggie Cao
    <!--JAW-->Gil Jawitz

    The <!--CAO--> won’t be displayed as it will be processed as a comment by the browser but the wp_list_cats will use the whole field to sort it.

    I know, ugly and kludgy 😉

    Hmmm… that’s interesting. But is there anyway to sort by name but display the description? Or is there a more verbose loop that can achieve a similar thing to wp_list_cats but allow for more customization?

    Guess if you want ultimate flexibility start with a look at the list_cats() function in wp-includes/tempate-functions.php (starting at line 277).

    The problem with categories is the complexity of the parent idea. Also be mindful that version 2.1 (or whatever the next BIG release is numbered) changes the whole category process including combining link and post categories in the same table.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘alphabetizing caegories by last name but displaying full name?’ is closed to new replies.