Answer the question
In order to leave comments, you need to log in
Any Wordpress pagination not working?
Good day.
I have a regular blog.
And the usual posts are nothing more. And I need a simple pagination.
I tried the_posts_pagination(), didn't work. I tried the WP-Paginate plugin too, nothing.
Perhaps I'm not doing something right? Code below.
<?php $args = array( 'post_type' => 'blog', 'posts_per_page' => 1 ); $loop = new WP_Query( $args ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-md-4">
<div class="blog-item_box">
<div class="blog-item_img-box"><img src="<?php the_field('img_blog-item') ?>" alt=""></div>
<div class="blog-item_title"><?php the_content(); ?></div>
<div class="blog-item_info"><?php the_excerpt(); ?></div><a class="blog-item_details-info" href="<?php the_permalink(); ?>">Узнать подробнее</a>
</div>
</div>
<?php endwhile; ?>
<?php the_posts_pagination(); ?>
Answer the question
In order to leave comments, you need to log in
try
either this https://wp-kama.ru/function/wp_reset_query
or https://wp-kama.ru/function/wp_reset_postdata
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array( 'post_type' => 'blog', 'posts_per_page' => 1, 'paged' => $paged );
$loop = new WP_Query( $args );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-md-4">
<div class="blog-item_box">
<div class="blog-item_img-box"><img src="<?php the_field('img_blog-item') ?>" alt=""></div>
<div class="blog-item_title"><?php the_content(); ?></div>
<div class="blog-item_info"><?php the_excerpt(); ?></div><a class="blog-item_details-info" href="<?php the_permalink(); ?>">Узнать подробнее</a>
</div>
</div>
<?php endwhile; ?>
<?php the_posts_pagination(); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question