I have the following code to list taxonomy terms in a drop down list. It works great, except the list in the drop down isn't in alphabetical order. How do I modify the code to list them alphabetically?
<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$term_id = 279;
$taxonomy_name = 'categories';
$termchildren = get_term_children( $term_id, $taxonomy_name );
echo '<select name="' . $taxonomy_name . '" onchange="this.form.submit()">';
echo '<option selected>Branding...</option>';
foreach ( $termchildren as $child ) {
$term = get_term_by( 'id', $child, $taxonomy_name );
$link = get_term_link( $child, $taxonomy_name );
echo '<option value="'.$term->slug.'"><a href="' .esc_url( $link ) . '">' . $term->name . '</a></option>';
}
echo '</select>';
?>
<noscript><div><input type="submit" value="View" /></div></noscript>
</form>