how to change order of "select category" dropdown so "select category" is first
-
How can I make the “Select category” option the first option in the drop down list? It will only put “Show all posts” as the first option. this is my code:
<?php $args = array('show_option_none' => 'Select category', 'show_option_all' => 'Show all posts'); ?> <?php wp_dropdown_categories( $args ); ?>
and this is the outputted html:
<select name='cat' id='cat' class='postform' > <option value='0'>Show all posts</option> <option value='-1'>Select category</option> <option class="level-0" value="1">Uncategorized</option> <option class="level-0" value="8">Blog</option> </select>
you’d think that a simple ‘orderby’ => ‘ID’ or ‘orderby’ => ‘value’ would do it, but it doesnt.. i don’t want to just make the “select category” the selected option by default because then when you’re on a specific category page it will still be selected. i just want to change the output to this:
<select name='cat' id='cat' class='postform' > <option value='-1'>Select category</option> <option value='0'>Show all posts</option> <option class="level-0" value="1">Uncategorized</option> <option class="level-0" value="8">Blog</option> </select>
- The topic ‘how to change order of "select category" dropdown so "select category" is first’ is closed to new replies.