我使用以下短代码和功能来显示一些部门的成员:
add_shortcode( \'list_of_members\', \'members_listing\' );
/* usage: [list_of_members department = \'psychology\'] */
function members_listing( $department ) {
$members = get_users( array( \'meta_key\' => \'department\', \'meta_value\' => $department ) );
echo \'<ul>\';
foreach ( $members as $member ) {
echo \'<li>\' . $member->first_name . \' \' . $member->last_name . \'</li>\';
}
echo \'</ul>\';
}
我想按字母顺序排列用户
last_name
. 我该怎么做?
我受到了这个启发question/answer, 但我并不完全理解。