ThemeForest

Load more posts Wordpress

153 posts
  • Exclusive Author
  • Has been a member for 0-1 years
  • Sold between 1 000 and 5 000 dollars
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!

2934 posts
  • Community Superstar
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
  • United States
  • Exclusive Author
chrisakelley 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

2358 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Europe
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Sold between 100 and 1 000 dollars
  • Microlancer Beta Tester
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
  • Exclusive Author
  • Has been a member for 0-1 years
  • Sold between 1 000 and 5 000 dollars
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 :)

2358 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Europe
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Sold between 100 and 1 000 dollars
  • Microlancer Beta Tester
digitalimpact says

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

No problem buddy, glad to have helped :)

by
by
by
by
by