JetPack Infinite-Scrolling Integration Issue
-
Hi guys. I’m working on my very first custom WordPress theme. I’m porting a CSS/HTML website design I’ve created over to WordPress to use on my personal blog. I’ve been Googling around to try and find tutorials and guides for implementing JetPack’s infinite scrolling feature into my new theme, but I’ve come across some issues.
I currently have my home page set to show at most 7 posts. With Jetpack infinite scrolling disabled, Jetpack places the navigation pagination link underneath my first post, and when clicked it loads 7 more posts below the first post, pushing down the other 6 that was on the page. The same thing happens with Infinite Scrolling enabled: Upon loading the site, Jetpack would quickly load 7 more posts right at the start, pushing all posts down, even the one that was in first position before. JetPack would also stop loading posts after a while, not infinitely scrolling through all 50+ demo posts that I have up on my dev site. It’s quite a mess. I just cannot get the posts to load and show up like they’re supposed to.
Another issue that I am having when enabled the JetPack plugin is that my first post on the home page, or any post on the single-post pages have the content body stretched down quite far, loads of white space, almost over a thousand pixels of it. This doesn’t happen when JetPack is de-activated. Where’s all this space/margin/padding/height?? coming from? There is something seriously wrong in my coding to cause all these major incompatibilities, and I hope that you guys can tell me what that is…
Here is my index.php code:
<?php get_header(); ?> <?php get_sidebar(); ?> <?php while (have_posts()) : the_post(); get_template_part( 'content', get_post_format() ); endwhile; ?> <?php next_posts_link(); ?> <?php //else : ?> <?php //endif; ?> </div> <?php get_footer(); ?>
Here is my content.php code:
<div id="content"> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="time-and-date"> <div class="post-date"><span class="date-icon">#</span><?php the_time( 'l, F j, Y' ); ?></div> <div class="post-time"><?php the_time( 'h:i A, T' ); ?><span class="time-icon">&</span></div> </div> <a href="<?php the_permalink(); ?>"><?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail(); ?></a> <div class="post-title"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div> <div class="post-content"> <div class="post-tags">Posted in: <?php the_category(' '); ?> <?php the_tags( 'and tagged: ', ', ', '.'); ?></div> <?php the_content(); ?> <?php wp_link_pages(); ?> </div> <div class="post-meta"><span class="meta-links"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php //the_title_attribute(); ?>">Permalink</a> | <a href="<?php //comments_link(); ?>">Comments</a> | <a href="https://www.addthis.com/bookmark.php" target="_blank">Share</a></span><br/> </div> </div> </div>
I have put the following code into my functions.php:
add_theme_support( 'infinite-scroll', array( 'container' => 'content', ) );
I’m working on this live on my dev server at: https://dev.davidventer.net/wordpress/ – I’ll be editing some of the demo content posts to add numbers to the post titles in reverse order so that you guys can see which posts are supposed to be shown first. I’ll label them 1 to 14??, newest to oldest. I think this will help keep track of things when troubleshooting the issues. Please take a look and let me know if there is anything else you need me to paste here (CSS maybe?).
I really just want to get infinite scrolling to work before I continue working on the rest of the theme files. All help will be greatly appreciated. Thank you.
- The topic ‘JetPack Infinite-Scrolling Integration Issue’ is closed to new replies.