Pagination on Custom Page not working
-
I have made a page-portfolio.php within two loops:
<?php /** * Template Name: Portfolio * The template for displaying portfolio posts. * * @package Theme Name */ get_header(); ?> <div id="content" class="site-content"> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php if ( comments_open() || get_comments_number() ) : ?> <section class="section-gradient"> <div class="container"> comments_template(); </div><!-- .container --> </section> <?php endif; ?> <?php endwhile; // end of the loop. ?> <?php wp_reset_postdata(); ?> <section class="section-gradient"> <div class="container"> <div class="row"> <?php $paged = ( get_query_var('page') ) ? get_query_var('page') : 1; $args = array( 'post_type' => 'portfolio', 'paged' => $paged, 'posts_per_page' => 3 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php get_template_part( 'content', 'portfolio' ); ?> <?php if ( comments_open() || get_comments_number() ) : ?> <section class="section-gradient"> <div class="container"> comments_template(); </div><!-- .container --> </section> <?php endif; ?> <?php endwhile; // end of the loop. ?> <?php wp_reset_postdata(); ?> </div><!-- .row --> </div> </section> <section class="section-lightdark"> <div class="container"> <?php if ( function_exists('wp_bootstrap_pagination') ) wp_bootstrap_pagination(); ?> </div> </section> </main><!-- #main --> </div><!-- #primary --> <?php get_footer(); ?>
I’m using wp_bootstrap_pagination from here: github
On may Archive Pages, the navigation works, but onlay there… what is wrong?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination on Custom Page not working’ is closed to new replies.