我假设您将在小部件选项中提供作者ID。作者将按其列出的顺序显示。
假设输入为->3,10,12
您可以使用以下代码按顺序显示具有该用户ID的作者:
$user_ids = "3,10,12"; //this is assuming you already have the value stored in a variable
//convert the comma separated string into an array
$user_ids_array = explode(",", $user_ids);
//display the list of users
echo \'<ul>\';
foreach( $user_ids_array as $id ):
$user = get_userdata( $id );
echo \'<li>\'.$user->ID.\' \'.$user->display_name.\'</li>\';
endforeach;
echo \'</ul>\';