Support » Fixing WordPress » Adding Multiple Category Dropdowns

  • Resolved dmx09

    (@dmx09)


    Hi,

    I’m building a site that will require multiple dropdowns, each displaying a different category like so:

    Genre (Dropdown 1)
    Rock
    Alternative
    etc

    Tempo (Dropdown 1)
    Fast
    Slow
    etc

    I can easily display ‘All’ categories using the following: (taken from the codex)

    <?php wp_dropdown_categories('show_count=1&hierarchical=1'); ?>

    I’m just not sure how I can have multiple instances, each displaying a different category..

    This doesn’t seem to work, when I add &cat=26 at the end of the line of code:

    <?php wp_dropdown_categories('show_count=1&hierarchical=1&cat=14'); ?>

    <?php wp_dropdown_categories('show_count=1&hierarchical=1&cat=26'); ?>

    Any suggestions would be most appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi dmx09,
    for this purpose you can use
    <?php wp_dropdown_categories('show_count=1&hierarchical=1&child_of=25');?>

    dmx09

    (@dmx09)

    That works a treat, many thanks!

    At the moment it only displays the categories which have posts attached to them, is there a way to show all categories regardless of whether there are associated posts?

    I’ve added &show_option_all but it still only shows populated categories.

    <?php wp_dropdown_categories('show_count=1&hierarchical=1&child_of=26&show_option_all');?>

    extatix

    (@extatix)

    dmx09

    (@dmx09)

    Thanks, thats where I got the &show_option_all code from.
    I’ll have another look, maybe I missed something.

    extatix

    (@extatix)

    ‘hide_empty’ => 1,

    dmx09

    (@dmx09)

    Fantastic, many thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding Multiple Category Dropdowns’ is closed to new replies.