2

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:

  1. 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.
  2. 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

closed as off-topic by gmazzap, kaiser Sep 22 '14 at 16:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

0

Here's the direction to go, I think:

The WP Infinite Scroll plugin works by identifying your page's navigation and then, I think, loading the next link found there. So instead modifying the query on single.php, I'm now trying to modify the pagination.

I've tried several pagination functions, such as posts_nav_link() and twentytwelve_content_nav( 'nav-below' ), neither of which displays a thing on single.php, and previous_post().

previous_post() displays a link to one additional post, but never more than one additional post is loaded. I don't understand why infinite scroll works on index.php but not single.php.

Maybe if I can get twentytwelve_content_nav( 'nav-below' ) to work on single.php, all will be well.


I found posts on similar topics, but none of the answers have worked for me so far.

Using loop pagination on single.php

Not the answer you're looking for? Browse other questions tagged or ask your own question.