In worpress has anyone been anyone been able to change the category checkboxes to a category dropdown box when a user is posting? I was looking through admin-functions.php and found the following code. I have posted what they have and my attempts to get the dropdown to get wordpress to capture the "selected" category in the dropdown. Right now the only thing that is happing is it is just capture the default category regardless of what is selected. If there is a plugin that can do this well that would be helpful too.

Thanks, Ryan


Their function:

Code:
function write_nested_categories( $categories ) {
    foreach ( $categories as $category ) {
        echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( $category['cat_name'] ), "</label></li>";

        if ( $category['children'] ) {
            echo "<ul>\n";
            write_nested_categories( $category['children'] );
            echo "</ul>\n";
        }
    }
}

My Rewrite:

Code:
function write_nested_categories( $categories ) {
    echo "<select>\n";
    foreach ( $categories as $category ) {
        echo '<option id="category-', $category['cat_ID'], '" value="', $category['cat_ID'],  '" name="post_category[]" >', $category['cat_name'], '</option>     ';

        if ( $category['children'] ) {
            echo "<ul>\n";
            write_nested_categories( $category['children'] );
            echo "</ul>\n";
        }
    }
    echo "</select>\n";
}