wp_dropdown_cats example

$categories = get_categories( array('hide_empty' => 0) );

    if ( $categories ) {
        foreach ( $categories as $category ) {
            if ( $current_cat != $category->term_id && $category_parent == $category->parent) {
                $pad = str_repeat( '– ', $level );
                $category->name = esc_html( $category->name );
                echo "\n\t<option value='$category->term_id'";
                if ( $current_parent == $category->term_id )
                    echo " selected='selected'";
                echo ">$pad$category->name</option>";
                wp_dropdown_cats( $current_cat$current_parent$category->term_id, $level +1, $categories );
            }
        }
    } else {
        return false;
    }
}

/** * Register a setting and its sanitization callback * * @since 2.7.0 * @deprecated 3.0.0 Use register_setting() * @see register_setting() * * @param string $option_group A settings group name. Should correspond to an allowed option key name. * Default allowed option key names include 'general', 'discussion', 'media', * 'reading', 'writing', and 'options'. * @param string $option_name The name of an option to sanitize and save. * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value. */
Home | Imprint | This part of the site doesn't use cookies.