WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
[resolved] Feature Request: Add filter for function shouldLoadJavascript (3 posts)

  1. helgatheviking
    Member
    Posted 1 year ago #

    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/

  2. Andrew Tibbetts
    Member
    Posted 6 months ago #

    bump

  3. helgatheviking
    Member
    Posted 6 months ago #

    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 );
    	}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic