0

This question already has an answer here:

On this guys blog he's using infinite scroll and it's appending the page number to the url so when you click on a story and go back, you start off where you were.

I'm using infinite scrolling on a website I'm developing just now but I can't figure out how this is done, it's not a function built into the plugin.

I'm not using jetpack, I'm using the standalone plugin

Also, if I append a page number to my local installation like this

http://localhost:8888/page/2

Then scroll down, it loads in the next set of posts, then it breaks and doesn't load in anymore posts.

Is there a way to append the page number as more posts are loaded in with infinite scroll?

marked as duplicate by Howdy_McGee, Pieter Goosen, s_ha_dum Apr 9 '15 at 23:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • the script used in jetpack (and the site you linked) and the plugin you're using are two entirely different scripts, so it's not a matter of simply enabling it. download jetpack and search inside the file infinity.js for history.pushState to see exactly where the page URL is manipulated. – Milo May 5 '13 at 15:45
  • Ah, and it seems that even with jetpack in dev mode I can't use infinite scroll on a local site? I was going to use HTML5 history API to append the name of the current post in view, but when using the back button it always just shows the newest posts and you have to scroll down again to load in the ones you were previously viewing, so that's out. – andy May 5 '13 at 20:12
0

Here's the original answer.

To sum it up briefly:

  • Build a custom plugin
  • Register a custom script
  • Localize this script to add the data from $GLOBALS['wp_query'] - numberposts, posts_per_page and found_posts in it.
  • Write a custom event handler that triggers when the infinite scroll function runs.

Here's a link to the original script in the SVN trunk.

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