6

Here's the case I got: I've setup post pagination for my website and everything works well. Except one thing - on every new page request all the resources are loaded again. This makes the website loading slow and breaks the user experience.

What I want to do is to load the content of the separate pages by ajax and replace them. The prev and next rel tags are setup so this won't be a problem for search engines to understand my content because they'll follow the tags.(correct me if I'm wrong)

However, I cannot find a way to do it because the post pages do not have a separate entry in the database. Any ideas how I can accomplish this?

Edit: I'm using <!--nextpage-->tag to separate my posts into pages.

5
  • 1
    Rather than querying the post pages as a whole, you can do a WP_Query via Ajax and return just the pages you need. There's a great plugin that does all of this - Ajax Load More - you could possibly have a look at how they do it and learn from that.
    – Tim Malone
    May 4, 2016 at 21:22
  • The problem is that I insert <!--nextpage--> tags to separate my posts into pages and the pages are not in different rows in the database. So the separation happens in the code but have no idea where to look for it. The wp_link_pages() function uses the global var $numpages somehow.
    – Gadzhev
    May 4, 2016 at 21:27
  • Ohh right, I misunderstood your question - thought you were talking about posts page pagination (ie archive pages). I haven't worked with this personally so I'll let someone else answer, but I'd probably start by looking into core for clues on how it's done there.
    – Tim Malone
    May 4, 2016 at 21:31
  • 1
    This tag seems to use wp_link_pages(), I suggest to start from there. Side note: Im glad you're considering the option to ajaxify that because multi-page posts are the most annoying trend right now. I hate these TOP-10s which are sliced into 10 pages.. It's usually instant close tab for me. Just a thing to consider. :-)
    – N00b
    May 4, 2016 at 21:53
  • 2
    I actually found a way to do it. Using the global var $pages which holds the separated pages of the post in an array. And yes, sometimes its annoying. That's why I'm gonna provide option to the users to view it as a single page and store their preferences. :)
    – Gadzhev
    May 4, 2016 at 22:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.