<?php
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$args = array(
'posts_per_page' => '30',
'post_type' => 'attachment',
'paged' => $paged
);
$myposts = get_posts($args);
$the_query = new WP_Query($args);
?>
<?php while ( have_posts() ) : the_post();
global $post;
foreach( $myposts as $post ) {
setup_postdata( $post );
echo '<articlep>
<thumb>
<a href="';
the_permalink();
echo '">';
echo wp_get_attachment_image( get_the_ID());
echo '</a>
</thumb>
<ttitle>
<a href="';
the_permalink();
echo '">';
the_title();
echo '</a></ttitle></articlep>';
}
endwhile;
$big = 999999999;
paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '&paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $the_query->max_num_pages
));
?>
There in the end I tested a paging template that I found in the WordPress codex, but it did not work. If you want to see how you are now the link is this: link
Thank you in advance.