I have a problem similar to the author of this thread: Possible to paginate on single.php?
I am trying to enable infinite scrolling on single.php. So far I successfully load an additional 1 post when I reach the bottom of the page, but I'd really like to load more.
I've diagnosed the problem several ways:
- Perhaps the original query returns only the two posts, and that's why no more appear. In this case, how do I expand the original query to include more posts? I figure it has something to do with using pre_get_posts, but I haven't succeeded yet.
- Perhaps, after outputting the original single post (I want the original single post to be first), I can overwrite the original query. I tried get_posts, new WP_Query, query_posts... but again I don't understand these well enough (I did read the Codex). And although I sometimes succeeded in displaying more than two posts, those posts were included in the original HTML, and so the infinite scroll functionality was skipped.
Can anyone point me in the right direction? Has anyone succeeded in doing this?
Other posts I read had people respond confused as to why someone would want multiple posts on single.php. I want an infinite scroll functionality on single.php because my visitors land on a single post often enough. That being the case, I'd like to optimize this page by encouraging them to read more by having more posts once they reach the bottom of the page. Catch my drift? It might all be a failure but the team wants to try it.
Thanks for reading. -Miguel