Reputation: 9251
I am trying to display a numbered paginated link at the bottom of my blog but they don't appear to work using the suggested method as stated on https://codex.wordpress.org/Function_Reference/paginate_links
I have a wp query which should fetch 5 posts at a time then display another page. I have 10 posts set so should definitely be seeing the pagination controls
<?php
$args = array(
'posts_per_page' => 5,
'post_type' => 'post' ,
'orderby' => 'date',
'order' => 'DESC',
'paged' => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1
);
$postslist = new WP_Query( $args );
?>
<div class="row section blog-posts">
<?php while ( $postslist->have_posts() ) : $postslist->the_post(); ?>
<div class="blog-post">
</div>
<?php endwhile; wp_reset_postdata(); ?>
<div class="page-controls">
<?php echo paginate_links(
array(
'base' => '%_%',
'format' => '?paged=%#%',
'total' => 1,
'current' => 0,
'show_all' => false,
'end_size' => 1,
'mid_size' => 2,
'prev_next' => true,
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'type' => 'plain',
'add_args' => false,
'add_fragment' => '',
'before_page_number' => '',
'after_page_number' => ''
)
); ?>
</div>
</div>
Any suggestions would be appreciated, thanks.
Upvotes: 0
Views: 49
Reputation: 7278
As based in comment above. Increasing total
param in paginate_links
to be more than 1 fixed the issue.
Upvotes: 1