Pagination links appear, but new posts never load
-
In my front-page.php I’m looping over a custom post-type and I want to add pagination. The pagination links appear, but when I click its like nothing has changed. Same data appear even though URL has changed. Not sure what is wrong.
This is part of what I added when I registered the new post-type'label' => 'Tweet', 'public' => true, 'has_archive' => true, 'taxonomies' => array( 'category' ), 'rewrite' => array( 'slug' => 'tweet', 'with_front' => true ), 'supports' => array( 'title', 'thumbnail', 'editor', 'author' )
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $args = array( 'post_type' => array( 'post', 'tweet' ), 'posts_per_page' => 4, 'orderby'=> 'menu_order', 'paged' => $paged ); $the_query = new WP_Query( $args ); ?> <div class="col-md-6 col-md-offset-3"> <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div class="page-header"> <h1><?php the_title(); ?></h1> <?php if(get_post_type() === 'post') : ?> <p><?php the_excerpt(); ?></p> <?php else: ?> <p><?php the_content(); ?></p> <?php endif; ?> </div> <?php endwhile; endif; ?> <?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' => $the_query->max_num_pages ) ); ?> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Pagination links appear, but new posts never load’ is closed to new replies.