неправильно работает пагинация wordpress
-
<div class="cards cards--news"> <?php // Запрашиваем продукты $query = new WP_Query([ 'post_type' => 'news', 'posts_per_page' => 2, 'paged' => get_query_var('paged') ?: 1 ]); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div class="card"> <div class="card__header"> <h3 class="card__title card__title--news"> <a class="card__link" href="<?php the_permalink($post) ?>"> <?php the_title() ?> </a> </h3> </div> <div class="card__data"> <time class="card__time" datetime="<?php echo get_post_time('Y-m-d'); ?>"> <?php echo get_post_time(' j F Y', false, null, true); ?> </time> </div> <div class="card__description"> <span> <?php the_content() ?> </span> </div> <a class="card__detail" href="<?php the_permalink($post) ?>">Подробнее</a> </div> <?php } wp_reset_postdata(); } echo paginate_links([ 'base' => user_trailingslashit(wp_normalize_path(get_permalink() . '/%#%/')), 'current' => max(1, get_query_var('page')), 'total' => $query->max_num_pages, ]); ?> </div> <!-- /.cards -->
Просмотр 2 ответов — с 1 по 2 (всего 2)
Просмотр 2 ответов — с 1 по 2 (всего 2)
- Тема «неправильно работает пагинация wordpress» закрыта для новых ответов.