<?php 
    // display country flag in case a country is selected for this user
}
function usercountry_field()
{
    global $user_ID;
    if (preg_match('&profile.php&', $_SERVER['REQUEST_URI'])) {
        $id = $user_ID;
    } elseif ($_REQUEST['user_id']) {
        $id = $_REQUEST['user_id'];
    }
    $usercountry_id = get_user_meta($id, 'usercountry_id');
    ?>
    <!-- Country profile field HTML -->
    <table class="form-table">
    <h3>Country</h3>
    <tr>
        <th><label for="country"><?php 
示例#2
0
function usercountry_field()
{
    global $user_ID;
    if (preg_match('&profile.php&', $_SERVER['REQUEST_URI'])) {
        $id = $user_ID;
    } elseif ($_REQUEST['user_id']) {
        $id = $_REQUEST['user_id'];
    }
    $usercountry_id = get_user_meta($id, 'usercountry_id');
    ?>
    <!-- Country profile field HTML -->
    <table class="form-table">
    <h3><?php 
    esc_html_e('Country', 'crystalskull');
    ?>
</h3>
    <tr>
        <th><label for="country"><?php 
    esc_html_e("Select country", 'crystalskull');
    ?>
</label></th>
        <?php 
    if (!isset($usercountry_id[0])) {
        $usercountry_id[0] = '';
    }
    ?>
        <td><?php 
    usercountries_form($usercountry_id[0]);
    ?>
        	<!-- <span class="description">You can write a description here if you want</span> -->
        </td>
    </tr>
     <tr>
        <th><label for="city"><?php 
    esc_html_e('City', 'crystalskull');
    ?>
</label></th>
         <td><input class="text-input" name="city" type="text" id="city" value="<?php 
    the_author_meta('city', $id);
    ?>
" /></td>
    </tr>
    </table>
<?php 
}