Title: Infinite Scroll doesn&#039;t load posts
Last modified: August 31, 2016

---

# Infinite Scroll doesn't load posts

 *  [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/)
 * I have infinite scroll enabled and I put the following code in my functions.php
   file:
 *     ```
       // theme support for Jetpack infinite scroll
       add_theme_support( 'infinite-scroll', array(
       	'container'  => 'content',
       	'render'    => 'infinite_scroll_render',
       	'footer' => false
       ) );
   
       // render function for Jetpack infinite scroll that 2010 uses, the later WP themes don't need this
       function infinite_scroll_render() {
       	get_template_part( 'post-loop' );
       }
       ```
   
 * I have a post-loop.php file that has the template for my individual posts in 
   it.
 * When I scroll to the bottom of the front page, the scrolling animation appears,
   but it doesn’t load any posts. I also tried deleting the render portion of the
   above code and just having it fall back to the default content.php file which
   didn’t work either. Does anyone know the solution to this?
 * [https://wordpress.org/plugins/jetpack/](https://wordpress.org/plugins/jetpack/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224585)
 * Could you try to follow this tutorial to make sure your template files and your
   post-loop.php file are built properly for Infinite Scroll to work?
    [http://ottopress.com/2012/jetpack-and-the-infinite-scroll/](http://ottopress.com/2012/jetpack-and-the-infinite-scroll/)
 * Let me know how it goes.
 *  Thread Starter [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224587)
 * my index.php file has this:
 *     ```
       <div id="content">
           <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
               get_template_part('content', get_post_format());
           endwhile; else: ?>
           <p id="no-posts">There's nothing here yet :(</p>
           <?php endif; ?>
       </div>
       ```
   
 * my functions.php file has this:
 *     ```
       // theme support for Jetpack infinite scroll
       add_theme_support( 'infinite-scroll', array(
       	'container'  => 'content',
       	'render'    => 'infinite_scroll_render',
       	'footer' => false
       ) );
   
       // render function for Jetpack infinite scroll that 2010 uses, the later WP themes don't need this
       function infinite_scroll_render() {
       	get_template_part( 'post-loop' );
       }
       ```
   
 * and my post-loop.php has this:
 *     ```
       <?php while (have_posts()) : the_post(); ?>
       	<article class="teaser">
               (post contents)
       	</article>
       <?php endwhile; ?>
       ```
   
 * I don’t see anything that I’m doing wrong?
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224590)
 * That indeed won’t work that way. Your loop is already defined in `index.php`:
 * `if ( have_posts() ) : while ( have_posts() ) : the_post();`
 * It then calls `content.php`, or `content-ANYPOSTFORMAT.php`. It doesn’t call `
   post-loop.php`, though.
 * If your theme already includes `content.php` template files, you could get rid
   of `post-loop.php` as well as of the `infinite_scroll_render()` function and 
   reference, and use the default Infinite Scroll settings (Jetpack will use `content.
   php` template files by default, if you specify a rendering function).
 * Let me know how it goes.
 *  Thread Starter [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224599)
 * I tried getting rid of the infninite_scroll_render() function and the post-loop.
   php file but for some reason nothing changed. It still shows the loading gif 
   but doesn’t load the posts.
 * If I rename post-loop.php to content-post.php will it load?
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224600)
 * `content-post.php` would never get used, as no `post` post format exists.
 * Does you theme include any `content.php` or content-something.php` file?
 *  Thread Starter [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224602)
 * my theme uses content.php but when I delete the infinite_scroll_render() function
   it still doesn’t load the posts.
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224603)
 * Could you copy the contents of `content.php` here?
 *  Thread Starter [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224604)
 *     ```
       <?php if ( (!$wp_query->current_post == 1 && is_home() && !is_paged()) || (!$wp_query->current_post == 1 && is_category() && !is_paged()) ) : ?>
       	<article class="teaser" id="first">
       	<div class="thumbnail" id="first-thumbnail"><a href="<?php the_permalink(); ?>">
       	<?php the_post_thumbnail('first-thumbnail'); ?></a></div>
       	<div class="content-container">
       		<h2><a href="<?php the_permalink(); ?>" class="title"><?php the_title() ;?></a></h2>
       		<?php if ( has_excerpt() ) { ?>
       			<p class="excerpt-content">
       				<?php
       				$myExcerpt = get_the_excerpt();
       				$tags = array("<p>", "</p>");
       				$myExcerpt = str_replace($tags, "", $myExcerpt);
       				echo $myExcerpt;
       				?>
       			</p>
       		<?php } else {
       			echo '';
       		} ?>
       		<div class="metadata">
       			<!--<a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><i class="fa fa-user"></i><?php the_author(); ?></a>-->
       			<a href="<?php echo get_post_meta($post->ID, 'source', true) ?>" target="_blank"><i class="fa fa-external-link-square"></i><?php echo get_post_meta($post->ID, 'source-name', true) ?></a>
       			<p><i class="fa fa-clock-o"></i><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?></p>
       			<!-- Category
       			<?php
       			$categories = get_the_category();
       			$output = '';
   
       			if ($categories) {
   
       			foreach ($categories as $category) {
       				$output .= '<a href="' . get_category_link($category->term_id) . '">' . '<i class="fa fa-thumb-tack"></i>' . $category->cat_name . '</a>';
       			}
       				echo trim($output, $separator);
       			}
       			?>
       			/Category -->
   
       			<a href="<?php the_permalink(); ?>#comments"><i class="fa fa-comment-o"></i><fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count> comments</a>
       		</div>
       	</div>
       	</article>
       <?php elseif (is_single()) : ?>
       	<article class="single">
       		<h2><?php the_title(); ?></h2>
       		<div id="metadata">
       			<?php get_template_part('single-metadata', get_post_format()); ?>
       			<?php echo sharing_display(); ?>
       		</div>
       		<div class="single-container">
       		<?php the_content(); ?>
       		</div>
       		<span id="source">source: <a href="<?php echo get_post_meta($post->ID, 'source', true) ?>" target="_blank" id="source"><?php echo get_post_meta($post->ID, 'source-name', true) ?></a></span>
       		<div class="next">
       			Up Next: &nbsp<?php
       			$next_post = get_next_post();
       			if (!empty( $next_post )): ?>
         			<a href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo $next_post->post_title; ?></a>
       			<?php endif; ?>
       		</div>
       		<?php get_template_part('single-sharebar', get_post_format()); ?>
       		<?php related_posts() ?>
       		<div id="comments"><?php echo do_shortcode('[fbcomments]'); ?></div>
       	</article>
       <?php else : ?>
       	<article class="teaser">
       	<div class="thumbnail"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('small-thumbnail'); ?></a></div>
       	<div class="content-container">
       		<h2><a href="<?php the_permalink(); ?>" class="title"><?php the_title() ;?></a></h2>
       		<?php if ( has_excerpt() ) { ?>
       			<p class="excerpt-content">
       				<?php
       				$myExcerpt = get_the_excerpt();
       				$tags = array("<p>", "</p>");
       				$myExcerpt = str_replace($tags, "", $myExcerpt);
       				echo $myExcerpt;
       				?>
       			</p>
       		<?php } else {
       			echo '';
       		} ?>
       		<div class="metadata">
       			<!--<a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><i class="fa fa-user"></i><?php the_author(); ?></a>-->
       			<a href="<?php echo get_post_meta($post->ID, 'source', true) ?>" target="_blank"><i class="fa fa-external-link-square"></i><?php echo get_post_meta($post->ID, 'source-name', true) ?></a>
       			<p><i class="fa fa-clock-o"></i><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?></p>
       			<!-- Category -->
       			<!--<?php
       			$categories = get_the_category();
       			$output = '';
   
       			if ($categories) {
   
       			foreach ($categories as $category) {
       				$output .= '<a href="' . get_category_link($category->term_id) . '">' . '<i class="fa fa-thumb-tack"></i>' . $category->cat_name . '</a>';
       			}
       				echo trim($output, $separator);
       			}
       			?>
       			<!-- /Category -->
   
       			<a href="<?php the_permalink(); ?>#comments"><i class="fa fa-comment-o"></i><fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count> comments</a>
       		</div>
       	</div>
       	</article>
       <?php endif; ?>
       ```
   
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224632)
 * Could you try replacing the first line by the following?
 * `<?php if ( is_home() || is_category() ) : ?>`
 *  Thread Starter [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224640)
 * I just replaced the first line like you said and the posts still arent loading,
   but now every post looks like a “first” post based on the template.
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224641)
 * Thanks for giving it a try. At this point, it might be easier if I had access
   to the theme and could run some tests on a test site of mine. Could you [send me a copy of the theme](https://jeremy.hu/contact/),
   so I can take a closer look?
 * Thanks!
 *  Thread Starter [5AMWE5T](https://wordpress.org/support/users/5amwe5t/)
 * (@5amwe5t)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224642)
 * How do I send you a copy of the theme? I clicked your link but I don’t know how
   to attach files with that contact form.
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224701)
 * Could you contact us via [this contact form](http://jetpack.com/contact-support/)
   and mention this thread? We’ll get back to you and you’ll be able to reply with
   a zip of the theme.
 * Another alternative would be to use a file sharing service like Dropbox, upload
   your theme there, and send us a link to the file on Dropbox.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Infinite Scroll doesn't load posts’ is closed to new replies.

 * ![](https://ps.w.org/jetpack/assets/icon.svg?rev=2819237)
 * [Jetpack - WP Security, Backup, Speed, & Growth](https://wordpress.org/plugins/jetpack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jetpack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jetpack/)
 * [Active Topics](https://wordpress.org/support/plugin/jetpack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jetpack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jetpack/reviews/)

## Tags

 * [content](https://wordpress.org/support/topic-tag/content/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [templates](https://wordpress.org/support/topic-tag/templates/)

 * 13 replies
 * 2 participants
 * Last reply from: [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/infinite-scroll-doesnt-load-posts/#post-7224701)
 * Status: not resolved