Infinite Scroll on homepage with latest network post

Hello! :slight_smile:

I want to make my new homepage (www.bloggerspoint.dk/test) load faster with infinite scroll. I have tried the following tutorial: http://wptheming.com/2012/03/infinite-scroll-to-wordpress-theme/ but I can't get it to work. I want it to load one section at a time, and have replaced the itemselector and content selector, but it doesn't work.

Can anyone help me? All the codes are inserted correct.

  • Mathias

    Sure, here:

    /**
     * Load javascripts used by the theme
     */
    
    function custom_theme_js(){
    	wp_register_script( 'infinite_scroll',  get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array('jquery'),null,true );
    	if( ! is_singular() ) {
    		wp_enqueue_script('infinite_scroll');
    	}
    }
    add_action('wp_enqueue_scripts', 'custom_theme_js');
    
    /**
     * Infinite Scroll
     */
    function custom_infinite_scroll_js() {
    	if( ! is_singular() ) { ?>
    	<script>
    	var infinite_scroll = {
    		loading: {
    			img: "<?php echo get_template_directory_uri(); ?>/images/ajax-loader.gif",
    			msgText: "<?php _e( 'Loading the next set of posts...', 'custom' ); ?>",
    			finishedMsg: "<?php _e( 'All posts loaded.', 'custom' ); ?>"
    		},
    		"nextSelector":"#nav-below .nav-previous a",
    		"navSelector":"#nav-below",
    		"itemSelector":"sec",
    		"contentSelector":"itemsec"
    	};
    	jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll );
    	</script>
    	<?php
    	}
    }
    add_action( 'wp_footer', 'custom_infinite_scroll_js',100 );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.