对于学生项目,我使用WordPress和木材(树枝)+ACF
在这个项目中,我创建了3种自定义帖子类型:dissertation
, subject-imposed
和subject-free
每个学生只能按自定义帖子类型创建一篇帖子(我为此创建了一个限制)。
但现在我想显示一个列表,列出每个学生的名字和他们的3篇帖子。
这样的列表:
Nicolas Mapple
<自定义职位类型的标题dissertation
+ 自定义帖子类型名称+图像(ACF字段)subject-imposed
+ 自定义帖子类型名称+图像(ACF字段)subject-free
+ 自定义贴子类型名称+图像(ACF字段)Brenda Smith
<自定义职位类型的标题dissertation
+ 自定义帖子类型名称+图像(ACF字段)subject-imposed
+ 自定义帖子类型名称+图像(ACF字段)subject-free
+ 自定义帖子类型名称+图像(ACF字段)$students = get_users( array(
\'role\' => \'student\',
\'orderby\' => \'user_nicename\',
\'order\' => \'ASC\'
\'has_published_posts\' => true
));
$students_id = array();
foreach ($students as $student) {
$students_id[] = $student->ID;
}
之后,从以下ID获取所有帖子:$get_posts_students = get_posts( array(
\'author\' => $students_id,
\'post_type\' => array(\'dissertation\', \'subject-imposed\', \'subject-free\')
));
$context[\'list_of_students\'] = $get_posts_students;
我发现了错误urldecode() expects parameter 1 to be string
和一个数组,但包含所有帖子,不按学生分组能帮我个忙吗?如何按学生分组帖子?