M
M
Maxim2016-01-15 23:50:20
WordPress
Maxim, 2016-01-15 23:50:20

Wordpress pagination. Sees pages, but does not want to open - 404?

Hi all. I've blown my brains out already. On a normal /rent page, I output a cycle with posts through WP_Query. Knowingly passing there paged defined with

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>

And I'm trying to display pages using this self-written code:
<?php if ($query->max_num_pages > 1) : ?>
  <div class="content-panel-body pagination">
    <?php if ($paged > 1) : ?>
      <a class="prev page-numbers" href="/rent/page/<?php echo $paged - 1; ?>"><i class="fa fa-angle-left"></i>Назад</a>
    <?php endif; ?>
    <span class="page-numbers current"><?php echo $paged, ' из ', $query->max_num_pages; ?></span>
    <?php if ($paged != $query->max_num_pages) : ?>
          <a class="next page-numbers" href="/rent/page/<?php echo $paged + 1; ?>">Вперёд<i class="fa fa-angle-right"></i></a>
    <?php endif; ?>
  </div>
<?php endif; ?>

It shows that 1 of 4 pages > Forward. I press forward. A 404 page opens. That's it. Help what is the problem.
update: Problem solved. There was a name mismatch. The page (rent) on which records of the rent type were displayed. Output was displayed, and a discrepancy with pagination occurred. Changed the page to rental.

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