WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Arrange Category List Alphabetically? (23 posts)

  1. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Hi all...been a while since I've visited. Thanx to the incredible support I have gotten here in the past, my wife's blog has been doing great even though I (the "admin") don't know squat! However, she has added a lot of categories and they are listed in the order of creation. She would like to have them display alphabetically. I'm sure this is one of those things that falls under the "it's easy if you know how" heading. But, I don't! Any help would, as usual, be most appreciated.

    http://www.naturalfoodworks.net

    Thanx
    DD

  2. silpstream
    Member
    Posted 7 years ago #

    David,

    Depending on whether you are using 'wp_list_cats' (http://codex.wordpress.org/Template_Tags/wp_list_cats) or 'list_cats'(http://codex.wordpress.org/Template_Tags/list_cats), you'll want to add the parameter for 'sort_column'. Set the column to 'cat_name' and set the order to either 'ASC' or 'DESC'.

  3. DavidDeCristoforo
    Member
    Posted 7 years ago #

    OK, I told you I don't know squat! However, I did find the following line in a flle called "leftbar.php" (part of my Vesuvius 1.5 theme)

    <?php wp_list_cats(); ?>

    Is it safe to presume that this is where I would need to add the sort parameter?

    Thanx very kindly for your assistance.
    DD

  4. Michael_
    Member
    Posted 7 years ago #

    For getting the_category() function alphabetically:
    http://bloop.org/joey/2006/06/07/category-sort-plugin/

  5. silpstream
    Member
    Posted 7 years ago #

    Try replacing it with this:

    <?php wp_list_cats('sort_column=name&sort_order=asc'); ?>

    This should get you going. Of course you could also try the plugin that Michael suggested.

  6. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Well, I installed the plug-in and activated it but my categories are still not in ABC order. Tomorrow I will try to mod the code per slipstream's sug.

    Thanx all
    DD

  7. DavidDeCristoforo
    Member
    Posted 7 years ago #

    ARRRG! Well, the plug in not only failed to order the category list, it also caused a "bad information" warning to appear below the title of each post! So I deactivated the plug in and tried editing the sidebar template as per slipstream's suggestion. Unfortunatly this accomplished nothing other than keeping me from thinking about "the war" for a bit!

    Anyway, if anyone has any other ideas......and thanks for the suggestions...

    FF

  8. silpstream
    Member
    Posted 7 years ago #

    David,

    I'm not sure what happened when you tried to edit the sidebar. Try checking here for a bit more info:

    http://codex.wordpress.org/Template_Tags/wp_list_cats

    Goodluck!!!

  9. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Well thanx for helping. I rechecked the sidebar template and the code looks correct. Maybe I have something effed up. I posted the code for the template here:

    http://www.naturalfoodworks.net/misc/sidebar.txt

    Thanx
    DD

  10. silpstream
    Member
    Posted 7 years ago #

    David,

    I just went to check and realised that you use WP 1.5 still. I tested the same code on my site using WP2.03 and it worked fine.

    I'm not very experienced with 1.5 so can't be of much help there. Maybe you want to consider upgrading or hopefully someone else with 1.5 experience can help you.

    Sorry...

  11. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Upgrading may be in order. I was looking at the instructions and it looks like I can still use the same template in the newer version. I'll back up everything tomorrow and give it a go. Really appreciate your taking the time to help. I'll let you know how it goes.

    Thanx
    DD

  12. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Well...I upgraded (no problems!) today but I still can't get the cats to list as ABC. Nor does the plug-in work! So...back to square one. This time I uploaded all of my theme files to:
    naturalfoodworks.net/misc/
    Don't know if anyone wants to mess with this but just in case...
    At least I have the latest version now!
    Thanx
    DD

    BTW, here are the two error messages I get when i activate the plug-in:

    Warning: explode(): Empty delimiter. in /home/naturalf/public_html/wp-content/plugins/cat_sort.php on line 14

    Warning: Invalid argument supplied for foreach() in /home/naturalf/public_html/wp-content/plugins/cat_sort.php on line 14

    This appears between the heading and body of each post on the blog. Everything returns to normal if the plug-in is deactivated.

  13. DavidDeCristoforo
    Member
    Posted 7 years ago #

    It seems that there is something in my template that is blocking the alphabetical ordering of the cats list. I tried switching to a different theme and the cats were in alphabetical order. Now, if I could just figure out what.....

    DD

  14. silpstream
    Member
    Posted 7 years ago #

    Are you using the plugin or WPs built in function for sorting now?

    Also we can't access the theme files you put in misc since they all have a php extention and your server tries to parse it and only gives us the output not the code.

  15. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Oops...sorry! I reloaded text versions:

    http://www.naturalfoodworks.net/misc/

    Right now the plug-in is deactivated. I changed the code for the sort order as suggested but the cats still dont sort...

    Thanx Again
    DD

  16. silpstream
    Member
    Posted 7 years ago #

    David,
    I'm looked at the files and am having a hard time figuring out the problem. Could you zip the directory for the theme you use and post it somewhere. I'll download it and test it in my WP install to see if I can find the problem.

    On a side note you may want to try the navigation plugin I wrote WP-dTree (http://www.silpstream.com/blog/wp-dtree/). It replaces the navigation that you use, so I'm not sure if you'll like it, but it does have the ability to do the sort.

  17. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Uploaded a zip to:
    http://www.naturalfoodworks.net/misc/
    Thanx Aginn
    DD

  18. silpstream
    Member
    Posted 7 years ago #

    David,

    Just tested it. The theme looks nearly the same as the default theme that comes with WordPress. Is this correct?

    Anyhow, the category sorting works prefectly well for me when I apply the changes to the theme you provided.

    I would have thought that the theme you would send me should look like what you have on your website. Are you sure you sent the right files?

  19. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Um...er...well...ahhh...let me see....
    I reloaded the archive (same URL). These are the files that I'm using (unless I'm going nuts!). The default template does seem to have the same files but to be sure, I re-downloaded the template files from the server, re-zipped them and re-uploaded them. Maybe I am going nuts!

    DD

  20. DavidDeCristoforo
    Member
    Posted 7 years ago #

    OK wait a minute...I think I may actually be going nuts! It would seem that the files I zipped are NOT the correct ones. The correct files are now stored in a theme named "Carrots"! Somehow my "naturalfoodworks.net" theme has been replaced by the same files that are used for the default theme. PLEASE do not ask me how this happened because I have no idea. In any case, I zipped up the "Carrots" files and uploaded them to the above directory....
    Whew...what a day....

    DD

  21. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Well "slip"...with your persistent help, I finally got this sorted out! I found the wp_list_cats line in the CORRECT document, replaced it with the code you posted (what...two days ago?) and "presto"! Alphabetized cats list!

    Next time you are in Davis (CA), look me up...I owe you a steak dinner!

    Thanx Again
    DD

    PS I would LOVE to know how my templates got renamed....

  22. silpstream
    Member
    Posted 7 years ago #

    lol... Don't worry about it... it happens to the best of us... However I really wouldn't know where to begin with the renaming of themes... ;p

    Good to know you got things fixed... but I'm not sure if I'll get to Davis... just got back from LA and am heading to Singapore in 2 days time for work... It'll be a while before I get back.

    Anyhow, I'm just glad you sorted it out. BTW, you may want to mark this post resolved so that other don't have problems sifting through the open topics. Also remember to delete the files you left in the misc folder.

    Cheers!

  23. DavidDeCristoforo
    Member
    Posted 7 years ago #

    Done...and thanx again for all the help.

    DD

Topic Closed

This topic has been closed to new replies.

About this Topic