您可以使用get_adjacent_post() 和过滤器get_previous_post_where 或get_next_post_where. 你会打电话的get_adjacent_post() 正常,但您需要更改LIMIT 至5,使用过滤器。
从这个问题上,我不确定你是否想让现在的职位成为第一位。如果需要,则需要设置LIMIT 到4,然后使用当前postdata生成第一篇文章。
我将创建一个post id数组,然后使用get_post() 当你遍历它们时,我相信get_adjacent_post() 将从数据库返回原始行。