ActiveDen

Wordpress infinite scrolling

12 posts
  • Bought between 10 and 49 items
  • Canada
  • Exclusive Author
  • Has been a member for 3-4 years
luciendub says

Hi, I’m looking for an infinite scrooling wordpress plugin. At the end of the page, I would like the new posts to load automaticly..

701 posts
  • Bought between 1000 and 4999 items
  • Canada
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
chrismccoy says
12 posts
  • Bought between 10 and 49 items
  • Canada
  • Exclusive Author
  • Has been a member for 3-4 years
luciendub says

I’ll look at that. Thank you!

12 posts
  • Bought between 10 and 49 items
  • Canada
  • Exclusive Author
  • Has been a member for 3-4 years
luciendub says
I tried with that code in the function file:
/**
 * 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":"#post-navigation .next a",
        "navSelector":"#post-navigation",
        "itemSelector":"article",
        "contentSelector":"#primary" 
    };
    jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll );
    </script>
    <?php
    }
}
add_action( 'wp_footer', 'custom_infinite_scroll_js',100 );

But it doesn’t work. Are my selectros correct according to my template?

701 posts
  • Bought between 1000 and 4999 items
  • Canada
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
chrismccoy says

dont know what theme you are using, but you need to have the same selctors as in the code

1 post
  • Bought between 10 and 49 items
  • Canada
  • Has been a member for 1-2 years
olidub says

It’s the pixelpower theme. And, I’m not sure to understand what is a “selector” (the div id or class?)

701 posts
  • Bought between 1000 and 4999 items
  • Canada
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
chrismccoy says

nextSelector .next a”,

so your next link has to have that or it wont do anything.

by
by
by
by
by