How to create a pagination for Attachments in Wordpress

0
Well, if anyone knows how to create a pagination for a page that displays the images added in WordPress, I would appreciate the help, the code I am using is as follows:

<?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.

    
asked by anonymous 17.10.2016 / 13:16