S
S
Sergey Volkov2021-06-22 13:43:45
WordPress
Sergey Volkov, 2021-06-22 13:43:45

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.
60d1bdbae0fe6823977423.jpeg
60d1bdc12f2a4412128009.jpeg

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:
60d1be2e351a5871476566.jpeg

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(  )
?>


I will be very glad if you help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question