0
I am creating a theme in Wordpress and the time has come to make the pagination.
I managed to create the menus below indicating how many pages have and the next and previous.
Only by clicking on next or the page number I want to see is returning error 404 Not Found
In the index of my template, I set 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 is the code where I create the pagination that is 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 finally, I call the template function this way:
<div class="paginacao">
<?php paginacao(); ?>
</div>
I think it’s a problem with . htaccess, but I can’t identify the problem. I’ve tried changing the format to /page/%#%
or /paged/%#%
but it didn’t work out.
Instead of editing the question, create a new answer with the code you used to solve the problem, so it is cataloged here for those who search later.
– Ricardo Moraleida
and don’t use query_posts is sure of headache.
– Ricardo Moraleida
OK @Ricardomoraleida. I will change the question again by inserting the answer. Thanks for the tip, the answer and not using query_posts
– Bruno Folle