Could Someone Please Help me with Infinite Scroll WP Plugin?

by lovboa Banned
1 replies
I am experiencing a lot of frustration trying to get this to work. I'm trying to get the infinite scroll plugin on WordPress to work with my current theme.

I've tried everything. The plugin asks you to name the selectors you use on your site. I've tried everything and it is still not working. There is no change in my site whatsoever when I activate the plugin, or when I change the settings.

I do have JetPack installed.

There must be something simple I am missing, because when I read other people installing on their own sites, they say it is very simple.

Anyways,

This is my index.php code:

Code:
<?php get_header(); ?>

<div id="content">
				<?php
				$current_page = get_query_var('paged');
				$hide_carousel = ( $current_page && isset($theme_options['lightly_homepage_headline_slider_hide']) && $theme_options['lightly_homepage_headline_slider_hide']);
				if ( $theme_options['lightly_homepage_headline_slider'] && !($hide_carousel) ) {
					if ( isset($theme_options['lightly_headline_posts_categories']) && $theme_options['lightly_headline_posts_categories'] ) $cats = implode(',', $theme_options['lightly_headline_posts_categories'] );
					else $cats = '';
					$args = array('cat' => $cats, 'showposts' => $theme_options['lightly_headline_posts_number'] );
				?>	



<div id="headline-carousel">
                	<?php
					plus62_custom_loop_posts( $args ,$theme_options['lightly_headline_posts_title'] );
					?>
</div>

<?php } ?>



<div id="main" role="main">
						
						<h4 class="widgettitle"><span>Recent Posts</span></h4>
						<?php if (have_posts()) : $i = 1; while ( have_posts() ) : the_post(); ?>

<div id="post">
								<?php if (has_post_thumbnail()): ?>
								<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="home-thumb"><?php the_post_thumbnail('thumb-300'); ?></a>
								
								<?php endif; ?>




							<header>
<h2 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<p class="meta"> <time datetime="<?php echo the_time('Y-m-d'); ?>"><?php the_time('m/d/Y'); ?></time>, <?php the_author_posts_link(); ?></p>
							</header> <!-- end article header -->



							<section class="post_content clearfix">
								<?php the_excerpt(); ?>
								<p class="read-more"><a href="<?php the_permalink() ?>"><?php _e('Read Post &rarr;', 'plus62'); ?></a></p>
							</section> <!-- end article section -->							
						
						</div> <!-- end article -->
						
						
						<?php endwhile; ?>	
						
						<?php 
							if (function_exists('plus62_pagenavi')) { 
									plus62_pagenavi();
							} else { // if it is disabled, display regular wp prev & next links ?>

							<nav class="wp-prev-next">
								<ul class="clearfix">
									<li class="prev-link"><?php next_posts_link(__('&laquo; Older Entries', 'plus62')) ?></li>
									<li class="next-link"><?php previous_posts_link(__('Newer Entries &raquo;', 'plus62')) ?></li>
								</ul>
							</nav>
						<?php } ?>		
						
						<?php else : ?>
						
						<article id="post-not-found">
						    <header>
						    	<h1>Not Found</h1>
						    </header>
						    <section class="post_content">
						    	<p>Sorry, but the requested resource was not found on this site.</p>
						    </section>
						    <footer>
						    </footer>
						</article>
						
						<?php endif; ?>
					
					</div> <!-- end #main -->
				
					
				
    
			</div> <!-- end #content -->

<?php get_footer(); ?>

Infinite Scroll Settings is asking for the following selectors:

1. Content Selector -Div containing your theme's content
2. Navigation Selector -Div containing your theme's navigation
3. Next Selector -Link to next page of content
4. Item Selector -Div containing an individual post

I currently have the settings as:

1. #main
2. .page-navigation
3. .page-numbers .next
4. #post

Are these correct? Am I supposed to add something to my functions.php file? Or am I supposed to add something to my index.php, replacing my current page-navi?

Is there anyone that could help me, please?

Thank you
#infinite #plugin #scroll
  • Profile picture of the author SteveJohnson
    The theme is coded incorrectly, and won't work with Jetpack's Infinite Scroll.

    Do you see where it says, '<div id="post">? That is one of the killers. That line is within the 'WordPress Loop' - meaning that for every post that is displayed, that whole section is repeated.

    The problem is that container id's must be unique. In other words, the id 'post' can only be used once.

    It's likely that the javascript that runs the scroll is choking on the incorrect id's. Get that fixed then try again. Change 'id="post"' to a class instead, such as 'class="entry"'.

    As for your list:
    #1 - should be ok
    #2 - can't tell, because your main nav container is probably in the header
    #3 - should be li.next-link
    #4 - should be whatever you change the article container to (I recommend against 'post' as that class is used in other areas of WP themes).
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[8124400].message }}

Trending Topics