Answer the question
In order to leave comments, you need to log in
Why is query_posts pagination not working?
Hello, I launched pagination, but it doesn’t work
. I click on the pagination button, it transfers me from wp/blog to wp/blog/page/2.
I think that the problem is with the file hierarchy, since I just started learning wp and didn’t fully figure it out.
This is how my hierarchy looks like:
In page.php I display all posts from all categories
In category.php I display posts with certain categories
Code:
<?php
global $query_string;
query_posts(array(
'post_type' => 'post',
'rewrite' => array (
'pages' => true
)
));
while (have_posts()) {
the_post( )
?>
<!-- HTML -->
<?php
}
the_posts_pagination( array(
'end_size' => 1, // количество страниц на концах
'mid_size' => 1, // количество страниц вокруг текущей
'prev_next' => true, // выводить ли боковые ссылки "предыдущая/следующая страница".
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'add_fragment' => '', // Текст который добавиться ко всем ссылкам.
) )
// wp_reset_query( )
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question