Hi Nigel,
Okay, I've reviewed the documentation on wpv_filter_query, but I'm a little bit out of my depth, so let me back up and ask a few more specific questions. Let's start from this page on the site-under-development, which is using a series of Views (three different ones) to produce a blog landing page:
hidden link
By the way, the posts shown are vanilla WordPress posts belonging to one specific category, "Executive Director's Blog".
From there, the reader will click on any post title or "continue reading" link to get to a single post. Let's use the May 6, 2021 "Spiked Proteins" post as our test case. So we click on the link and go to:
hidden link
So this is the single post work-in-progress, and what you'll currently see down beneath the Read the Next Post subheading are my failed attempts to display the next post from the Executive Director's Blog category chronologically, which should be October 1, 2020 "Crane-iotomy", but is currently the most recent post in that category.
An important note: Currently the actual content for the Spiked Protein post shown on the single page is displayed via native Divi functions, not a Toolset view. But I am employing a view (slug: next-post-executive-directors-blog) to try to get the "Next Post".
A few questions:
1) I'd love to stick with this approach (Divi for the main entry, View for the Next Post), but would somehow need my next-post-executive-directors-blog view to know what the current post is, and then to find the next one in the sort order. But I don't know how (or even if it's possible) to create a view that filters the query to begin with the current post (which of course only makes sense in the context of a single-post page or template).
2) I did have the idea to display the entire contents of the page with a view, but I still have a similar question: i.e., how within the context of a view to query for the current post? If the wpv_filter_query hook is part of the process, I'm not clear where I would utilize it; is it used somewhere in the view configuration, or is it dropped in somewhere else and then referenced somehow?
Looking at your directions, you wrote:
One way you could do that is using a View [so far so good], set to query the posts of the relevant type [done], and then use the wpv_filter_query hook to modify the query arguments [that's what I'm not sure how to do]. Specifically, you would run code with the logic described above to get the ID of the next post, and then you could set the post__in query argument with that ID. [makes sense, but not sure how actually do all that!]
Hope that helps you get a sense of my expertise level... any guidance you can provide would be appreciated.
Thanks!
David