• Resolved justawebbie

    (@justawebbie)


    My theme is a child theme of Twenty Thirteen. I have installed the newest Jetpack WordPress plugin and I am trying to implement infinite scroll on click. I am trying to use a custom page called loop.php to control the way the posts load on the page. It works fine until I hit the “Older posts” button. What happens is it defaults to the content.php to load more posts. Here is a link to the page I am trying to get this to work on: https://www.justawebbie.com

    I am not sure what code you will need to see but here is the infinite scroll code:

    function twenty_thirteen_infinite_scroll_init() {
                add_theme_support( 'infinite-scroll', array(
                      'container' => 'content',
    	           'type'      => 'click',
    	            'wrapper'   => true,
                        'render'    => 'twenty_thirteen_infinite_scroll_render',
    	            'footer_widgets' => array( 'main', ),
                         'footer'         => 'wrapper',
        ) );
    }
    add_action( 'after_setup_theme', 'twenty_thirteen_infinite_scroll_init' );
    
    function twenty_thirteen_infinite_scroll_render() {
        get_template_part( 'loop' );
    }

    Here is the front page loop:

    <div id="content" class="site-content" role="main">
               <?php if ( have_posts() ) : ?>
                         <?php /* The loop */ ?>
    			  <?php while ( have_posts() ) : the_post();
                                            get_template_part( 'loop' );
    			     endwhile; ?>
                                <?php else : ?>
    		            <p class="no-posts"><?php _e('Sorry, no posts matched your criteria', 'example'); ?></p>
    		<?php endif; ?>
    
    		</div><!-- #content -->

    Here is my loop.php:

    <article id="post-<?php the_ID(); ?>">
    	        <div class="entry-content">
                <div class="showdiv">
                <div class="fea-image"><?php the_post_thumbnail( array (150,100) );?></div>
    				<div id="fea-title"><a href="<?php the_permalink() ?>" title="<?php the_title() ?>" rel="bookmark"><?php the_title() ;?></a></div>
                    <div id="fea-date"><?php twentythirteen_entry_date(); ?></div>
                    <div id="showonhover"><?php the_excerpt(); ?></div>
                 </div>
                 </div>
                 </article>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter justawebbie

    (@justawebbie)

    Please can anyone help me?

    Thread Starter justawebbie

    (@justawebbie)

    I kept trying different things and found a few more things that helped me out. It may not be the neatest but I have it working.

    I completely dumped my infinite scroll code and used this:

    // initializes infinite scroll
              var infinite_scroll = {
    		 loading: {
    			img: "/wp-content/themes/cstone-TThirteen/images/loader.gif",
    			msgText : '',
    			finishedMsg: 'the end',
    			behavior: 'manual'
    		 },
    		 "nextSelector":"#post-nav a",
    		 "navSelector":"#post-nav",
    		 "itemSelector":".column-posts",
    		 "contentSelector":"#content"
    	   };
    	  jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll );
    
          // unbinds to load manually
             jQuery('#content').infinitescroll('unbind');
    
         // hides nav links
             jQuery('#post-nav').css ( 'display', 'none' );
    
         // loads posts on action
             jQuery('#infinite-target').on('click', function(e) {
                       e.preventDefault();
    	           jQuery('#content').infinitescroll('retrieve');
              });

    I then changed up my loop.php to this:

    <div id="content">
    	   <?php if (have_posts()) : ?>
    	       <div class="column-posts">
    	            <?php while (have_posts()) : the_post(); ?>
                                  <article id="post-<?php the_ID(); ?>">
    	                              <div class="entry-content">
                                                      <div class="showdiv">
                                                              <div class="fea-image"><?php the_post_thumbnail( array (150,100) );?></div>
    				                           <div id="fea-title"><a href="<?php the_permalink() ?>" title="<?php the_title() ?>" rel="bookmark"><?php the_title() ;?></a></div>
                                                                <div id="fea-date"><?php twentythirteen_entry_date(); ?></div>
                                                               <div id="showonhover"><?php the_excerpt(); ?></div>
                                                        </div>
                                              </div>
                                   </article>
    
                            <?php endwhile; ?>
    			</div>
    			<?php endif; ?>
    	     </div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Jet pack install not working quite to perfection’ is closed to new replies.