WordPress.org

Ready to get started?Download WordPress

Forums

Sortable category names/tags (10 posts)

  1. Muffinboy
    Member
    Posted 9 years ago #

    Unless I'm missing something, it seems that the category names/tags that appear in the sidebar cannot be sorted. They appear in the same chronological order in which they have been created. That's annoying.
    What if I feel that my Photos category is more important than my Recipes category and should appear above it in the category listing?
    Imho the order should be user-definable and not just chronological or alphabetical.

  2. Root
    Member
    Posted 9 years ago #

    Well why not manipulate the category ids and then sort by that.? WP controls are there to be used

  3. Muffinboy
    Member
    Posted 9 years ago #

    I guess I can figure out how to sort by category ids, but I don't see how I can manipulate the category ids. It's not through the interface, is it?

  4. planetphillip
    Member
    Posted 9 years ago #

    Although it may not be the correct way, I manipulate the id's through phpmyadmin. I change the id's to increments of ten and put them (numerically) in any order I want.
    hth
    Phillip

  5. Root
    Member
    Posted 9 years ago #

    Or start a program of recycling them so the ids are in the order you want. Create a temp cat called store. Move them in there one by one in the order you want them.

  6. benramsey
    Member
    Posted 9 years ago #

    Take a look at the WordPress docs here: http://wordpress.org/docs/template/#category
    In your template, use <?php list_cats() ?> instead of the default <?php wp_list_cats() ?>. Then, you can follow the instructions at the link above to sort by name instead of by id, and you don't have to worry about hacking around in the database to change id numbers.

  7. Muffinboy
    Member
    Posted 9 years ago #

    Thanks for the tips!
    benramsey's hint appears the best solution, there is however one big problem: <?php list_cats() ?> doesn't work with subcategories (nightly 2004-08-04).
    Is this a bug that needs to be filed?
    I could see some uses for being able to _only_ retrieve the main categories, maybe that should be left in as a feature :)

  8. fitheach
    Member
    Posted 9 years ago #

    Hi, I like to agree to on what Muffinboy said. I am new to WordPress but while I configured my layout and so on, I decided, that I need a list_cats implementation where I can select only the main categories and also one, where I can select all child categories for a given main category.
    So, may be someone with a better understanding of php programming likes to implement something like that. Anyway, I will try my best.... :)
    Best regards.

  9. Root
    Member
    Posted 9 years ago #

    Check out my sorted categories at the bottom of my blog menu.

  10. Muffinboy
    Member
    Posted 9 years ago #

    Root, I'm not sure what I'm supposed to see when I look at the sorted categories on your site.
    Yes, if you use list_cats you can sort the MAIN categories alphabetically, but list_cats does not output any SUBcategories.
    I noted that at times it could come in handy that you have a way to only show the main categories of your blog and as fitheach says, it would also be nice if you could only list the SUBcategories of one particular MAIN category.
    But! the fact remains that if I use list_cats I expect it to also list SUBcategories. Or am I wrong in thinking that it should?
    Two notes:
    1) it would be even better if there was a user definable order of MAIN and SUB categories
    2) it probably is alreay possible to display just the subcategories of only one main category by excluding all other categories... but that is a lot of work that I'm sure can be handled more elegantly.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.