WordPress Jetpack infinite scroll is not working

When passing different posts_per_page values in functions.php number of posts shown changes but it doesnt load any other posts on scroll. Changing type to click doesn’t do anything.

adding support in functions.php:

Read More
add_theme_support( 'infinite-scroll', array(
    'type'           => 'scroll',
    'footer_widgets' => false,
    'container'      => 'content',
    'render'         => false,
    'posts_per_page' => false,
) );

index.php:

<?php

get_header(); ?>

<div id="content">

    <?php if (have_posts):
        while (have_posts()) {
            the_post(); 
            get_template_part('content', get_post_format()); 
        }   

    else:
        echo '<p>No content found</p>';
    endif; ?>

</div>

content.php:

<div class="post clearfix">
<div class="post-heading">
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <h3><a href="<?php the_permalink(); ?>"><?php the_subtitle(); ?></a></h3>
</div>
<div class="post-content">
    <?php the_content(); ?>
    <?php if (is_single()): ?>
        <div class="navigation clearfix">
            <?php the_post_navigation( array(
            'next_text' => 'Next',
            'prev_text' => 'Previous',
            'screen_reader_text' => ' '
            )); ?>
        </div>
        <p><a href="<?php echo site_url(); ?>/blog">Main</a></p>
    <?php endif; ?>
</div>

Related posts

Leave a Reply