Support » Plugin: WordPress Infinite Scroll - Ajax Load More » Can't set max_pages value

  • Resolved simooo

    (@simooo)


    Thanks for a great plugin. Works great apart from an issue I’m having where I can’t seem to change the default value of 5 for max_pages.

    After a few loads the behaviour changes so that you have to click for more posts. Scroll is of course on. Any ideas what I could be missing? I’m not seeing any errors in log or console.

    Cheers!

    https://wordpress.org/plugins/ajax-load-more/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author dcooney

    (@dcooney)

    Hi simooo,
    What are you setting max_pages to? Can you confirm what is going wrong?

    Thanks for the quick reply! What I really want is to set it to infinity, but I wasn’t sure if there was an infinity setting (e.g. -1) so I started by trying some high numbers like 999 and 99, then I tried low numbers like 2. But it just doesn’t seem to have any effect, instead the default 5 pages are loaded.

    This is the code. I didn’t include it originally because it’s a bit messy to read on account of the php.

    echo do_shortcode( '[ajax_load_more tag__not_in="'.$sidebarTagId.'" offset="3" max_pages="99" scroll="true" posts_per_page="3" exclude="'.$sticky.'"]' );

    Plugin Author dcooney

    (@dcooney)

    0 would be infinity for the max_pages param.
    It actually mentions this in the shortcode builder. Under the Max Pages description 🙂

    Great to know – I couldn’t see that under Shortcode Parameters on the plugin’s page here on wordpress.org. I didn’t look further into it because I never got past the main hurdle of getting the max_pages parameter to actually take effect. Any thoughts on what could be going wrong?

    Plugin Author dcooney

    (@dcooney)

    It’s only on the shortcode builder page in your WordPress install.

    It could be a css/layout issue. Can you share a link?

    This is the page:
    http://boscomattel.com/blog

    Ah, thanks! Now that you mentioned CSS I started wondering if it had to do with there not being enough “air” beneath the load more button so that the scroll event doesn’t get triggered. i started messing with the window size and it seems this was indeed the case.

    The fact that it stopped after 5 pages was weirdly enough a coincidence that had to with the fact I’m using two columns that are loading independently and after 5 pages they happened to be of the same height.

    Is there a setting which controls how far from the bottom of the window the scroll event is triggered?

    Plugin Author dcooney

    (@dcooney)

    Yea, scroll_distance.

    Fantastic, thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can't set max_pages value’ is closed to new replies.