Add Infinite Scroll to Ajax Loaded Category Query

Update … Here’s the Final Code That Worked for Me This may not be perfect, but it seems to be working well for me with no errors. Feel free to add any suggestions for improvement if you have any. JS Code jQuery(document).ready(function($) { var count = 2; jQuery(“#la-chooser”).change(function() { loadArticlebyCat(this.value); }); function loadArticlebyCat(cat){ data = … Read more

Jetpack Infinite scroll conflicting with theme’s pre_get_posts custom posts_per_page

You’ve specified a priority of 1 for your pre_get_posts function here: add_action( ‘pre_get_posts’, ‘mytheme_portfolio_archive_pages’, 1 ); Jetpack doesn’t specify a priority: add_action( ‘pre_get_posts’, array( $this, ‘posts_per_page_query’ ) ); So that gets added with the default priority for add_action, which is 10: $priority (int) (optional) Used to specify the order in which the functions associated with … Read more

Jetpack infinite scroll render – make different depending on post type?

Replace the above mytheme_render_infinite_scroll function with this: function mytheme_render_infinite_scroll() { while ( have_posts() ) : the_post(); if (‘mytheme_portfolio’ == get_post_type()) : get_template_part( ‘content’, ‘archive-portfolio’ ); else : get_template_part( ‘content’, get_post_format() ); endif; endwhile; }

Pagination/infinite scroll with WP_Query and multiple loops

This might not solve your problem, but it will help you in future to create custom queries. Paginating more than one query can get extremely tricky. By default the build in pagination in WordPress don’t have this logic to paginate multiple queries. You will have to run multiple queries and merge them in some way. … Read more

Custom Loop and Infinite Scroll

I used ‘init’ in the add_action in my own implementation of infinite scroll, try that. add_action( ‘init’, ‘vg_infinite_scroll_init’ ); As to your question about rendering a custom query you would do the following. -Set the render to your function name ‘render’ => ‘your_render_function, -Add your function to call a specified loop template function your_render_function(){ get_template_part( … Read more

WordPress Infinite Scroll without using any plugin

For single article infinite scroll below is the solution single.php <div class=”blog-article-section”> <?php while( have_posts() ): ?> <div class=”blog-article”> <?php if( have_posts() ): the_post(); ?> <h2><?php the_title(); ?></h2> <p><?php the_content(); ?></p> <?php endif; ?> <div class=”pagination-single” > <div class=”next_post_link”><?php previous_post_link( ‘%link’,’Previous Post’ ) ?></div> <div class=”previous_post_link”><?php next_post_link( ‘%link’,’Next Post’ ) ?></div> </div> </div> <?php endwhile; … Read more