我有两种职位类型:Teachers和Students。样本数据:教师职位类型:Teacher ATeacher BTeacher C 和学生的帖子类型:Student AStudent BStudent Cand many more students我也有一个分类法student-role,它具有一些值:InternMaster StudentPhD Student在学生职位类型中,我正在使用ACF关系将老师分配给学生。一个学生可以有多个老师。例如:Student A是Intern和分配给Teacher A和 Teacher BStudent B是,Master Student并分配给 Teacher CStudent C是,PhD Student并分配给Teacher C我想teacher C在仅显示所有student-roles的地方创建一个自定义页面。因此,有一个针对C老师的页面,它应该列出,Master Student并且PhD Student由于该分类法下有两个学生,因此该页面应列出。我试图先让所有学生,然后让所有学生角色,但不确定下一步该怎么做,有什么想法吗?$args = array( 'posts_per_page' => -1, 'post_type' => 'students', 'meta_query' => array( array( 'key' => 'acf_relationship', 'value' => 'Manual ID OF Teacher', 'compare' => 'LIKE' ) ));// get all posts for teacher with ID$all_posts = get_posts( $args );// get all student roles$tax_terms = get_terms( 'student-role');
2 回答
- 2 回答
- 0 关注
- 91 浏览
添加回答
举报
0/150
提交
取消