0
Well, if someone knows how to create a pagination for a page that displays the images added in Wordpress, I would appreciate the help, the code I’m 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 at the end I tested a pagination template I found on Wordpress Codex, but it didn’t work. If you want to see how it is now the link is this: http://g-y.one/erus
Thanks in advance.