pagination not working
-
Hello!
Please tell me what the problem is.I use function paginate_links.
As described here (codex).
Here’s a screenshot of the entire cycle.Here is code:
<?php $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $announcements = new WP_query(array('post_type' => 'announcements', 'posts_per_page' => 3, 'paged' => $paged, 'order' => 'ASC')); ?> <?php if ($announcements->have_posts()) : while ($announcements->have_posts()) : $announcements->the_post(); ?> <div class="ann-block"> <h4 class="ann-title"><? the_title(); ?></h4> <p class="date"><? echo get_the_date('F j, Y'); ?></p> <p class="text"><?php echo excerpt(70); ?></p> <a href="<? the_permalink(); ?>" class="more">Read More</a> </div> <?php endwhile; ?> <div class="col-md-12 pagination"> <?php $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $announcements->max_num_pages ) ); ?> </div> <?php else: ?> <!-- no posts found --> <?php endif; ?>
Pagination appears. But pages do not work ?? Get the 404 th
p.s. sorry for my bad english) and, if possible, answer in simple terms, that would be easy to understand.
Thank U!)
- The topic ‘pagination not working’ is closed to new replies.