I have a job site but i want to set drop down with roles i have 2 roles candidate and employer so i want to set a drop down select they roles i am using woocommerce registration and login i want to integrate dropdown with that roles for registration and login woocommerce.
function wp_dropdown_roles( $selected = '' ) {
$p = '';
$r = '';
$editable_roles = array_reverse( get_editable_roles() );
foreach ( $editable_roles as $role => $details ) {
$name = translate_user_role($details['name'] );
if ( $selected == $role ) // preselect specified role
$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
else
$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
}
echo $p . $r;
}
Try this :