The plugin is loading posts that are already displayed
-
Hello,
Your plugin seems to be useful to not mess around with JS plugins etc and I want to use it on the following page https://actondemo6.com/notices/
However, I ran across multiple issues:
1. When we click the load more button, the posts that are already displayed appear https://i.imgur.com/rz6ErBl.png
2. After clicking “Load More”, posts start loading without clicking (as infinite scroll)
3. The load more button displays even if we do not have more posts (only one page) so I had to put the shortcode into a conditional
Pagination works correctly. The code of the page where I want to use the plugin (nothing fancy!):
get_header(); ?> <div id="page" role="main" class="row"> <article class="main-content columns medium-10"> <?php if ( have_posts() ) : ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'template-parts/content', get_post_format() ); ?> <?php endwhile; ?> <?php else : ?> <?php get_template_part( 'template-parts/content', 'none' ); ?> <?php endif; // End have_posts() check. ?> <?php /* Display navigation to next/previous pages when applicable */ ?> <?php if( $wp_query->max_num_pages > 1 ) { echo do_shortcode('[ajax_load_more post_type="post" posts_per_page="1" container_type="div" pause="true" button_label="Load More"]'); } ?> </article> <?php get_sidebar(); ?> </div> <?php get_footer();
Can you help with that?
- The topic ‘The plugin is loading posts that are already displayed’ is closed to new replies.