0
我想通過user_meta'org'對此表進行排序,現在按用戶名排序。請幫忙。謝謝!我想通過user_meta org排序這個表,現在它按用戶名排序。
<table width="100%" border="0" cellpadding="0">
<tbody>
<?php
// Get all users order by amount of posts
$allUsers = get_users('order=ASC');
$users = array();
// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
if(!in_array('administrator', $currentUser->roles))
{
$users[] = $currentUser;
}
}
?>
<?php get_header(); ?>
<?php
foreach($users as $user)
{
?>
<tr>
<th><?php echo get_user_meta($user->ID, 'org', true); ?></th>
<td scope="row"><?php echo $user->first_name . " " . $user->last_name; ?></td>
<td><?php echo get_user_meta($user->ID, 'pnumber', true); ?></td>
<td><a href="<?php echo $user->user_url; ?>" target="_blank"><?php echo $user->user_url; ?></a></td>
</tr>
<tr>
<?php
}
?>
</tbody>
我想循環通過帳戶名稱和元信息,並把它們放在order_by user_meta組織。請幫忙。提前致謝!
謝謝豪爾赫,我很難讓這個工作。 – Eric
對不起,我沒有真正測試代碼只是一個想法。你管理了嗎? (如果是這樣,請將我的答案標記爲有用:D) –
我閱讀了您所引用的文章,但並未完全按照我的意願進行,但我只將該組織與暱稱相匹配,並將顯示名稱更改爲暱稱,並更改了orderby = display_name感謝Jorge! – Eric