Although WordPress provides functions to output links to next and previous posts, the hierarchical nature of long reads and their use of menu_order for sorting means that additional work is needed to enable these functions in the long read context. Up to this point, these customisations have been added within the project theme — e.g. see Lambeth Together — but it would make sense to incorporate this functionality into the plugin so that other projects can benefit.
A potential approach would be to provide replacement class methods for WordPress' next_post_link() and previous_post_link() e.g. ChaperNavigation::getNextChapter() and ChapterNavigation::getPreviousChapter(). These methods could then update the database queries that inform get_next_post_link() and get_previous_post_link(). Lambeth Together is an example of how we've approached this using filters such as get_next_post_sort and get_next_post_where.
Although WordPress provides functions to output links to next and previous posts, the hierarchical nature of long reads and their use of
menu_orderfor sorting means that additional work is needed to enable these functions in the long read context. Up to this point, these customisations have been added within the project theme — e.g. see Lambeth Together — but it would make sense to incorporate this functionality into the plugin so that other projects can benefit.A potential approach would be to provide replacement class methods for WordPress'
next_post_link()andprevious_post_link()e.g.ChaperNavigation::getNextChapter()andChapterNavigation::getPreviousChapter(). These methods could then update the database queries that informget_next_post_link()andget_previous_post_link(). Lambeth Together is an example of how we've approached this using filters such asget_next_post_sortandget_next_post_where.