I'm creating a theme in Wordpress and it's time to paginate.
I was able to create the menus below indicating how many pages have and the next and previous pages.
Just by clicking next or the page number I want to see is returning the 404 Not Found error
In the index of my template, I define 1 post per page to test this way:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$post_query = query_posts(array(
'post_type' => 'post',
'paged' => $paged,
'posts_per_page' => 1
));
// while dos posts
And this one, is the code where I create the pagination found in functions.php
function paginacao() {
global $wp_query;
$big = 999999999;
echo paginate_links(
array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
)
);
}
And, to finish, I call the function in the template this way:
<div class="paginacao">
<?php paginacao(); ?>
</div>
I think this is a problem with .htaccess, but I can not identify the problem. I already tried to change the format to /page/%#%
or /paged/%#%
but did not work.