俱乐部网站的WordPress--会员页面 时间:2011-01-30 作者:Gus 我正在为一个学生活动创建一个网站,在一个共同的家长组下为每个成员创建一个wordpress页面。每个页面都包含一些成员信息(当前未结构化)和一张个人资料图片。我想在一个成员页面下列出所有这些成员,可能有一个由个人资料图片和姓名组成的网格。有没有插件可以做到这一点?请注意,每个成员都没有wordpress帐户。我已经找到了可以做到这一点的插件,但这不是我想要的。 2 个回复 最合适的回答,由SO网友:MikeSchinkel 整理而成 您可以考虑创建custom post type \'person\' 镜像您的用户,然后您可以通过创建single-person.php 主题模板文件。此答案提供了执行此操作的代码:Commenting in user profile page? SO网友:Bainternet 您可以使用成员列表插件该插件允许您在wordpress博客上创建一篇文章,列出所有wordpress成员。http://wordpress.org/extend/plugins/members-list/screenshots/但我会为此创建一个模板页 <ul id="membersList"> <?php /* First we set how we\'ll want to sort the user list. You could sort them by: ------------------------ * ID - User ID number. * user_login - User Login name. * user_nicename - User Nice name ( nice version of login name ). * user_email - User Email Address. * user_url - User Website URL. * user_registered - User Registration date. */ $szSort = "user_nicename"; /* Now we build the custom query to get the ID of the users. */ $listUsersID = $wpdb->get_col( $wpdb->prepare( "SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC" , $szSort )); /* Once we have the IDs we loop through them with a Foreach statement. */ foreach ( $listUsersID as $userid ) : /* We use get_userdata() function with each ID. */ $user = get_userdata( $userid ); /* Here we finally print the details wanted. Check the description of the database tables linked above to see all the fields you can retrieve. To echo a property simply call it with $user->name_of_the_column. In this example I print the first and last name. */ echo \'<li><div class="member_item">\' . ucwords( strtolower( $user->first_name . \' \' . $user->last_name ) ) . \'</div></li>\'; /* The strtolower and ucwords part is to be sure the full names will all be capitalized. */ endforeach; // end the users loop. ?> </ul> 文章导航