=== Ajax Load More - Infinite Scroll === Contributors: dcooney Donate link: https://connekthq.com/donate/ Tags: infinite scroll, scroll, infinite, lazy load, lazy loading, pagination, ajax pagination, ajax, ajax posts, ajax load posts, loop, query, dynamic, shortcode builder, wp_query, search, tags, category, post types, taxonomy, meta_query, archives, date, infinite scrolling, woocommerce Requires at least: 3.6 Tested up to: 4.5.2 Stable tag: 2.11.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html The ultimate solution to add infinite scroll functionality to your website == Description == Ajax Load More is a powerful solution for infinite scrolling and lazy loading posts, custom post types, single posts, pages and comments with Ajax powered queries. Build complex custom WordPress queries using the Ajax Load More shortcode builder then add the generated shortcode to your page via the content editor or directly into your template files. Ajax Load More is fully compatible with popular ecommerce plugins such as WooCommerce, Easy Digital Downloads and JigoShop. **[Get More Information](https://connekthq.com/plugins/ajax-load-more/)** = Features = * **Shortcode Builder** - Easily create your own Ajax Load More shortcode by adjusting the various WordPress query parameters in our easy-to-use shortcode builder (see Shortcode Parameters). * **Query Parameters** - Ajax Load More allows you to query WordPress by many different content types. Query by Post Type, Post Format, Date, Category, Tags, Custom Taxonomies, Search Term, Authors and more!! * **Customizable Repeater Templates** - Edit and extend the functionality of Ajax Load More by creating your own repeater template to match the look and feel of your website (see screenshots). * **Setting Panel** - Customize your version of Ajax Load More by updating various plugin settings (see screenshots). * **Multiple Instances** - You can include multiple instances of Ajax Load More on a single page, post or template. * **Multisite Compatibility** - Manage unique repeater templates across all sites in your network. * **REST API** - As of Ajax Load More 2.11.0 user can infinite scroll posts and pages with the [WP REST API](https://wordpress.org/plugins/rest-api/). Check out the **[demo site](https://connekthq.com/plugins/ajax-load-more/)** for more information! *** = Content Types = Ajax Load More can infinite scroll any content type WordPress offers - from blog posts to WooCommerce products Ajax Load More can handle it. Check out the examples below: * [Standard Posts](https://connekthq.com/plugins/ajax-load-more/examples/default/) * [Custom Post Types](https://connekthq.com/plugins/ajax-load-more/examples/masonry/) * [Pages](https://connekthq.com/plugins/ajax-load-more/examples/search-results/) * [Single Posts](https://connekthq.com/ajax-load-more-posts/alm-post-example/) ** * [Comments](http://comments.connekthq.com/example-post/) ** ** Add-on required = Shortcode Parameters = Ajax Load More accepts a number of parameters that are passed to the WordPress query. These parameters are transferred via shortcode - don't worry, creating your custom shortcode is simple with the intuitive [Shortcode Builder](https://connekthq.com/plugins/ajax-load-more/screenshots/#shortcode-builder) * **repeater** - Choose a repeater template (Add-on available). Default = ‘default’ * **theme_repeater** - Select from a list of template files in your current theme directory (Add-on only). Default = null * **post_type** - Comma separated list of post types. Default = ‘post’ * **post_format** - Query by post format. Default = null * **category** - A comma separated list of categories to include by slug. Default = null * **category__not_in** - A comma separated list of categories to exclude by ID. Default = null * **tag** - A comma separated list of tags to include by slug. Default = null * **tag__not_in** - A comma separated list of tags to exclude by ID. Default = null * **taxonomy** - Query by custom taxonomy name. Default = null * **taxonomy_terms** - Comma separated list of custom taxonomy terms(slug). Default = null * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’ * **taxonomy_relation** - The logical relationship between each taxonomy when there is more than one. (AND/OR). Default = ‘AND’ * **day** - Day of the week. Default = null * **month** - Month of the year. Default = null * **year** - Year of post. Default = null * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’ * **meta_key** - Custom field key(name). Default = null * **meta_value** - Custom field value. Default = null * **meta_compare** - Operator to compare meta_key and meta_value against. Default = ‘IN’ * **meta_type** - Custom field type. Default = ‘CHAR’ * **meta_relation** - Used with multiple custom field entries (AND/OR). Default = ‘AND’ * **author** - Query by author id. Default = null * **post__in** - Comma separated list of post ID’s to include in query. Default = null * **post__not_in** - Comma separated list of post ID’s to exclude from query. Default = null * **search** - Query search term (‘s’). Default = null * **custom_args** - A semicolon separated list of value:pair arguments. e.g. tag_slug__and:design,development; event_display:upcoming. Default = null * **post_status** - Select status of the post. Default = 'publish' * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’ * **orderby** - Order posts by date, title, name, menu order, random, author, post ID or comment count. Default = ‘date’ * **offset** - Offset the initial query (number). Default = ’0′ * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′ * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’ * **scroll_distance** - The distance from the bottom of the screen to trigger the loading of posts while scrolling. Default = '150' * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '5' * **pause_override** - Allow scrolling to override the Pause parameter and trigger the loading of posts on scroll. Default = null * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false' * **transition** - Choose a posts reveal transition (slide/fade/none). Default = 'slide' * **transition_speed** - The speed of the loading transition in milliseconds. (slide/fade/none). Default = '250' * **transition_container** - Display the Ajax Load More (.alm-reveal) loading container. Default = 'true' * **images_loaded** - Wait for all images to load before displaying ajax loaded content (true/false). Default = 'false' * **destroy_after** - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null * **button_label** - The label text for Load More button. Default = 'Older Posts' * **button_loading_label** - Update the text of the Load More button while content is loading. Default = null * **container_type** - Override the global Container Type that was set on ALM Settings page. Default = null * **css_classes** - Add custom CSS classes to the Ajax Load More container. Default = null * **cache** - Turn on content caching for the specific Ajax Load More query. add-on only - (true/false). Default = ‘false’ * **cache_id** - A unique 10 digit ID for the cached query. add-on only - Default = A random 10 digit integer * **seo** - Enable address bar URL rewrites as users page through content - add-on only (true/false). Default = ‘false’ * **preloaded** - Should Ajax Load More preload posts? add-on only - (true/false). Default = ‘false’ * **preloaded_amount** - The amount of posts to preload. add-on only - Default = ‘5’ * **paging** - Replace infinite scrolling with a paged navigation system. add-on only (true/false). Default = ‘false’ * **paging_controls** - Show previous(«) and next(») buttons (true/false). Default = ‘false’ * **paging_classes** - Add classes to the paging navigation menu for CSS styling. * **paging_show_at_most** - Maximum amount of pages to show at a time. 0 = no maximum. Default = ‘0’ *** = Example Shortcode = [ajax_load_more post_type="post, portfolio" repeater="default" posts_per_page="5" transition="fade" button_label="Older Posts"] *** = Demos = * **[Default](https://connekthq.com/plugins/ajax-load-more/)** - Out of the box functionality and styling * **[Destroy After](https://connekthq.com/plugins/ajax-load-more/examples/destroy-after/)** - Remove Ajax Load More functionality after 'n' number of pages * **[Fade Transition](https://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded * **[Filtering](https://connekthq.com/plugins/ajax-load-more/examples/filtering/)** - Reset and filter an Ajax Load More instance * **[Infinite Scroll](https://connekthq.com/plugins/ajax-load-more/examples/infinite-scroll/)** - A look at the new loading functionality and style * **[Images Loaded](https://connekthq.com/plugins/ajax-load-more/examples/images-loaded/)** - Download images before displaying ajax loaded content * **[Masonry](https://connekthq.com/plugins/ajax-load-more/examples/masonry/)** - Creating a flexible grid layout with Masonry JS * **[Multiple Instances](https://connekthq.com/plugins/ajax-load-more/examples/multiple-instances/)** - Include multiple Ajax Load More' on a single page * **[Paging URLs](https://connekthq.com/plugins/ajax-load-more/examples/paging-urls/)** - Generate unique paging URLs for every Ajax Load More query with the SEO add-on * **[Pause Loading](https://connekthq.com/plugins/ajax-load-more/examples/pause-loading/)** - Posts will not load until initiated by the user * **[Preloaded Posts](https://connekthq.com/plugins/ajax-load-more/examples/pause-loading/)** - Easily preload an initial set of posts before completing any Ajax requests to the server * **[Search Results](https://connekthq.com/plugins/ajax-load-more/examples/search-results/)** - Returning results based on search terms * **[SEO & Paging](https://connekthq.com/plugins/ajax-load-more/examples/seo-paging-add-ons/)** - Combine these two add-ons to create one powerful navigation system * **[Slideshow Gallery](https://connekthq.com/plugins/ajax-load-more/examples/slideshow-gallery/)** - Create a gallery of posts with Ajax Load More and the Paging add-on. * **[Table Layout](https://connekthq.com/plugins/ajax-load-more/examples/table/)** - Ajax Load More will display query results in a table format. [View All Examples](https://connekthq.com/plugins/ajax-load-more/examples/) *The [Custom Repeater Add-On](https://connekthq.com/plugins/ajax-load-more/custom-repeaters/) has been installed for use on each of our product demos* [youtube https://www.youtube.com/watch?v=EQ57i6dkOew] *** = Add-ons = The following Add-ons are available to increase the functionality of Ajax Load More. > #### Cache > The **[Cache](https://connekthq.com/plugins/ajax-load-more/cache/)** add-oncreates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/cache/) > > #### Comments > The **[Comments](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)** add-on will load and display blog comments using the core Ajax Load More infinite scroll functionality.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/) > > #### Custom Repeaters > The **[Custom Repeaters](https://connekthq.com/plugins/ajax-load-more/custom-repeaters/)** add-on will allow for **unlimited repeater templates** and provide the ability to create unique templates for different content types throughout your theme.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/custom-repeaters/) > > #### Layouts > The **[Layouts](https://connekthq.com/plugins/ajax-load-more/layouts/)** add-on will provide a library of fully responsive layout templates ready for use on your website.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/layouts/) > > #### Paging > The **[Paging](https://connekthq.com/plugins/ajax-load-more/paging/)** add-on will transform Ajax Load More’s lazy load/infinite scroll functionality into a robust ajax powered navigation system.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/paging/) > > #### Preloaded > The **[Preloaded](https://connekthq.com/plugins/ajax-load-more/preloaded/)** add-on will allow you to quickly and easily preload an initial set of posts before completing any Ajax requests to the server.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/preloaded/) > > #### Previous Post > The **[Previous Post](https://connekthq.com/plugins/ajax-load-more/previous-post/)** add-on will allow you to navigate single posts with Ajax Load More.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/previous-post/) > > #### REST API > The **[REST API](https://connekthq.com/plugins/ajax-load-more/rest-api/)** add-on will enable compatibility between Ajax Load More and the WP REST API plugin.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/rest-api/) > > #### Search Engine Optimization > The **[SEO](https://connekthq.com/plugins/ajax-load-more/seo/)** add-on will optimize your ajax loaded content for search engines and site visitors by generating standard WordPress paging URLs with each Ajax Load More query.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/seo/) > > #### Theme Repeaters > The **[Theme Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)** add-on will allow you load, edit and maintain templates from your current theme directory.
> [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/) *** = Callback Functions = The following [functions](https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/) are available to be dispatched by Ajax Load More. **ALM Complete** - The almComplete() function is triggered after every *successful* ajax call made by Ajax Load More. $.fn.almComplete = function(alm){ // Your on complete code goes here }; **ALM Done** - The almDone() function is triggered after all posts have been loaded.. $.fn.almDone = function(alm){ console.log('All posts have been loaded!'); }; **ALM Empty** - The almEmpty() function is triggered if there are zero results returned in the initial query. $.fn.almEmpty = function(alm){ console.log('Sorry, but we could not locate any posts that matched your criteria.'); }; **ALM Filter Complete** - The almFilterComplete() function is triggered after a successful call to the public function almFilter(). $.fn.almFilterComplete = function(){ console.log('Ajax Load More filter has completed!'); }; **ALM URL Update** - The almUrlUpdate() function is triggered after a successful URL update (pushState) from the Previous Post or the Search Engine Optimization add-on $.fn.almUrlUpdate = function(permalink, type){ console.log("URL updated to " + permalink + '- dispatched from the '+ type + ' add-on.'); }; *** = Variables = Ajax Load More passes the following PHP [variables](https://connekthq.com/plugins/ajax-load-more/docs/variables/) to each repeater template - these template variables can help you style and transform your repeater templates. * **$alm_current** - Returns the current item number in the current Ajax Load More loop and will reset to zero with every 'Load More' action.. 'echo $alm_current;' * **$alm_page** - Returns the current page number. 'echo $alm_page;' * **$alm_item** - Returns the current item number within your loop. 'echo $alm_item;' * **$alm_found_posts** - Returns the total number of posts found within the entire WordPress query. 'echo $alm_found_posts;' *** = Tested Browsers = * Firefox (Mac, PC) * Chrome (Mac, PC, iOS, Android) * Safari (Mac, iOS) * IE8+ * Android (Native) * BB10 (Native) *** = Website = https://connekthq.com/ajax-load-more/ *** = Please Rate Ajax Load More! = Your ratings make a big difference! If you like and use Ajax Load More, please consider taking the time to [rate my plugin](https://wordpress.org/support/view/plugin-reviews/ajax-load-more). Your ratings and reviews will help this plugin grow and provide the motivation needed to keep pushing it forward. == Frequently Asked Questions == = What are the steps to getting Ajax Load More to display on my website = 1. Create your shortcode 2. Add the shortcode to your page, by adding it through the content editor or placing it directly within one of your template files. 3. Load a page with your shortcode in place and watch Ajax Load More fetch your posts. = What are my server requirements? = Your server must be able to read/write/create files. Ajax Load More creates the default repeater on plugin activation and in order to modify the output we are required to write to the file as well. = Is the ajax functionality secure? = Yes, Ajax Load more uses admin-ajax and nonces in order to protect URLs and forms from being misused. = Can I make modifications to the plugin code? = Sure, but please be aware that if modifications are made it may affect future updates of the plugin. = Can I modify the repeater template? = Yes, visit the Repeater Template section in your WordPress admin. = How are my repeater templates saved? = Repeater template data is saved into your WordPress database as well as written directly to a repeater template .php file in the ajax-load-more plugin directory. = Can I use custom fields in a repeater? = Yes, but you will need to define $post at the top of the repeater before requesting your custom fields. Like so: global $post; == Installation == How to install Ajax Load More. = Using The WordPress Dashboard = 1. Navigate to the 'Add New' in the plugins dashboard 2. Search for 'Ajax Load More' 3. Click 'Install Now' 4. Activate the plugin on the Plugin dashboard = Uploading in WordPress Dashboard = 1. Navigate to the 'Add New' in the plugins dashboard 2. Navigate to the 'Upload' area 3. Select `ajax-load-more.zip` from your computer 4. Click 'Install Now' 5. Activate the plugin in the Plugin dashboard = Using FTP = 1. Download `ajax-load-more.zip` 2. Extract the `ajax-load-more` directory to your computer 3. Upload the `ajax-load-more` directory to the `/wp-content/plugins/` directory 4. Activate the plugin in the Plugin dashboard == Screenshots == 1. Settings screen 2. Available Repeater Templates 3. Custom Repeaters Add-On 4. Shortcode Builder 5. Content Editor shortcode icon 6. Edit Page Shortcode Builder 7. Shortcode and implementation examples == Changelog == = 2.11.0 - May 25, 2016 = * NEW - Adding required functionality for the new REST API add-on. * FIX - Fixed url parsing issue with the ALM base URL and Blog page url. This was affecting SEO add-on users. * UPDATE - WP_Query Performance improvements. * UPDATE - Various UI updates/tweaks. = 2.10.1 - May 8, 2016 = * NEW - Users can now load a custom version of ajax-load-more.css from {/alm} folder in current theme directory. * NEW - Class definitions for alm shortcode and css enqueue script. More to come. * FIX - Removed unnecessary ob_end_clean() function from alm_query_posts() that was causing php notices for some users. * FIX - Fixed meta_query issue with EXISTS and NOT EXISTS meta_compare values. * FIX - Issue with meta_key parameter and orderby. * UPDATE - Updated $.fn.almUpdateCurrentPage() function to allow for multiple instances of Paging. * UPDATE - Various Admin UI bug fixes/enhancements. = 2.10.0.1 - April 11, 2016 = * FIX - JavaScript fix for 'Unexpected token' error is Safari and IE with alm.AjaxLoadMore.success() function. * FIX - Fixed canonical URL issue on home/front pages. = 2.10.0 - April 10, 2016 = * NEW - Converted the Ajax return content type from HTML to JSON. * NEW - Adding transition_speed shortcode parameter. * NEW - Added alm_button_label filter to modify default button text. * NEW - Added new canonical URL builder for pages and archives - this function helps build legitimate URLs for the Search Engine Optimization add-on. * FIX - Fixed issue with undefined post slug on archive pages. * UPDATE - Performance improvements and code reduction. * UPGRADE NOTICE - When updating to 2.10 you must also update SEO and Comments add-ons. = 2.9 = * NEW - Adding support for new Layouts add-on. * NEW - Adding support for table container type. * NEW - Adding new 'transition_container' shortcode parameter to allow for removal of the .alm-reveal div in the ajax output. * FIX - Fixed issue with the display of Previous Post taxonomy selection in Shortcode Builder. * FIX - Fixed issue with noscript navigation for preloaded and seo add-ons. * FIX - Fixed issue with hiding of Button Classes setting if 'Disable CSS' is checked. * FIX - Fixed bug with custom repeater fallback function. * FIX - Fixed issue with almDone function firing before a the button text reset function. * UPDATE - Various UI/UX enhancments. * UPDATE - Adding cache support for Theme Repeaters add-on. * UPDATE - Updating add-on activation script from wp_remote_get to wp_remote_post. = 2.8.6 = * NEW - Adding a set of filter hooks to enable users to hook into Ajax Load More to insert or modify data. See https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/ for more information. * FIX - Updated infinite scrolling css styling. = 2.8.5 = * FIX - Update for ALM settings screen - layout was broken with WP 4.4 release. * NEW - Adding new functionality to allow for loading of local default repeater template. Users can create a /alm_templates directory within their current theme and add default.php. If default.php is present it will be loaded before repeater template shipped with Ajax Load More. * NEW - Adding multiple taxonomy support - you can now query WordPress by up to 3 unique taxonomy queries. * NEW - Adding taxonomy_relation shortcode parameter. * FIX - Fixed JS error in shortcode builder popup. * FIX - Fix for issue with '<' and '<=' Custom Field operators, WP was rendering these tags as HTML (https://github.com/dcooney/wordpress-ajax-load-more/issues/98). Users can now enter 'lessthan' and 'lessthanequalto' to fix this issue. * UPDATE - Changing 'exclude' shortcode parameter name to be 'post__not_in' to follow WordPress naming conventions. 'exclude' will continue to work along side 'post__not_in'. = 2.8.4 = * NEW - Adding new loading styles and button types. * NEW - Adding new 'button_loading_label' parameter allowing users to change button text while loading content. * NEW - Adding required support and functionality for new Comments add-on - https://connekthq.com/plugins/ajax-load-more/add-ons/comments/ * UPDATE - Updating JS functions for release of Previous Post v1.1. * UPDATE - Various admin enhancements and removing deprecated code. * UPDATE - removing default link color in ajax-load-more.css. = 2.8.3 = * PERFORMANCE - Updating ALM core to enqueue Ajax Load More js only when shortcode is present on screen. * NEW - Adding 'canonical-url' data attribute to ALM plugin wrapper - this will be used by various functions throughout the core plugin and add-ons. * NEW - Adding new alm-thumbnail image size. * NEW - Adding required functionality for upcoming Layouts add-on. * NEW - To increase SEO and crawler access we added a