WordPress.org

Ready to get started?Download WordPress

Forums

Categories in Alphabetical Order (30 posts)

  1. blazzinmatt
    Member
    Posted 10 years ago #

    At my site http://www.thelastpageonthenet.com/blog/ I have my categories entered in different order other than alphabetical but I would like them to be on my site in alphabetical order so it reads: daily life, general, fun/humor, then links. Is there anyway to sort categories in alphabetical order.

  2. blazzinmatt
    Member
    Posted 10 years ago #

    Yup the 'sort_column=name' fixed it very nicely. Thank you very much :)

  3. kttygoesrawr
    Member
    Posted 9 years ago #

    That no longer works for my WordPress version 1.5. Anybody have any idea why?

  4. kjarrett
    Member
    Posted 9 years ago #

    Same question here ... anyone ... anyone ... Bueller?

  5. ronzo
    Member
    Posted 9 years ago #

    Also have that problem using 1.5. I've tried varying all the parameters for list_cats found in the Codex for template tags, and I can't get the categories to sort at all in the sidebar. Even tried changing 'name' to 'cat_name', which is the database field name. Still no go.

    Anyone have a solution to sort the categories alphabetically in the sidebar?

  6. iand
    Member
    Posted 9 years ago #

    <?php wp_list_cats('sort_column=name'); ?> works for me (WP1.5)

  7. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    Replace your wp-includes/template-functions-category.php file with this updated version.

  8. ronzo
    Member
    Posted 9 years ago #

    thanks ryan,

    the updated template-functions-category.php file works for me using list_cats (I am not using wp_list_cats) !

    thanks again

  9. laurenz
    Member
    Posted 9 years ago #

    I also have the problem that my categories are not listed correctly (fortunately, I copied my photolog to a test environment beforehand, so the version you see now is not yet upgraded).
    When I substitute the file, I get the following error message:

    Fatal error: Cannot redeclare get_category_rss_link() (previously declared in /.../testwp/wordpress/wp-includes/template-functions-category.php:43) in /.../testwp/wordpress/wp-includes/feed-functions.php on line 104

    Restoring the old version at least brings back the photolog, but with unsorted categories.
    I am using <?php wp_list_cats('sort_column=name'); ?>
    in my template.

  10. opengeek
    Member
    Posted 9 years ago #

    Has anyone figured out the problem with this, as I cannot get my categories to sort alphabetically in WordPress 1.5, using wp_list_cats() or just list_cats() with the appropriate options. I tried downloading that updated template-functions-category.php file, but no change in behavior. Anyone have ideas if this is a known bug or if anyone has a work-around as of yet?

  11. shaky
    Member
    Posted 9 years ago #

    Same here. Also not displaying post count

  12. shellshear
    Member
    Posted 9 years ago #

    I too have been having problems with this and WordPress 1.5 - list_cats() partially works, in that it lists the items alphabetically, but my use of categories is a little more complex.

    I'm using wordpress to maintain a film criticism website (www.filmforensics.com). In 1.2 I had two areas of categories: one a list of genres (comedy, drama, etc.) and one a list of letters of the alphabet, so that you could search on either. I used the 'child_of' option to sort them into the two sublists, but, with the same code, that no longer works. The parent of the alphabetical categories had ID 10:

    <?php list_cats(1, 'all the films', 'name', '', '', 1, 0, 1, 1, 1, 'TRUE', '10', '', '', '', '', ''); ?>

    ...and this now lists all the entries, not just those under ID 10. Having said that, they are alphabetical!

    Could it be changes in the version of php required?

  13. pericat
    Member
    Posted 9 years ago #

    I wrote a plugin last week that you might find helpful:

    http://wordpress.org/support/topic.php?id=24026

    Dunno if it will solve your problem, but it might be of some use meanwhile.

  14. kjarrett
    Member
    Posted 9 years ago #

    Thank you Ryan! Sorted categories AND post counts! And, no messy code editing, just a file replacement. Niiiiiiiiiiiiiiiiiiiiice. I love this forum!

    -kj-

    kj99gt

  15. Lisch
    Member
    Posted 9 years ago #

    Thanks, ryan. The updated template-functions-category.php now sorts the categories correctly. One minor problem remains, namely, that hierarchical categories are not listed at all unless the parent category is listed.

    The workaround is simple: ensure that each parent category has at least one post.

  16. emmadw
    Member
    Posted 9 years ago #

    Just found this thread, which sorted out the problem that I had - I thought I was going mad, as I couldn't persuade it to sort alphabetically.
    Also, switching from using list_cats to wp_list_cats, meant that it was far easier to read.

  17. jabley
    Member
    Posted 9 years ago #

    woo-hoo!!! I thought I was going nuts. I tried screwing with the code and nothing worked...but replacing that file AND putting
    <?php wp_list_cats('sort_column=name'); ?>
    sure did.

  18. anywho
    Member
    Posted 9 years ago #

    Thanks, Ryan! Worked like a charm. Lisch, I tried downloading the newest template-functions-category.php from the nightly builds, but dropping that in my 1.5 setup didn't work. I'm not sure if that is the newest file you meant, but I just thought I'd warn others about that. I realize nightly builds are unstable; I was just curious. ;)

  19. jokeofalltrades
    Member
    Posted 9 years ago #

    Well, damn. It's not working for me. Here's the relevant section of my sidebar template:
    <li id="categories"><?php _e('Categories:'); ?>
    <ul>
    <?php wp_list_cats('sort_column=name'); ?>
    </ul>
    </li>

    I tried updating template-functions-category.php with the newer version, and it had no effect. You can see that the categories aren't being sorted here:
    http://www.jokeofalltrades.com/poetry/

    It's a clean 1.5 install with a theme that's a straightforward adaptation of the WordPress Classic theme. I didn't tweak any of the important stuff, really; mostly just the CSS. I would really like to have the categories sorted alphabetically, but I don't want to do it manually. Any ideas what's going wrong? Thanks...

  20. OrchidRed
    Member
    Posted 9 years ago #

    Thanks Ryan! Worked like a charm for me!

  21. EndPeg
    Member
    Posted 9 years ago #

    Thanks! Had exactly the same problem and it only worked after updating the template-function-category.php file.

  22. brachiator
    Member
    Posted 9 years ago #

    Thanks, Ryan. The revised file fixed up my problem, too, in conjunction (of course) with changing the sort parameter in the file to "'name'" from the default "'ID'".

    What strikes me as very odd, though, is that the Sidebar template in the default (Kubrick) theme has a place for sort order to be specified where it calls the function list_cats -- and the Codex even points one to this line in addressing the issue of Categories sort order. I don't quite understand why the Sidebar template is overruled by the file in wp-includes, instead of the other way around.

    I am just a newb with WP, though.

  23. josalmon
    Member
    Posted 9 years ago #

    I didn't have any problems changing the order of the categories.

    Just replaced the default categories code <?php list_cats(); ?> with this:

    <?php list_cats(FALSE, ' ', 'name'); ?>

    Easy as pie!

  24. nwistheone
    Member
    Posted 9 years ago #

    thanks for this topic guys. i had same prob with 1.5, but dl'd the updated file & everything worked. :P

  25. carl_in_florida
    Member
    Posted 9 years ago #

    Thanks Ryan!!!!!!!

  26. hikm
    Member
    Posted 8 years ago #

    I guess I can't do this for WordPress.com, can I?

  27. meetjustin
    Member
    Posted 8 years ago #

    Problem solved for me - I love this forum!

  28. ScottMSU
    Member
    Posted 8 years ago #

    I am using the new wordpress replaced wp-includes/template-functions-category.php and now im getting a weird statement at the end of every post...PLEASE help!!!

  29. ZachGates
    Member
    Posted 8 years ago #

    As others, I tried Ryan's new file, but then it made my categories as listed in the posts go all kerflooey. Help?

  30. your1answer
    Member
    Posted 7 years ago #

    Needed this fix and it works great in v2.06... just replaced <?php wp_list_cats; ?> in my sidebar.php file with <?php wp_list_cats('sort_column=name'); ?>. Shows the sub categories too! Thanks! You can view it here: http://www.your1answer.com

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags