• Resolved msadventures

    (@msadventures)


    Hi all – I’ve just put a code in the sidebar of my theme for dropdown categories, and it worked fine on earlier versions of WP, but now the alphabetizing doesn’t work in 2.3, can anyone help?

    Here’s the code I’m using:

    <ul>
    <li>
    <form action="<?php echo $PHP_SELF ?>" method="get">
    <div style="text-align:center">
    <p><?php dropdown_cats(TRUE, 'Choose...', 'NAME'); ?></p>
    <p><input type="submit" name="submit" value="Go!" /></p>
    </div>
    </form>
    </li>
    </ul>

    TIA!
    Michelle

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter msadventures

    (@msadventures)

    I’ve been searching around, trying to figure out how to fix this. So far I’ve tried switching to just this:

    <?php wp_dropdown_categories(); ?>

    but again, can’t figure out how to get it to alphabetize. I’ve tried putting in sort_column=name, and that’s not working.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Try this:
    wp_dropdown_categories('orderby=name');

    The documentation: https://codex.www.ads-software.com/Template_Tags/wp_dropdown_categories

    Thread Starter msadventures

    (@msadventures)

    Ah, thanks that one worked! I’d also like to set it so that a category doesn’t show up in the window, but instead the word “Choose…” or something like that, but I can’t quite figure out, from that link you gave me, how to fix it to say that. I know I need to fix one of those variables, but I’m not sure what I need to enter or leave out as far as that code in the “default” box, if that makes any sense.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    You’d either use show_option_all or show_option_none, depending on what you want the “Choose…” itself to do.

    Like so:
    wp_dropdown_categories('orderby=name&show_option_all=Choose...');

    Or so:
    wp_dropdown_categories('orderby=name&show_option_none=Choose...');

    Or even both:
    wp_dropdown_categories('orderby=name&show_option_all=Choose...&show_option_none=---');

    That last one uses the “none” as a separator.

    Thread Starter msadventures

    (@msadventures)

    Aha! That first one was just what I was after, thanks Otto! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Alphabetizing dropdown categories in 2.3’ is closed to new replies.