153 posts
  • 3 Years of Membership
  • Author Level 3
  • Exclusive Author
wpminima
says

We used this tutorial: http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/ to learn more about a “load more posts” button and how to implement it.

We got it to work beautifully but there is a slight issue. When we have a custom post format with a gallery (flexslider) on the second page (e.g. the page that gets loaded) and we press the load more posts the flexslider doesn’t get loaded.

We’re sure this is something that can be fixed relatively easy but we’re just looking over it! :)

Thanks in advance!

3439 posts
  • Author Level 4
  • Collector Level 2
  • Community Superstar
  • United States
+2 more
organicbee
says

You probably want to switch to something like infinite scroll(you can have a load more post button) but it has a callback for js

2468 posts
  • 7 Years of Membership
  • Exclusive Author
  • Author Level 2
  • Collector Level 2
+3 more
digitalimpact
says

Run Flexslider in the callback function of load() :

$('.pbd-alp-placeholder-'+ pageNum).load(nextLink + ' .post',
    function() {
               // Run Flexslider here

        // Update page number and nextLink.
        pageNum++;
        nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum);

        // Add a new placeholder, for when user clicks again.
        $('#pbd-alp-load-posts')
            .before('<div class="pbd-alp-placeholder-'+ pageNum +'" />')

        // Update the button message.
        if(pageNum <= max) {
            $('#pbd-alp-load-posts a').text('Load More Posts');
        } else {
            $('#pbd-alp-load-posts a').text('No more posts to load.');
        }
    }
);
153 posts
  • 3 Years of Membership
  • Author Level 3
  • Exclusive Author
wpminima
says

Run Flexslider in the callback function of load() :
$('.pbd-alp-placeholder-'+ pageNum).load(nextLink + ' .post',
    function() {
               // Run Flexslider here

        // Update page number and nextLink.
        pageNum++;
        nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum);

        // Add a new placeholder, for when user clicks again.
        $('#pbd-alp-load-posts')
            .before('<div class="pbd-alp-placeholder-'+ pageNum +'" />')

        // Update the button message.
        if(pageNum <= max) {
            $('#pbd-alp-load-posts a').text('Load More Posts');
        } else {
            $('#pbd-alp-load-posts a').text('No more posts to load.');
        }
    }
);

Thank you so much Digitalimpact!! We owe you one :)

2468 posts
  • 7 Years of Membership
  • Exclusive Author
  • Author Level 2
  • Collector Level 2
+3 more
digitalimpact
says

Thank you so much Digitalimpact!! We owe you one :)

No problem buddy, glad to have helped :)

by
by
by
by
by
by