WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
Infinite Scroll .js error: Uncaught Error infinite_scroll is not defined (15 posts)

  1. jasonkadlec
    Member
    Posted 1 year ago #

    Thanks everyone/anyone for help on this!

    I've checked and double checked my CSS selectors, I've disabled all javascript and plugins except for infinite scroll, and no matter what, I'm always seeing this same error:

    Uncaught Error infinite_scroll is not defined.

    And as a result, it isn't working & as a result I'm not able to finish this project as I want to.

    Thank you thank you for your help!

    The page it should be tested on is here:

    http://www.thedovesstudio.com/zwp/news-and-press/

    I've left the debug mode on, settings are default.

    I'm using the following for my css selectors:

    Content = .right

    Navigation selector = #navigation

    Next Selector = .navigationLink a:first

    Item Selector = .post

    It's loaded up with some test posts so I have 2 full pages (3 posts each) and a 3rd page with 2 posts... all pages have this error.

    Is this a WordPress 3.5 thing?

    I've tried loading jquery with this:

    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.7.1.min.js"></script>

    which didn't work, and I also tried not putting any call to jquery in the header.php so now it's back to where it was before using this:

    <?php wp_enqueue_script('jquery'); ?>

    Any help is so, super appreciated!!

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. jasonkadlec
    Member
    Posted 1 year ago #

    OK! I got it to work properly when I set the "News And Press" page to be the "blog" page in WordPress settings.

    Hopefully that isn't a requirement... I want to use this plugin on all kinds of other pages where I have pagination working properly, but where the loops are a little more complex as well as on loops that use custom post types.

    More to follow if I solve it.

  3. jasonkadlec
    Member
    Posted 1 year ago #

    OK so it works perfectly when it's on a page that designated as the "posts" page in the WordPress Admin -> Settings -> Reading... but not on pages with query posts.

    Here is the query that I'm using:

    $category = get_the_title();
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
    'category_name'=> $category,
    'caller_get_posts'=>1,
    'paged'=>$paged,
    );
    query_posts($args);

    global $more;

    if (have_posts()) : while (have_posts()) : the_post();

    The result is an error in Chrome inspect element console which says infinite_scroll is not defined.

    Bummed.

    I also put in the functions.php the

    function my_load_infinite_scroll( $load_infinite_scroll ) {
    if( is_page('news-and-press') )
    return true;
    return $load_infinite_scroll;
    }
    add_filter('infinite_scroll_load_override', 'my_load_infinite_scroll');

    ... but no avail so I took it back out.

    Any ideas anyone?

    Thanks!

    J

  4. FriendlyNoob
    Member
    Posted 1 year ago #

    I'm having the same issue at the minute and would appreciate any help on this.

  5. jasonkadlec
    Member
    Posted 1 year ago #

    Friendly Noob:

    From everything I've found online so far, Infinite Scroll is really only set up to work with the "main" WordPress query.

    There is most likely more than one way to get the Main query going, but the only way I've figured out is to set whatever page as the "posts" page in the Reading settings of the admin.

    To get the project done, I ended up just using pagination instead of infinite scroll.

  6. Stefan Feser
    Member
    Posted 1 year ago #

    Hi,

    I'm having exactly the same issues.

    Does anybody know a way to solve this?

    Thanks!

  7. kevin
    Member
    Posted 1 year ago #

    Yup, there's something wrong. Used to work fine (begining of the week, 14th of jan '13) and now i can't get it back on tracks. Don't know if it's caused by the latest version of the plugin, latest wordpress (3.5) or else. Don't thing though that my theme is causing it as i had it fine as stated above.

    I've tested many combinations of selectors, nothing works. One thing though, it's not that broken as when i open the chrome dev tools and reach the ending point of the posts, this message in the console: "Uncaught TypeError: Cannot call method 'apply' of undefined".

    So it's triggered but then something fails. I've also noticed that when set to Manual Trigger, it loads the posts after i click the 'next posts' button. But fails to put back the nav button at the end of the newly loaded set of posts.

  8. Stefan Feser
    Member
    Posted 1 year ago #

    To me it seems like the infinite_scrolling plugin is not loaded on any other pages expect the home page with all the normal blog posts.

    I have one page with an different query for a special category and when I reach the end of the page the console says something like this:

    Uncaught ReferenceError: infinite_scroll is not defined

  9. Tech4Eleven
    Member
    Posted 1 year ago #

    I get the same message. If I choose the blog page as my posts page, it breaks my blog. has to do with my theme and the blog template page. But even when I do set the blog as the posts page, the plugin doesnt work, although the error does away. any help?

  10. Devin Walker
    Member
    Posted 1 year ago #

    Same error here for me... really lame. I'll post back if I can figure out a fix.

  11. olethomas
    Member
    Posted 1 year ago #

    Infinite Scroll has a check for is_singular(). It won't load the front end javascript if this condition is met. It would be nice to have a filter to override this behaviour. The function to look for to manually change this is shouldLoadJavascript(). It is located in infinite-scroll.php. Won't recommend editing plugin files directly though.

  12. kevin
    Member
    Posted 1 year ago #

    Update 2.6.2 and it's back on tracks for the home page.

  13. Stefan Feser
    Member
    Posted 1 year ago #

    But still not working on posts page?

  14. adamweclick
    Member
    Posted 1 year ago #

    I've managed to get it working by modifying line 308 to return true in infinite-scroll.php, inside the shouldLoadJavascript() function.

    It would be really nice to have this as a toggle option in the plugin config, as I'm going to have to give this to a client at some point and if they update the plugin every one of my custom pages that load post content is going to break.

  15. Stefan Feser
    Member
    Posted 1 year ago #

    Okay that was the solution! Thank you.

    A toggle option would be really nice for that. What I don't get is that this function checks if is_singular but not is_page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic