On a single of my Wordpress pages (that is really a picture blog) I am using masonry.js using the Wordpress function get_posts dump all accessories to my blogs and display these questions power grid. This works fine. However, there's clearly lots of images and that i was wishing to make use of the infinitescroll.js with this particular. The only issue would be that the get_posts function, outdoors the loop, does not support the pagination and then the functionality of infinitescroll.js does not work.

This is actually the code I'm using to dump all of the accessories:

$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null ); 
$attachments = get_posts( $args );
if ($attachments) {
    foreach ( $attachments as $post ) {
        the_attachment_link($post->ID, true);

Can there be anyway of including pagination towards the original Wordpress get_posts() attachment dump outdoors from the loop, or can anybody think about an answer?

I have done such like while using 'offset' parameter for get posts.

Essentially with every new call to obtain posts, simply improve your offset amount by the quantity of new pictures you need to display every time. When the amount of pictures came back is under your offset amount, you've arrived at the finish of the posts.

Another solution is by using the pagination parameters from the Wordpress_Query class. See here for which they are.