• Resolved HelgaTheViking

    (@helgatheviking)


    First thank you for your work on this plugin! I have a feature request to propose. Right now infinite scroll only loads on non-singular pages. I need to use it in a page template ( the template is listing all the site’s authors ) that is being used in an archive kind of way.

    If there were a filter in the shouldLoadJavascript() function I think this would work out while being completely backwards compatible.

    function shouldLoadJavascript() {
    		// Don't need to load the plugin on single pages
    		if (is_singular()) {
    			return false;
    		}
    
    		return true;
    	}
    function shouldLoadJavascript() {
    
    		$load = true;
    
    		// Don't need to load the plugin on single pages
    		if (is_singular()) {
    			$load = false;
    		}
    
    		return apply_filters( 'infinite_scroll_load_javascript', $load );
    	}

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • bump

    Thread Starter HelgaTheViking

    (@helgatheviking)

    Andrew,

    I think this thread died, but I think this is actually in the code. If this version isn’t in the WP repo you can get it from github:

    https://github.com/paulirish/infinite-scroll

    /**
    	 * Determines if the jQuery plugin and corresponding options should
    	 * be output onto the page.
    	 *
    	 * @return bool
    	 */
    	function shouldLoadJavascript() {
    		// Don't need to load the plugin on single pages
    		$load = is_single() ? false : true;
    		return apply_filters( 'infinite_scroll_load_javascript', $load );
    	}
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Feature Request: Add filter for function shouldLoadJavascript’ is closed to new replies.