Support » Plugins and Hacks » Hacks » WP Dropdown Categories Arrangement

  • Resolved Timoxendale

    (@timoxendale)


    Hey, I have been searching around but I couldn’t find what I needed, I was hoping someone would be so nice and help me out.
    So far I have the code:
    <?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?>
    Which displays all the categories in a drop down list, what I am trying to find out is how can I sort the list so it looks like:

    Main category 1
    – sub category 1
    – sub category 2
    Main category 2
    – sub category 1
    – sub category 2
    Main category3
    – sub category 1
    – sub category 2

Viewing 1 replies (of 1 total)
  • Worked it out

    `<?php $drop_cat = array(
    ‘orderby’ => ‘ID’,
    ‘order’ => ‘ASC’,
    ‘hide_empty’ => 0,
    ‘hierarchical’ => 1,
    ‘name’ => ‘cat’,
    ‘tab_index’ => 10,
    ‘taxonomy’ => ‘category’,
    ‘hide_if_empty’ => false
    ); ?>

    <?php wp_dropdown_categories( $drop_cat ); ?> `

Viewing 1 replies (of 1 total)
  • The topic ‘WP Dropdown Categories Arrangement’ is closed to new replies.