Infinite Scroll / Pagination
-
I’m having a bit of an issue. I have installed the Infinite-Scroll plugin and am having issues with it.
Firstly, all it says is “No Additional Posts” when, in fact, there are additional posts. I suspect this has something to do with my pagination on the homepage. Because of that thought, I deactivated the plugin and tested my pagination and sure enough, it doesn’t work. So, I got to thinking… well, maybe I need to set this as a static home page and call it a day.
I did so.
Pagination works.
Now, though, I activate Infinite-Scroll and it doesn’t work AT ALL. The regular pagination shows up.
So, I’m at a loss. I need to either get infinite scroll working on the static home page, or fix the pagination on the regular home page so that infinite scroll works properly.
My code is as follows…
Structure of page:
<!-- main section --> <section> <div class="results"> <h2>Latest From The Network</h2> <div id="results"> <?php get_template_part( 'loop' ); ?> <div class="clear"></div> </div> <div class="clear"></div> </div> </section> <!-- /section -->
Loop:
<?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } $args = array( 'post_type' => 'results', // it's default, you can skip it 'posts_per_page' => '6', 'order_by' => 'date', // it's also default 'paged' => $paged ); $wp_query = new WP_Query( $args ); ?> <?php if (have_posts()) : while( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <div class="results-item"> <!-- article --> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <!-- post thumbnail --> <img src="<?php echo get('results_image'); ?>" /> <!-- /post thumbnail --> </article> <!-- /article --> </div> <?php endwhile; ?> <!-- pagination --> <div class="pagination"> <?php html5wp_pagination(); ?> <div class="clear"></div> </div> <!-- /pagination --> <?php endif; ?>
So, what say ye? I can’t seem to figure any of it out. It’s so frustrating. I don’t mind having a static homepage, but quite honestly, I’d rather not if need be. That said, I presume the easiest fix (if there is one) will be to set a static homepage and somehow force the Infinite-Scroll to recognize the page itself.
Anyways, any guidance would be much appreciated!
- The topic ‘Infinite Scroll / Pagination’ is closed to new replies.