2015-09-23 4 views
0

в WordPress я нашел как добавить настраиваемую пользовательское поле профиля 1:WordPress, как добавить несколько пользовательских пользовательское поле профиля

add_action('show_user_profile', 'yoursite_extra_user_profile_fields'); 
add_action('edit_user_profile', 'yoursite_extra_user_profile_fields'); 
function yoursite_extra_user_profile_fields($user) { 
?> 
    <h3><?php _e("Extra profile information", "blank"); ?></h3> 
    <table class="form-table"> 
    <tr> 
     <th><label for="sample"><?php _e("Sample"); ?></label></th> 
     <td> 
     <input type="text" name="sample" id="sample" class="regular-text" 
      value="<?php echo esc_attr(get_the_author_meta('sample', $user->ID)); ?>" /><br /> 
     <span class="description"><?php _e("Please enter your sample."); ?></span> 
    </td> 
    </tr> 
    </table> 
<?php 
} 

add_action('personal_options_update', 'yoursite_save_extra_user_profile_fields'); 
add_action('edit_user_profile_update', 'yoursite_save_extra_user_profile_fields'); 
function yoursite_save_extra_user_profile_fields($user_id) { 
    $saved = false; 
    if (current_user_can('edit_user', $user_id)) { 
    update_user_meta($user_id, 'sample', $_POST['sample']); 
    $saved = true; 
    } 
    return true; 
} 

, но я не знаю, как добавить несколько поля пользовательского профиля пользователя ... кто-то может мне помочь?

Спасибо за ваши ответы

ответ