WordPress Infinite Scroll – Ajax Load More - Version 3.0.1

Version Description

  • May 22, 2017 =

  • NEW - Added support for caching single posts with the Previous Post and Cache add-ons.

  • NEW - Adding support for Advanced Custom Fields extension for Gallery and Flexible Content field types.

  • UPDATE - Updating cache-path parameter to allow for easier caching while ajax filtering.

  • FIX - Fixed PHP warning in ALM_SHORTCODE class for undefined $post->ID on taxonomy archive pages.

Download this release

Release Info

Developer dcooney
Plugin Icon 128x128 WordPress Infinite Scroll – Ajax Load More
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

.editorconfig CHANGED
@@ -7,7 +7,7 @@
7
 
8
  root = true
9
 
10
- [*.php]
11
  charset = utf-8
12
  end_of_line = lf
13
  insert_final_newline = true
7
 
8
  root = true
9
 
10
+ [*]
11
  charset = utf-8
12
  end_of_line = lf
13
  insert_final_newline = true
README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dcooney, connekthq
3
  Donate link: https://connekthq.com/donate/
4
  Tags: infinite scroll, infinite scrolling, scroll, infinite, lazy load, lazy loading, pagination, ajax pagination, ajax, ajax posts, ajax load posts, search, tags, category, post types, taxonomy, meta_query, woocommerce, ajax load more
5
  Requires at least: 3.6
6
- Tested up to: 4.7.4
7
- Stable tag: 3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -14,11 +14,11 @@ The ultimate infinite scroll and lazy load solution for your WordPress powered w
14
 
15
  Ajax Load More is a powerful solution for infinite scrolling and lazy loading WordPress posts, custom post types, single posts, pages and comments with Ajax powered queries.
16
 
17
- 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.
18
 
19
  Ajax Load More is fully compatible for infinite scrolling with popular eCommerce plugins such as WooCommerce and Easy Digital Downloads.
20
 
21
- **[Get More Information](https://connekthq.com/plugins/ajax-load-more/)**
22
 
23
  = Features =
24
  * **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).
@@ -33,9 +33,7 @@ Check out the **[demo site](https://connekthq.com/plugins/ajax-load-more/)** for
33
  ***
34
 
35
  = Content Types =
36
- Ajax Load More can infinite scroll any content type WordPress offers - from blog posts to multipage content to WooCommerce products - Ajax Load More can handle it all.
37
-
38
- Check out the examples below:
39
 
40
  * [Standard Posts](https://connekthq.com/plugins/ajax-load-more/examples/default/)
41
  * [Custom Post Types](https://connekthq.com/plugins/ajax-load-more/examples/masonry/)
@@ -51,52 +49,52 @@ Check out the examples below:
51
 
52
  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)
53
 
54
- * **repeater** - Choose a repeater template (<a href="https://connekthq.com/plugins/ajax-load-more/custom-repeaters/">Add-on available</a>). Default = ‘default’
55
- * **post_type** - Comma separated list of post types. Default = ‘post’
56
- * **sticky_posts** - Preserve sticky post ordering in Ajax listing. Default = false
57
- * **post_format** - Query by post format. Default = null
58
- * **category** - A comma separated list of categories to include by slug. Default = null
59
- * **category__not_in** - A comma separated list of categories to exclude by ID. Default = null
60
- * **tag** - A comma separated list of tags to include by slug. Default = null
61
- * **tag__not_in** - A comma separated list of tags to exclude by ID. Default = null
62
- * **taxonomy** - Query by custom taxonomy name. Default = null
63
- * **taxonomy_terms** - Comma separated list of custom taxonomy terms(slug). Default = null
64
- * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
65
- * **taxonomy_relation** - The logical relationship between each taxonomy when there is more than one. (AND/OR). Default = ‘AND’
66
- * **day** - Day of the week. Default = null
67
- * **month** - Month of the year. Default = null
68
- * **year** - Year of post. Default = null
69
- * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
70
- * **meta_key** - Custom field key(name). Default = null
71
- * **meta_value** - Custom field value. Default = null
72
- * **meta_compare** - Operator to compare meta_key and meta_value against. Default = ‘IN’
73
- * **meta_type** - Custom field type. Default = ‘CHAR’
74
- * **meta_relation** - Used with multiple custom field entries (AND/OR). Default = ‘AND’
75
- * **author** - Comma separated list of authors by id. Default = null
76
- * **post__in** - Comma separated list of post ID’s to include in query. Default = null
77
- * **post__not_in** - Comma separated list of post ID’s to exclude from query. Default = null
78
- * **search** - Query search term (‘s’). Default = null
79
- * **custom_args** - A semicolon separated list of value:pair arguments. e.g. tag_slug__and:design,development; event_display:upcoming. Default = null
80
- * **post_status** - Select status of the post. Default = 'publish'
81
- * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
82
- * **orderby** - Order posts by date, title, name, menu order, author, post ID or comment count. Default = ‘date’
83
- * **offset** - Offset the initial query (number). Default = ’0′
84
- * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
85
- * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
86
- * **scroll_distance** - The distance from the bottom of the screen to trigger the loading of posts while scrolling. Default = '150'
87
- * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '0'
88
- * **pause_override** - Allow scrolling to override the Pause parameter and trigger the loading of posts on scroll. Default = null
89
- * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
90
- * **transition** - Choose a posts reveal transition (slide/fade/none). Default = 'slide'
91
- * **transition_speed** - The speed of the loading transition in milliseconds. (slide/fade/none). Default = '250'
92
- * **transition_container** - Display the Ajax Load More (.alm-reveal) loading container. Default = 'true'
93
- * **images_loaded** - Wait for all images to load before displaying ajax loaded content (true/false). Default = 'false'
94
- * **destroy_after** - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null
95
- * **button_label** - The label text for Load More button. Default = 'Older Posts'
96
- * **button_loading_label** - Update the text of the Load More button while content is loading. Default = null
97
- * **container_type** - Override the global Container Type that was set on ALM Settings page. Default = null
98
- * **css_classes** - Add custom CSS classes to the Ajax Load More container. Default = null
99
- * **id** - A unique ID for the Ajax Load More instance.
100
  ***
101
 
102
  = Example Shortcode =
@@ -106,24 +104,26 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
106
  ***
107
 
108
  = Demos =
109
- * **[Default](https://connekthq.com/plugins/ajax-load-more/examples/default/)** - Out of the box functionality and styling
110
- * **[Attachments](https://connekthq.com/plugins/ajax-load-more/examples/attachments/)** - Infinite scroll post attachments
111
- * **[Destroy After](https://connekthq.com/plugins/ajax-load-more/examples/destroy-after/)** - Remove Ajax Load More functionality after 'n' number of pages
112
- * **[Fade Transition](https://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded
113
- * **[Filtering](https://connekthq.com/plugins/ajax-load-more/examples/filtering/)** - Reset and filter an Ajax Load More instance
114
- * **[Infinite Scroll](https://connekthq.com/plugins/ajax-load-more/examples/infinite-scroll/)** - A look at the new loading functionality and style
115
- * **[Images Loaded](https://connekthq.com/plugins/ajax-load-more/examples/images-loaded/)** - Download images before displaying ajax loaded content
116
- * **[Masonry](https://connekthq.com/plugins/ajax-load-more/examples/masonry/)** - Creating a flexible grid layout with Masonry JS
117
- * **[Multiple Instances](https://connekthq.com/plugins/ajax-load-more/examples/multiple-instances/)** - Include multiple Ajax Load More' on a single page
118
- * **[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
119
- * **[Pause Loading](https://connekthq.com/plugins/ajax-load-more/examples/pause-loading/)** - Posts will not load until initiated by the user
120
- * **[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
121
- * **[Search Results](https://connekthq.com/plugins/ajax-load-more/examples/search-results/)** - Returning results based on search terms
122
- * **[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
 
123
  * **[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.
124
  * **[Table Layout](https://connekthq.com/plugins/ajax-load-more/examples/table/)** - Ajax Load More will display query results in a table format.
 
125
 
126
- [View All Examples](https://connekthq.com/plugins/ajax-load-more/examples/)
127
 
128
  *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*
129
 
@@ -135,59 +135,58 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
135
  The following [add-ons](https://connekthq.com/plugins/ajax-load-more/add-ons/) are available to increase the functionality of Ajax Load More.
136
 
137
  > #### Cache
138
- > The **[Cache](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)** add-oncreates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.<br />
139
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)
140
  >
141
  > #### Call to Actions
142
- > The **[Call to Actions](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)** add-on will provide functionality to inject a custom CTA template within an Ajax Load More query.<br />
143
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)
144
  >
145
  > #### Comments
146
- > 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.<br />
147
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)
148
  >
149
  > #### Custom Repeaters
150
- > The **[Custom Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/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.<br />
151
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/custom-repeaters/)
152
  >
153
  > #### Layouts
154
- > The **[Layouts](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)** add-on will provide a library of fully responsive layout templates ready for use on your website.<br />
155
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)
156
  >
157
  > #### Next Page
158
- > The **[Next Page](https://connekthq.com/plugins/ajax-load-more/add-ons/next-page/)** add-on Load and display paginated WordPress content on demand using the `<!–-nextpage–->` Quicktag.<br />
159
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/next-page/)
160
  >
161
  > #### Paging
162
- > The **[Paging](https://connekthq.com/plugins/ajax-load-more/add-ons/paging/)** add-on will transform Ajax Load More’s lazy load/infinite scroll functionality into a robust ajax powered navigation system.<br />
163
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/paging/)
164
  >
165
  > #### Preloaded
166
- > The **[Preloaded](https://connekthq.com/plugins/ajax-load-more/add-ons/preloaded/)** add-on will allow you to quickly and easily preload an initial set of posts before completing any Ajax requests to the server.<br />
167
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/preloaded/)
168
  >
169
  > #### Previous Post
170
- > The **[Previous Post](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)** add-on will allow you to navigate single posts with Ajax Load More.<br />
171
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)
172
  >
173
  > #### Search Engine Optimization
174
- > The **[SEO](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)** 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.<br />
175
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)
176
  >
177
  > #### Theme Repeaters
178
- > 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.<br />
179
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)
180
 
181
 
182
  ***
183
 
184
  = Extensions =
185
- The following [extensions](https://connekthq.com/plugins/ajax-load-more/extensions/) are available to provide compatibility with popular WordPress plugins and core features.
186
 
187
  > #### Advanced Custom Fields
188
- > The **[Advanced Custom Fields](https://connekthq.com/plugins/ajax-load-more/extensions/advanced-custom fields/)** extension provides additional functionality for infinite scrolling Repeater and Relationship field data with Ajax Load More.
189
  >
190
-
191
  > #### Relvanssi
192
  > The **[Relevanssi](https://connekthq.com/plugins/ajax-load-more/extensions/relevanssi/)** extension provides the functionality for returning Relevanssi query results to Ajax Load More.
193
  >
@@ -352,6 +351,14 @@ How to install Ajax Load More.
352
 
353
  == Changelog ==
354
 
 
 
 
 
 
 
 
 
355
  = 3.0 - May 4, 2017 =
356
 
357
  * NEW - Added required functionality for new [Advanced Custom Fields extension](https://connekthq.com/plugins/ajax-load-more/extensions/advanced-custom-fields/)
@@ -365,7 +372,7 @@ How to install Ajax Load More.
365
  * Updated - Updated styling (font size and family) on Load More button.
366
  * FIX - JS error when using multiple filters in Safari (Missing closing `]` bracket on data attribute).
367
  * FIX - Missing quote in shortcode builder when using call to actions and theme repater add-ons.
368
- * UPDATE - Various UI and UX enhancements.
369
 
370
  = 2.14.1 - March 24, 2017 =
371
 
3
  Donate link: https://connekthq.com/donate/
4
  Tags: infinite scroll, infinite scrolling, scroll, infinite, lazy load, lazy loading, pagination, ajax pagination, ajax, ajax posts, ajax load posts, search, tags, category, post types, taxonomy, meta_query, woocommerce, ajax load more
5
  Requires at least: 3.6
6
+ Tested up to: 4.7.5
7
+ Stable tag: 3.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
 
15
  Ajax Load More is a powerful solution for infinite scrolling and lazy loading WordPress posts, custom post types, single posts, pages and comments with Ajax powered queries.
16
 
17
+ Create custom WordPress queries using the Ajax Load More shortcode builder then add the shortcode to your page via the content editor or directly into theme templates in the location you want infinite scroll content to appear.
18
 
19
  Ajax Load More is fully compatible for infinite scrolling with popular eCommerce plugins such as WooCommerce and Easy Digital Downloads.
20
 
21
+ **[&rarr; Get More Information](https://connekthq.com/plugins/ajax-load-more/)**
22
 
23
  = Features =
24
  * **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).
33
  ***
34
 
35
  = Content Types =
36
+ Ajax Load More can infinite scroll any content type WordPress offers - from blog posts to multipage content to WooCommerce products - Ajax Load More can handle it.
 
 
37
 
38
  * [Standard Posts](https://connekthq.com/plugins/ajax-load-more/examples/default/)
39
  * [Custom Post Types](https://connekthq.com/plugins/ajax-load-more/examples/masonry/)
49
 
50
  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)
51
 
52
+ * `repeater` - Choose a repeater template (<a href="https://connekthq.com/plugins/ajax-load-more/custom-repeaters/">Add-on available</a>). Default = ‘default’
53
+ * `post_type` - Comma separated list of post types. Default = ‘post’
54
+ * `sticky_posts` - Preserve sticky post ordering in Ajax listing. Default = false
55
+ * `post_format` - Query by post format. Default = null
56
+ * `category` - A comma separated list of categories to include by slug. Default = null
57
+ * `category__not_in` - A comma separated list of categories to exclude by ID. Default = null
58
+ * `tag` - A comma separated list of tags to include by slug. Default = null
59
+ * `tag__not_in` - A comma separated list of tags to exclude by ID. Default = null
60
+ * `taxonomy` - Query by custom taxonomy name. Default = null
61
+ * `taxonomy_terms` - Comma separated list of custom taxonomy terms(slug). Default = null
62
+ * `taxonomy_operator` - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
63
+ * `taxonomy_relation` - The logical relationship between each taxonomy when there is more than one. (AND/OR). Default = ‘AND’
64
+ * `day` - Day of the week. Default = null
65
+ * `month` - Month of the year. Default = null
66
+ * `year` - Year of post. Default = null
67
+ * `taxonomy_operator` - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
68
+ * `meta_key` - Custom field key(name). Default = null
69
+ * `meta_value` - Custom field value. Default = null
70
+ * `meta_compare` - Operator to compare meta_key and meta_value against. Default = ‘IN’
71
+ * `meta_type` - Custom field type. Default = ‘CHAR’
72
+ * `meta_relation` - Used with multiple custom field entries (AND/OR). Default = ‘AND’
73
+ * `author` - Comma separated list of authors by id. Default = null
74
+ * `post__in` - Comma separated list of post ID’s to include in query. Default = null
75
+ * `post__not_in` - Comma separated list of post ID’s to exclude from query. Default = null
76
+ * `search` - Query search term (‘s’). Default = null
77
+ * `custom_args` - A semicolon separated list of value:pair arguments. e.g. tag_slug__and:design,development; event_display:upcoming. Default = null
78
+ * `post_status` - Select status of the post. Default = 'publish'
79
+ * `order` - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
80
+ * `orderby` - Order posts by date, title, name, menu order, author, post ID or comment count. Default = ‘date’
81
+ * `offset` - Offset the initial query (number). Default = ’0′
82
+ * `posts_per_page` - Number of posts to load with each Ajax request. Default = ’5′
83
+ * `scroll` - Load more posts as the user scrolls the page (true/false). Default = ‘true’
84
+ * `scroll_distance` - The distance from the bottom of the screen to trigger the loading of posts while scrolling. Default = '150'
85
+ * `max_pages` - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '0'
86
+ * `pause_override` - Allow scrolling to override the Pause parameter and trigger the loading of posts on scroll. Default = null
87
+ * `pause` - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
88
+ * `transition` - Choose a posts reveal transition (slide/fade/none). Default = 'slide'
89
+ * `transition_speed` - The speed of the loading transition in milliseconds. (slide/fade/none). Default = '250'
90
+ * `transition_container` - Display the Ajax Load More (.alm-reveal) loading container. Default = 'true'
91
+ * `images_loaded` - Wait for all images to load before displaying ajax loaded content (true/false). Default = 'false'
92
+ * `destroy_after` - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null
93
+ * `button_label` - The label text for Load More button. Default = 'Older Posts'
94
+ * `button_loading_label` - Update the text of the Load More button while content is loading. Default = null
95
+ * `container_type` - Override the global Container Type that was set on ALM Settings page. Default = null
96
+ * `css_classes` - Add custom CSS classes to the Ajax Load More container. Default = null
97
+ * `id` - A unique ID for the Ajax Load More instance.
98
  ***
99
 
100
  = Example Shortcode =
104
  ***
105
 
106
  = Demos =
107
+ * **[Default](https://connekthq.com/plugins/ajax-load-more/examples/default/)** - Out of the box functionality and styling.
108
+ * **[Advanced Custom Fields](https://connekthq.com/plugins/ajax-load-more/examples/advanced-custom-fields//)** - Infinite scroll Advanced Custom Fields data.
109
+ * **[Attachments](https://connekthq.com/plugins/ajax-load-more/examples/attachments/)** - Infinite scroll post attachments.
110
+ * **[Destroy After](https://connekthq.com/plugins/ajax-load-more/examples/destroy-after/)** - Remove Ajax Load More functionality after 'n' number of pages.
111
+ * **[Fade Transition](https://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded.
112
+ * **[Filtering](https://connekthq.com/plugins/ajax-load-more/examples/filtering/)** - Reset and filter an Ajax Load More instance.
113
+ * **[Infinite Scroll](https://connekthq.com/plugins/ajax-load-more/examples/infinite-scroll/)** - A look at the new loading functionality and style.
114
+ * **[Images Loaded](https://connekthq.com/plugins/ajax-load-more/examples/images-loaded/)** - Download images before displaying ajax loaded content.
115
+ * **[Masonry](https://connekthq.com/plugins/ajax-load-more/examples/masonry/)** - Creating a flexible grid layout with Masonry JS.
116
+ * **[Multiple Instances](https://connekthq.com/plugins/ajax-load-more/examples/multiple-instances/)** - Include multiple Ajax Load More' on a single page.
117
+ * **[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.
118
+ * **[Pause Loading](https://connekthq.com/plugins/ajax-load-more/examples/pause-loading/)** - Posts will not load until initiated by the user.
119
+ * **[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.
120
+ * **[Search Results](https://connekthq.com/plugins/ajax-load-more/examples/search-results/)** - Returning results based on search terms.
121
+ * **[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.
122
  * **[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.
123
  * **[Table Layout](https://connekthq.com/plugins/ajax-load-more/examples/table/)** - Ajax Load More will display query results in a table format.
124
+ * **[Woocommerce](https://connekthq.com/plugins/ajax-load-more/examples/woocommerce/)** - Infinite scrolling WooCommerce products with Ajax Load More
125
 
126
+ [&rarr; View All Examples](https://connekthq.com/plugins/ajax-load-more/examples/)
127
 
128
  *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*
129
 
135
  The following [add-ons](https://connekthq.com/plugins/ajax-load-more/add-ons/) are available to increase the functionality of Ajax Load More.
136
 
137
  > #### Cache
138
+ > The **[Cache](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)** add-on creates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.
139
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)
140
  >
141
  > #### Call to Actions
142
+ > The **[Call to Actions](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)** add-on will provide functionality to inject a custom CTA template within an Ajax Load More query.
143
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)
144
  >
145
  > #### Comments
146
+ > 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.
147
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)
148
  >
149
  > #### Custom Repeaters
150
+ > The **[Custom Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/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.
151
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/custom-repeaters/)
152
  >
153
  > #### Layouts
154
+ > The **[Layouts](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)** add-on will provide a library of fully responsive layout templates ready for use on your website.
155
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)
156
  >
157
  > #### Next Page
158
+ > The **[Next Page](https://connekthq.com/plugins/ajax-load-more/add-ons/next-page/)** add-on Load and display paginated WordPress content on demand using the `<!–-nextpage–->` Quicktag.
159
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/next-page/)
160
  >
161
  > #### Paging
162
+ > The **[Paging](https://connekthq.com/plugins/ajax-load-more/add-ons/paging/)** add-on will transform Ajax Load More’s lazy load/infinite scroll functionality into a robust ajax powered navigation system.
163
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/paging/)
164
  >
165
  > #### Preloaded
166
+ > The **[Preloaded](https://connekthq.com/plugins/ajax-load-more/add-ons/preloaded/)** add-on will allow you to quickly and easily preload an initial set of posts before completing any Ajax requests to the server.
167
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/preloaded/)
168
  >
169
  > #### Previous Post
170
+ > The **[Previous Post](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)** add-on will allow you to navigate single posts with Ajax Load More.
171
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)
172
  >
173
  > #### Search Engine Optimization
174
+ > The **[SEO](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)** 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.
175
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)
176
  >
177
  > #### Theme Repeaters
178
+ > 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.
179
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)
180
 
181
 
182
  ***
183
 
184
  = Extensions =
185
+ The following free [extensions](https://connekthq.com/plugins/ajax-load-more/extensions/) are available to provide compatibility with popular WordPress plugins and core features.
186
 
187
  > #### Advanced Custom Fields
188
+ > The [Advanced Custom Fields](https://connekthq.com/plugins/ajax-load-more/extensions/advanced-custom-fields/) extension provides additional functionality for infinite scrolling Repeater and Relationship field data with Ajax Load More.
189
  >
 
190
  > #### Relvanssi
191
  > The **[Relevanssi](https://connekthq.com/plugins/ajax-load-more/extensions/relevanssi/)** extension provides the functionality for returning Relevanssi query results to Ajax Load More.
192
  >
351
 
352
  == Changelog ==
353
 
354
+ = 3.0.1 - May 22, 2017 =
355
+
356
+ * NEW - Added support for caching single posts with the Previous Post and Cache add-ons.
357
+ * NEW - Adding support for Advanced Custom Fields extension for Gallery and Flexible Content field types.
358
+ * UPDATE - Updating cache-path parameter to allow for easier caching while ajax filtering.
359
+ * FIX - Fixed PHP warning in ALM_SHORTCODE class for undefined $post->ID on taxonomy archive pages.
360
+
361
+
362
  = 3.0 - May 4, 2017 =
363
 
364
  * NEW - Added required functionality for new [Advanced Custom Fields extension](https://connekthq.com/plugins/ajax-load-more/extensions/advanced-custom-fields/)
372
  * Updated - Updated styling (font size and family) on Load More button.
373
  * FIX - JS error when using multiple filters in Safari (Missing closing `]` bracket on data attribute).
374
  * FIX - Missing quote in shortcode builder when using call to actions and theme repater add-ons.
375
+ * UPDATE - Various UI and UX enhancements.
376
 
377
  = 2.14.1 - March 24, 2017 =
378
 
admin/css/admin.css CHANGED
@@ -1802,7 +1802,6 @@ table.highlight{
1802
  }
1803
  .license-wrap label{
1804
  font-weight: 600;
1805
- /* position: relative; */
1806
  top:-3px;
1807
  }
1808
  .license-wrap input[type=text]{
1802
  }
1803
  .license-wrap label{
1804
  font-weight: 600;
 
1805
  top:-3px;
1806
  }
1807
  .license-wrap input[type=text]{
admin/css/select2.css CHANGED
@@ -345,4 +345,5 @@ disabled look for disabled choices in the results dropdown
345
  padding: 0;
346
  position: absolute;
347
  width: 1px;
 
348
  }
345
  padding: 0;
346
  position: absolute;
347
  width: 1px;
348
+ left: 0;
349
  }
admin/shortcode-builder/shortcode-builder.php CHANGED
@@ -66,6 +66,8 @@
66
  <label class="offscreen" for="acf_field_type"><?php _e('Field Type', 'ajax-load-more'); ?>:</label>
67
  <select class="alm_element" name="acf_field_type" id="acf_field_type">
68
  <option value="" selected="selected">-- <?php _e('Select Field Type', 'ajax-load-more'); ?> --</option>
 
 
69
  <option value="relationship"><?php _e('Relationship', 'ajax-load-more'); ?></option>
70
  <option value="repeater"><?php _e('Repeater', 'ajax-load-more'); ?></option>
71
  </select>
66
  <label class="offscreen" for="acf_field_type"><?php _e('Field Type', 'ajax-load-more'); ?>:</label>
67
  <select class="alm_element" name="acf_field_type" id="acf_field_type">
68
  <option value="" selected="selected">-- <?php _e('Select Field Type', 'ajax-load-more'); ?> --</option>
69
+ <option value="flexible"><?php _e('Flexible Content', 'ajax-load-more'); ?></option>
70
+ <option value="gallery"><?php _e('Gallery', 'ajax-load-more'); ?></option>
71
  <option value="relationship"><?php _e('Relationship', 'ajax-load-more'); ?></option>
72
  <option value="repeater"><?php _e('Repeater', 'ajax-load-more'); ?></option>
73
  </select>
admin/views/settings.php CHANGED
@@ -25,7 +25,7 @@
25
 
26
  <ul class="share">
27
  <li class="twitter">
28
- <a target="blank" title="Share on Twitter" href="//twitter.com/home?status=I'm infinite scrolling with Ajax Load More for #WordPress - https://connekthq.com/plugins/ajax-load-more/" class="share-twitter"><i class="fa fa-twitter"></i> Twitter</a>
29
  </li>
30
  <li class="facebook">
31
  <a target="blank" title="Share on Facebook" href="//facebook.com/share.php?u=https://connekthq.com/plugins/ajax-load-more/" class="share-facebook"><i class="fa fa-facebook"></i> Facebook</a>
25
 
26
  <ul class="share">
27
  <li class="twitter">
28
+ <a target="blank" title="Share on Twitter" href="//twitter.com/home?status=I'm infinite scrolling with Ajax Load More for %23WordPress - https://connekthq.com/plugins/ajax-load-more/" class="share-twitter"><i class="fa fa-twitter"></i> Twitter</a>
29
  </li>
30
  <li class="facebook">
31
  <a target="blank" title="Share on Facebook" href="//facebook.com/share.php?u=https://connekthq.com/plugins/ajax-load-more/" class="share-facebook"><i class="fa fa-facebook"></i> Facebook</a>
ajax-load-more.php CHANGED
@@ -7,13 +7,13 @@ Text Domain: ajax-load-more
7
  Author: Darren Cooney
8
  Twitter: @KaptonKaos
9
  Author URI: http://connekthq.com
10
- Version: 3.0
11
  License: GPL
12
  Copyright: Darren Cooney & Connekt Media
13
  */
14
 
15
- define('ALM_VERSION', '3.0');
16
- define('ALM_RELEASE', 'May 4, 2017');
17
  define('ALM_STORE_URL', 'https://connekthq.com');
18
 
19
 
@@ -425,7 +425,7 @@ if( !class_exists('AjaxLoadMore') ):
425
 
426
  // CTA Add-on
427
  $cta = false;
428
- $ctaData = (isset($_GET['cta'])) ? $_GET['cta'] : '';
429
  if($ctaData){
430
  $cta = true;
431
  $cta_position = (isset($ctaData['cta_position'])) ? $ctaData['cta_position'] : 'before:1';
@@ -441,8 +441,13 @@ if( !class_exists('AjaxLoadMore') ):
441
 
442
 
443
  // Previous Post Add-on
444
- $is_previous_post = (isset($_GET['previous_post'])) ? $_GET['previous_post'] : false;
445
- $previous_post_id = (isset($_GET['previous_post_id'])) ? $_GET['previous_post_id'] : '';
 
 
 
 
 
446
 
447
 
448
  // Paging Add-on
@@ -666,7 +671,7 @@ if( !class_exists('AjaxLoadMore') ):
666
  *
667
  * @return $args;
668
  */
669
- if($is_previous_post == 'true' && has_action('alm_prev_post_installed')){
670
  $args = apply_filters('alm_prev_post_args', $previous_post_id, $postType);
671
  }
672
 
@@ -729,7 +734,6 @@ if( !class_exists('AjaxLoadMore') ):
729
  */
730
  if(!empty($cache_id) && has_action('alm_cache_create_dir')){
731
  apply_filters('alm_cache_create_dir', $cache_id, $canonical_url);
732
- $page_cache = ''; // set our page cache variable
733
  }
734
 
735
 
@@ -800,7 +804,13 @@ if( !class_exists('AjaxLoadMore') ):
800
  * @return null
801
  */
802
  if(!empty($cache_id) && has_action('alm_cache_installed')){
803
- apply_filters('alm_cache_file', $cache_id, $page, $seo_start_page, $data, $preloaded);
 
 
 
 
 
 
804
  }
805
 
806
 
7
  Author: Darren Cooney
8
  Twitter: @KaptonKaos
9
  Author URI: http://connekthq.com
10
+ Version: 3.0.1
11
  License: GPL
12
  Copyright: Darren Cooney & Connekt Media
13
  */
14
 
15
+ define('ALM_VERSION', '3.0.1');
16
+ define('ALM_RELEASE', 'May 22, 2017');
17
  define('ALM_STORE_URL', 'https://connekthq.com');
18
 
19
 
425
 
426
  // CTA Add-on
427
  $cta = false;
428
+ $ctaData = (isset($_GET['cta'])) ? $_GET['cta'] : false;
429
  if($ctaData){
430
  $cta = true;
431
  $cta_position = (isset($ctaData['cta_position'])) ? $ctaData['cta_position'] : 'before:1';
441
 
442
 
443
  // Previous Post Add-on
444
+ $previous_post = false;
445
+ $pp_data = (isset($_GET['previous_post'])) ? $_GET['previous_post'] : false;
446
+ if($pp_data){
447
+ $previous_post = true;
448
+ $previous_post_id = (isset($pp_data['id'])) ? $pp_data['id'] : '';
449
+ $previous_post_slug = (isset($pp_data['slug'])) ? $pp_data['slug'] : '';
450
+ }
451
 
452
 
453
  // Paging Add-on
671
  *
672
  * @return $args;
673
  */
674
+ if($previous_post && has_action('alm_prev_post_installed')){
675
  $args = apply_filters('alm_prev_post_args', $previous_post_id, $postType);
676
  }
677
 
734
  */
735
  if(!empty($cache_id) && has_action('alm_cache_create_dir')){
736
  apply_filters('alm_cache_create_dir', $cache_id, $canonical_url);
 
737
  }
738
 
739
 
804
  * @return null
805
  */
806
  if(!empty($cache_id) && has_action('alm_cache_installed')){
807
+ if($previous_post){
808
+ // Previous Post Cache
809
+ apply_filters('alm_previous_post_cache_file', $cache_id, $previous_post_slug, $data);
810
+ }else{
811
+ // Standard Cache
812
+ apply_filters('alm_cache_file', $cache_id, $page, $seo_start_page, $data, $preloaded);
813
+ }
814
  }
815
 
816
 
core/classes/class.alm-shortcode.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /**
3
- * Ajax Load More shortcode
4
  *
5
- * Returns the [ajax_load_more] shortcode.
6
  *
7
  * @author Darren Cooney
8
  * @since 2.10.1
@@ -18,10 +18,10 @@ if( !class_exists('ALM_SHORTCODE') ):
18
 
19
  static $counter = 0;
20
 
 
21
  /**
22
  * alm_render_shortcode
23
- *
24
- * Parse & Render ALM Shortcode.
25
  *
26
  * @since 2.10.1
27
  * @param $atts Shortcode attributes
@@ -39,8 +39,7 @@ if( !class_exists('ALM_SHORTCODE') ):
39
  $slug = alm_get_page_slug($post);
40
 
41
  // Define Post ID
42
- $post_id = $post->ID;
43
-
44
 
45
  // Custom CSS for Layouts - Only run this once.
46
  if(has_action('alm_layouts_custom_css')){
@@ -297,7 +296,6 @@ if( !class_exists('ALM_SHORTCODE') ):
297
  $preloaded = false;
298
  $seo = false;
299
  $paging = false;
300
- $cache = false;
301
  $comments = false;
302
  $acf = false;
303
  }
@@ -435,8 +433,8 @@ if( !class_exists('ALM_SHORTCODE') ):
435
 
436
  }
437
 
438
- elseif($acf && $acf_field_type === 'repeater'){ // Advanced Custom Fields
439
-
440
  if(has_action('alm_acf_installed') && $acf){
441
 
442
  /* alm_acf_preloaded
@@ -783,7 +781,7 @@ if( !class_exists('ALM_SHORTCODE') ):
783
  $previous_post_permanlink = ($_SERVER["QUERY_STRING"]) ? get_permalink($previous_post_id) .'?'. $_SERVER["QUERY_STRING"] : get_permalink($previous_post_id);
784
 
785
  // Get previous post include, build output from the next post filter
786
- $previous_post_output = '<div class="alm-reveal alm-previous-post post-'. $previous_post_id .'" data-url="'. $previous_post_permanlink .'" data-title="'. get_the_title($previous_post_id) .'" data-id="'. $previous_post_id .'">'; // Set the post id .alm-reveal div
787
 
788
 
789
  /*
1
  <?php
2
  /**
3
+ * Ajax Load More Shortcode
4
  *
5
+ * Returns [ajax_load_more {params}] shortcode.
6
  *
7
  * @author Darren Cooney
8
  * @since 2.10.1
18
 
19
  static $counter = 0;
20
 
21
+
22
  /**
23
  * alm_render_shortcode
24
+ * Parse & render ALM shortcode.
 
25
  *
26
  * @since 2.10.1
27
  * @param $atts Shortcode attributes
39
  $slug = alm_get_page_slug($post);
40
 
41
  // Define Post ID
42
+ $post_id = alm_get_page_id($post);
 
43
 
44
  // Custom CSS for Layouts - Only run this once.
45
  if(has_action('alm_layouts_custom_css')){
296
  $preloaded = false;
297
  $seo = false;
298
  $paging = false;
 
299
  $comments = false;
300
  $acf = false;
301
  }
433
 
434
  }
435
 
436
+ elseif($acf && ($acf_field_type !== 'relationship')){ // Advanced Custom Fields
437
+
438
  if(has_action('alm_acf_installed') && $acf){
439
 
440
  /* alm_acf_preloaded
781
  $previous_post_permanlink = ($_SERVER["QUERY_STRING"]) ? get_permalink($previous_post_id) .'?'. $_SERVER["QUERY_STRING"] : get_permalink($previous_post_id);
782
 
783
  // Get previous post include, build output from the next post filter
784
+ $previous_post_output = '<div class="alm-reveal alm-previous-post post-'. $previous_post_id .'" data-url="'. $previous_post_permanlink .'" data-title="'. get_the_title($previous_post_id) .'" data-id="'. $previous_post_id .'" data-page="0">'; // Set the post id .alm-reveal div
785
 
786
 
787
  /*
core/functions.php CHANGED
@@ -488,7 +488,7 @@ function alm_get_page_slug($post){
488
  elseif(is_author()){
489
  $slug = get_the_author_meta('ID');
490
  }
491
- // Post Tupe Archive
492
  elseif(is_post_type_archive()){
493
  $slug = get_post_type();
494
  }
@@ -516,6 +516,67 @@ function alm_get_page_slug($post){
516
  }
517
 
518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
 
520
  /*
521
  * alm_get_startpage
488
  elseif(is_author()){
489
  $slug = get_the_author_meta('ID');
490
  }
491
+ // Post Type Archive
492
  elseif(is_post_type_archive()){
493
  $slug = get_post_type();
494
  }
516
  }
517
 
518
 
519
+ /*
520
+ * alm_get_page_id
521
+ * Get current page ID
522
+ *
523
+ * @return $post_id;
524
+ * @since 3.0.1
525
+ */
526
+ function alm_get_page_id($post){
527
+
528
+ $post_id = '';
529
+
530
+ if(!is_archive()){
531
+ // If not an archive page, set the post slug
532
+ if(is_front_page() || is_home()){
533
+ $post_id = '0';
534
+ }else{
535
+ // Search
536
+ if(is_search()){
537
+ $search_query = get_search_query();
538
+ if($search_query){
539
+ $post_id = "$search_query";
540
+ }
541
+ }else{
542
+ $post_id = $post->ID;
543
+ }
544
+ }
545
+ }else{
546
+ // Tax
547
+ if(is_tax() || is_tag() || is_category()){
548
+ $queried_object = get_queried_object();
549
+ $post_id = $queried_object->term_id;
550
+ }
551
+ // Author
552
+ elseif(is_author()){
553
+ $post_id = get_the_author_meta('ID');
554
+ }
555
+ // Post Type Archive
556
+ elseif(is_post_type_archive()){
557
+ $post_id = get_post_type();
558
+ }
559
+ elseif(is_date()){
560
+ // Is archive page
561
+ $archive_year = get_the_date('Y');
562
+ $archive_month = get_the_date('m');
563
+ $archive_day = get_the_date('d');
564
+ if(is_year()){
565
+ $post_id = $archive_year;
566
+ }
567
+ if(is_month()){
568
+ $post_id = $archive_year.'-'.$archive_month;
569
+ }
570
+ if(is_day()){
571
+ $post_id = $archive_year.'-'.$archive_month.'-'.$archive_day;
572
+ }
573
+ }
574
+ }
575
+
576
+ return $post_id;
577
+ }
578
+
579
+
580
 
581
  /*
582
  * alm_get_startpage
core/js/ajax-load-more.js CHANGED
@@ -10,17 +10,17 @@
10
  * Author: Darren Cooney
11
  * Twitter: @KaptonKaos
12
  */
13
-
14
- (function ($) {
15
- "use strict";
16
-
17
  $.ajaxloadmore = function (el, e) {
18
-
19
  //Prevent loading of unnessasry posts - move user to top of page
20
  if(alm_localize.scrolltop === 'true'){
21
- $(window).scrollTop(0);
22
  }
23
-
24
  //Set variables
25
  var alm = this;
26
  alm.AjaxLoadMore = {};
@@ -34,7 +34,6 @@
34
  alm.finished = false;
35
  alm.window = $(window);
36
  alm.button_label = '';
37
- alm.data;
38
  alm.el = el;
39
  alm.container = el;
40
  alm.container.addClass('alm-'+e).attr('data-alm-id', e); // Add unique classname and data id
@@ -45,106 +44,106 @@
45
  alm.slug = alm.el.attr('data-slug');
46
  alm.post_id = alm.el.attr('data-post-id');
47
  alm.prefix = 'alm-';
48
-
49
- alm.cache = alm.content.attr('data-cache'); // Cache add-on
50
- alm.cache_id = alm.content.attr('data-cache-id'); // cache value
51
- alm.cache_path = alm.content.attr('data-cache-path'); // cache path
52
- alm.cache_logged_in = alm.content.attr('data-cache-logged-in'); // cache logged in (settings)
53
-
54
- alm.repeater = alm.content.attr('data-repeater'); // Repeaters
55
  alm.theme_repeater = alm.content.attr('data-theme-repeater');
56
-
57
  alm.scroll_distance = parseInt(alm.content.attr('data-scroll-distance'));
58
  alm.max_pages = parseInt(alm.content.attr('data-max-pages'));
59
- alm.pause_override = alm.content.attr('data-pause-override'); // true | false
60
- alm.pause = alm.content.attr('data-pause'); // true | false
61
- alm.transition = alm.content.attr('data-transition');
62
  alm.transition_container = alm.content.attr('data-transition-container');
63
  alm.speed = alm.content.attr('data-transition-speed');
64
  alm.images_loaded = alm.content.attr('data-images-loaded');
65
  alm.destroy_after = alm.content.attr('data-destroy-after');
66
  alm.lang = alm.content.attr('data-lang');
67
  alm.orginal_posts_per_page = alm.content.attr('data-posts-per-page'); // Used for paging add-on
68
- alm.posts_per_page = alm.content.attr('data-posts-per-page');
69
-
70
  alm.cta_array = '';
71
- alm.cta = alm.content.attr('data-cta'); // CTA add-on
72
  alm.cta_position = alm.content.attr('data-cta-position');
73
  alm.cta_repeater = alm.content.attr('data-cta-repeater');
74
  alm.cta_theme_repeater = alm.content.attr('data-cta-theme-repeater');
75
-
76
  alm.acf_array = '';
77
- alm.acf = alm.content.attr('data-acf'); // ACF add-on
78
- alm.acf_field_type = alm.content.attr('data-acf-field-type'); // Field Type
79
- alm.acf_field_name = alm.content.attr('data-acf-field-name'); // Field Name
80
- alm.acf_post_id = alm.content.attr('data-acf-post-id'); // Get the Post ID
81
-
82
  alm.nextpage_array = '';
83
- alm.nextpage = alm.content.attr('data-nextpage'); // Nextpage add-on
84
  alm.nextpage_urls = alm.content.attr('data-nextpage-urls'); // Update url
85
- alm.nextpage_scroll = alm.content.attr('data-nextpage-scroll'); // Scroll
86
- alm.nextpage_pageviews = alm.content.attr('data-nextpage-pageviews'); // pageviews
87
- alm.nextpage_post_id = alm.content.attr('data-nextpage-post-id'); // Get the nextpage id
88
- alm.nextpage_startpage = alm.content.attr('data-nextpage-startpage'); // nextpage startpage
89
-
90
- alm.previous_post = alm.content.attr('data-previous-post'); // Previous Post add-on
91
- alm.previous_post_id = alm.content.attr('data-previous-post-id'); // Get the post id
92
- alm.previous_post_taxonomy = alm.content.attr('data-previous-post-taxonomy'); // Get the post taxonomy
93
-
94
- alm.comments = alm.content.attr('data-comments'); // true | false
95
  if(alm.comments === 'true'){ // if comments, then set alm.content to comments wrap
96
  alm.content = $('.alm-comments', alm.container);
97
  }
98
  alm.comments_array = '';
99
- alm.comments_post_id = alm.content.attr('data-comments_post_id'); // current post id
100
- alm.comments_per_page = alm.content.attr('data-comments_per_page');
101
- alm.comments_type = alm.content.attr('data-comments_type');
102
- alm.comments_style = alm.content.attr('data-comments_style');
103
- alm.comments_template = alm.content.attr('data-comments_template');
104
- alm.comments_callback = alm.content.attr('data-comments_callback');
105
-
106
  alm.restapi = alm.content.attr('data-restapi');
107
  alm.restapi_base_url = alm.content.attr('data-restapi-base-url');
108
  alm.restapi_namespace = alm.content.attr('data-restapi-namespace');
109
  alm.restapi_endpoint = alm.content.attr('data-restapi-endpoint');
110
  alm.restapi_template_id = alm.content.attr('data-restapi-template-id');
111
  alm.restapi_debug = alm.content.attr('data-restapi-debug');
112
-
113
- alm.seo = alm.content.attr('data-seo'); // true | false
114
-
115
- alm.preloaded = alm.content.attr('data-preloaded'); // true | false
116
- alm.preloaded_amount = alm.content.attr('data-preloaded-amount'); // 0
117
-
118
- alm.paging = alm.content.attr('data-paging'); // is paging enabled
119
  alm.paging_controls = alm.content.attr('data-paging-controls');
120
  alm.paging_show_at_most = alm.content.attr('data-paging-show-at-most');
121
- alm.paging_classes = alm.content.attr('data-paging-classes');
122
- alm.paging_init = true;
123
-
124
-
125
  /* REST API */
126
  if(alm.restapi === 'true'){
127
- alm.restapi = true;
128
-
129
  if(alm.restapi_debug === undefined){
130
  alm.restapi_debug = false;
131
- }
132
  if(alm.restapi_template_id === ''){
133
  alm.restapi = false;
134
  }
135
-
136
  }else{
137
  alm.restapi = false;
138
  }
139
  /* End REST API */
140
-
141
-
142
  /* Paging */
143
  if(alm.paging === 'true'){
144
- alm.paging = true;
145
  if(alm.paging_show_at_most === undefined){
146
  alm.paging_show_at_most = 7;
147
- }
148
  // if paging and preload then pause.
149
  if(alm.preloaded === 'true'){
150
  alm.pause = true;
@@ -152,34 +151,34 @@
152
  }else{
153
  alm.paging = false;
154
  }
155
-
156
-
157
  if(alm.paging_controls === 'true'){
158
- alm.paging_controls = true;
159
  }else{
160
  alm.paging_controls = false;
161
- }
162
  /* End Paging */
163
-
164
-
165
  /* Cache */
166
  if (alm.cache === undefined){
167
  alm.cache = false;
168
  }
169
-
170
  if (alm.cache_logged_in === undefined){
171
- alm.cache_logged_in = false;
172
  }
173
  /* End Cache */
174
-
175
-
176
  /* Comments */
177
  if (alm.comments_per_page === undefined){
178
  alm.comments_per_page = '5';
179
  }
180
  /* End Comments */
181
-
182
-
183
  /* Preloaded */
184
  /* If posts_per_page <= preloaded_total_posts disable ajax load more */
185
  if (alm.preloaded === 'true'){
@@ -195,132 +194,133 @@
195
  alm.preloaded = 'false';
196
  }
197
  /* End Preloaded */
198
-
199
-
200
- /* SEO */
201
  if (alm.seo === undefined){
202
- alm.seo = false;
203
  }
204
  if (alm.seo === 'true'){
205
- alm.seo = true; // Convert string to boolean
206
- }
207
  if (alm.is_search === undefined){
208
- alm.is_search = false;
209
  }
210
  alm.search_value = (alm.is_search === 'true') ? alm.slug : ''; // Convert to value of slug for appending to seo url
211
-
212
  alm.permalink = alm.content.attr('data-seo-permalink');
213
  alm.pageview = alm.content.attr('data-seo-pageview');
214
  alm.start_page = alm.content.attr('data-seo-start-page');
215
-
216
- if(alm.start_page){
217
-
218
  alm.seo_scroll = alm.content.attr('data-seo-scroll');
219
  alm.seo_scroll_speed = alm.content.attr('data-seo-scroll-speed');
220
  alm.seo_scrolltop = alm.content.attr('data-seo-scrolltop');
221
-
222
- alm.isPaged = false;
223
-
224
  if (alm.start_page > 1) {
225
- alm.isPaged = true; // Is this a $paged page > 1 ?
226
- alm.posts_per_page = alm.start_page * alm.posts_per_page;
227
  }
228
  // If paging is enabled, reset our posts_per_page
229
  if(alm.paging){
230
- alm.posts_per_page = alm.orginal_posts_per_page;
231
- }
232
-
233
  }else{
234
- alm.start_page = 1;
235
  }
236
- /* End SEO */
237
-
238
-
239
- /* Nextpage */
240
-
241
  if (alm.nextpage === 'true'){
242
- alm.nextpage = true;
243
- alm.posts_per_page = 1;
244
  }else{
245
  alm.nextpage = false;
246
- }
247
  if (alm.nextpage_urls === undefined){
248
- alm.nextpage = 'true';
249
- }
250
  if (alm.nextpage_scroll === undefined){
251
- alm.nextpage_scroll = '250:30';
252
- }
253
  if (alm.nextpage_pageviews === undefined){
254
- alm.nextpage_pageviews = 'true';
255
- }
256
  if (alm.nextpage_post_id === undefined){
257
  alm.nextpage = false;
258
- alm.nextpage_post_id = null;
259
- }
260
  if (alm.nextpage_startpage === undefined){
261
- alm.nextpage_startpage = 1;
262
- }
263
  if (alm.nextpage_startpage > 1) {
264
  alm.isPaged = true;
265
  }
266
-
267
- /* End Nextpage */
268
-
269
-
270
- /* Advanced Custom Fields */
271
-
272
  if (alm.acf === 'true'){
273
- alm.acf = true;
274
  }else{
275
  alm.acf = false;
276
  }
277
  if (alm.acf_field_type === undefined || alm.acf_field_name === undefined || alm.acf_post_id === undefined){
278
- alm.acf = false;
279
- }
280
-
281
- /* End Advanced Custom Fields */
282
-
283
-
284
- /* Previous Post */
285
  if (alm.previous_post === 'true'){
286
- alm.previous_post = true;
287
  alm.previous_post_permalink = '';
288
- alm.previous_post_title = '';
 
289
  }else{
290
  alm.previous_post = false;
291
- }
292
  if (alm.previous_post_id === undefined){
293
- alm.previous_post_id = '';
294
- }
295
  if (alm.previous_post_taxonomy === undefined){
296
- alm.previous_post_taxonomy = '';
297
- }
298
  alm.previous_post_title_template = alm.content.attr('data-previous-post-title-template');
299
  alm.siteTitle = alm.content.attr('data-previous-post-site-title');
300
  alm.siteTagline = alm.content.attr('data-previous-post-site-tagline');
301
  alm.previous_post_pageview = alm.content.attr('data-previous-post-pageview');
302
  alm.previous_post_scroll = alm.content.attr('data-previous-post-scroll');
303
  alm.previous_post_scroll_speed = alm.content.attr('data-previous-post-scroll-speed');
304
- alm.previous_post_scroll_top = alm.content.attr('data-previous-post-scrolltop');
305
  /* End Previous Post */
306
-
307
 
308
  /* Define offset */
309
  if (alm.content.attr('data-offset') === undefined){
310
  alm.offset = 0;
311
  }else{
312
  alm.offset = alm.content.attr('data-offset');
313
- }
314
-
315
  /* Check for pause on init
316
  * Pause could be used to hold the loading of posts for a button click.
317
  */
318
  if (alm.pause === undefined || (alm.seo && alm.start_page > 1)){// SEO only
319
- alm.pause = false;
320
- }
321
  if (alm.preloaded === 'true' && alm.seo && alm.start_page > 0){ // SEO + Preloaded
322
  alm.pause = false;
323
- }
324
  if(alm.preloaded === 'true' && alm.paging){
325
  alm.pause = true;
326
  }
@@ -333,78 +333,74 @@
333
  if (alm.theme_repeater === undefined){
334
  alm.theme_repeater = 'null';
335
  }
336
-
337
 
338
  /* Max number of pages to load while scrolling */
339
  if (alm.max_pages === undefined){
340
  alm.max_pages = 0;
341
- }
342
  if (alm.max_pages === 0){
343
  alm.max_pages = 10000;
344
  }
345
-
346
-
347
  /* Scroll Distance */
348
  if (alm.scroll_distance === undefined){
349
  alm.scroll_distance = 150;
350
  }
351
-
352
 
353
- /* Transition Params */
 
354
  if (alm.transition === undefined){
355
  alm.transition = 'slide';
356
- }else if (alm.transition === "fade"){
357
- alm.transition = 'fade';
358
- }else if (alm.transition === "none"){
359
- alm.transition = 'none';
360
- }else {
361
- alm.transition = 'slide';
362
- }
363
-
364
  if (alm.speed === undefined){
365
  alm.speed = 250;
366
  } else{
367
  alm.speed = parseInt(alm.speed);
368
  }
369
-
 
370
  if (alm.transition_container === undefined || alm.transition_container === 'true'){
371
  alm.transition_container = true;
372
  }else {
373
  alm.transition_container = false;
374
  }
375
-
376
 
377
- /* Images Loaded */
 
378
  if (alm.images_loaded === undefined){
379
  alm.images_loaded = 'false';
380
  }
381
-
382
 
383
- /* Destroy After */
 
384
  if (alm.destroy_after !== undefined) {}
385
-
386
 
387
  /* Button Labels */
388
  if (alm.content.attr('data-button-label') === undefined){
389
  alm.button_label = 'Older Posts';
390
  }else{
391
  alm.button_label = alm.content.attr('data-button-label');
392
- }
393
-
394
-
395
  alm.button_loading_label = alm.content.attr('data-button-loading-label');
396
  if (alm.button_loading_label === undefined){
397
  alm.button_loading_label = false;
398
  }
399
-
400
-
401
- /* Button Class */
402
  if (alm.content.attr('data-button-class') === undefined){
403
  alm.button_class = '';
404
  }else{
405
  alm.button_class = ' ' + alm.content.attr('data-button-class');
406
  }
407
-
408
 
409
  /* Define scroll event */
410
  if (alm.content.attr('data-scroll') === undefined){
@@ -414,29 +410,29 @@
414
  }else{
415
  alm.scroll = true;
416
  }
417
-
418
 
419
- /* Parse multiple Post Types */
 
420
  alm.post_type = alm.content.attr('data-post-type');
421
  alm.post_type = alm.post_type.split(",");
422
-
423
-
424
  /* Sticky Posts */
425
  alm.sticky_posts = alm.content.attr('data-sticky-posts');
426
-
427
 
428
  /* Append 'load More' button to .ajax-load-more-wrap */
429
  alm.container.append('<div class="' + alm.prefix + 'btn-wrap"/>');
430
  alm.btnWrap = $('.' + alm.prefix + 'btn-wrap', alm.container);
431
-
432
- if(alm.paging){
433
-
434
- // Paging add-on
435
  alm.content.parent().addClass('loading'); // add loading class to main container
436
-
437
- }else{
438
-
439
- // If paging is false
440
  $('.'+ alm.prefix + 'btn-wrap', alm.container).append('<button id="load-more" class="' + alm.prefix + 'load-more-btn more'+ alm.button_class +'">' + alm.button_label + '</button>');
441
  alm.button = $('.alm-load-more-btn', alm.container);
442
  }
@@ -444,92 +440,97 @@
444
 
445
 
446
  /* loadPosts()
447
- *
448
  * The function to get posts via Ajax
449
  * @since 2.0.0
450
  */
451
-
452
- alm.AjaxLoadMore.loadPosts = function () {
453
  if(!alm.disable_ajax){ // Check for ajax blocker
454
  if(!alm.paging){
455
  alm.button.addClass('loading');
456
- alm.container.addClass('alm-loading');
457
  if(alm.button_loading_label !== false){
458
  alm.button.text(alm.button_loading_label);
459
  }
460
  }
461
- alm.loading = true;
462
-
463
  // If cache = true && cache_logged_in setting is false
464
  if(alm.cache === 'true' && !alm.cache_logged_in){
465
-
466
  var cache_page;
467
-
468
- if(alm.init && alm.seo && alm.isPaged){
469
  // SEO Add-on
470
  // If the request a paged URL (/page/3/)
471
- var firstpage = '1';
472
- cache_page = alm.cache_path + '/page-' + firstpage +'-'+ alm.start_page +'.html';
473
- }
474
-
475
  else if(alm.nextpage){
476
  // Nextpage add-on
477
  var nextpage_cache_page;
478
- if(alm.paging){
479
  nextpage_cache_page = parseInt(alm.page) + 1;
480
  }else{
481
  nextpage_cache_page = parseInt(alm.page) + 2;
482
  if(alm.isPaged){
483
- // If the request a paged URL (/page/3/)
484
  nextpage_cache_page = parseInt(alm.page) + parseInt(alm.nextpage_startpage) + 1;
485
  }
486
  }
487
- cache_page = alm.cache_path + '/page' +'-'+ nextpage_cache_page +'.html';
 
 
 
 
 
488
  }
489
-
490
- else {
491
- // Standard ALM URL request
492
- cache_page = alm.cache_path + '/page-' + (alm.page + 1) +'.html';
493
  }
494
-
495
- $.get(cache_page, function( data ) {
496
- alm.AjaxLoadMore.success(data, true); // data contains whatever the request has returned
497
- }).fail(function() {
498
- alm.AjaxLoadMore.ajax('standard');
499
  });
500
-
501
  } else { // Standard ALM query
502
-
503
  alm.AjaxLoadMore.ajax('standard');
504
-
505
  }
506
  }
507
-
508
  };
509
-
510
-
511
-
512
  /* ajax()
513
- *
514
  * Ajax Load Moe Ajax function
515
  *
516
  * @param queryType The type of Ajax request (standard/totalposts)
517
  * @since 2.6.0
518
  */
519
-
520
  alm.AjaxLoadMore.ajax = function (queryType) {
521
-
522
  // Default action
523
  var action = 'alm_query_posts';
524
-
525
-
526
  // ACF Params
527
- if(alm.acf){
528
-
529
- // Custom query for the repeater field
530
- if(alm.acf_field_type === 'repeater'){
531
  action = 'alm_acf_query';
532
- }
533
  alm.acf_array = {
534
  'acf' : 'true',
535
  'post_id' : alm.acf_post_id,
@@ -537,10 +538,10 @@
537
  'field_name' : alm.acf_field_name
538
  };
539
  }
540
-
541
-
542
  // Nextpage Params
543
- if(alm.nextpage){
544
  action = 'alm_nextpage_query';
545
  alm.nextpage_array = {
546
  'nextpage' : 'true',
@@ -551,19 +552,22 @@
551
  'startpage' : alm.nextpage_startpage
552
  };
553
  }
554
-
555
-
556
  // Previous Post Params
557
  if(alm.previous_post){
558
- alm.previous_post_id = alm.content.attr('data-previous-post-id');
559
- alm.previous_post_taxonomy = alm.content.attr('data-previous-post-taxonomy');
 
 
 
560
  }
561
-
562
-
563
- // Comment query
564
  if(alm.comments === 'true'){
565
  action = 'alm_comments_query';
566
- alm.posts_per_page = alm.comments_per_page;
567
  alm.comments_array = {
568
  'comments': 'true',
569
  'post_id': alm.comments_post_id,
@@ -572,21 +576,21 @@
572
  'style': alm.comments_style,
573
  'template': alm.comments_template,
574
  'callback': alm.comments_callback,
575
- };
576
  }
577
-
578
-
579
- // CTA Add-on Query params
580
- if(alm.cta === 'true'){
581
- alm.cta_array = {
582
  'cta': 'true',
583
  'cta_position': alm.cta_position,
584
  'cta_repeater': alm.cta_repeater,
585
  'cta_theme_repeater': alm.cta_theme_repeater,
586
- };
587
  }
588
-
589
-
590
  // REST API
591
  if(alm.restapi){
592
  var alm_template = wp.template(alm.restapi_template_id),
@@ -597,7 +601,7 @@
597
  offset : alm.offset,
598
  slug : alm.slug,
599
  canonical_url : alm.canonical_url,
600
- post_type : alm.post_type,
601
  post_format : alm.content.attr('data-post-format'),
602
  category : alm.content.attr('data-category'),
603
  category__not_in : alm.content.attr('data-category-not-in'),
@@ -610,7 +614,7 @@
610
  meta_key : alm.content.attr('data-meta-key'),
611
  meta_value : alm.content.attr('data-meta-value'),
612
  meta_compare : alm.content.attr('data-meta-compare'),
613
- meta_relation : alm.content.attr('data-meta-relation'),
614
  meta_type : alm.content.attr('data-meta-type'),
615
  author : alm.content.attr('data-author'),
616
  year : alm.content.attr('data-year'),
@@ -628,54 +632,54 @@
628
  preloaded_amount : alm.preloaded_amount,
629
  seo_start_page : alm.start_page,
630
  id : el.attr('data-id')
631
- };
632
-
633
- $.ajax({
634
  type : "GET",
635
  url : rest_url,
636
- data: rest_data,
637
- dataType: "JSON",
638
  beforeSend: function () {
639
  if (alm.page != 1 && !alm.paging) {
640
  alm.button.addClass('loading');
641
  }
642
- },
643
- success: function (results) {
644
  var data,
645
  html = results.html,
646
  meta = results.meta,
647
  postcount = meta.postcount,
648
  totalposts = meta.totalposts;
649
-
650
  // loop results to get data from each
651
- $.each(html, function(e){
652
- var result = html[e];
653
  if(alm.restapi_debug === 'true'){ // If debug
654
  console.log(result);
655
- }
656
- data += alm_template(result);
657
- });
658
-
659
  // Create object to pass to success()
660
  var obj = {
661
- 'html' : data,
662
  'meta' : {
663
  'postcount' : postcount,
664
  'totalposts' : totalposts
665
  },
666
- }
667
- alm.AjaxLoadMore.success(obj, false); // Send data
668
- }
669
- });
670
  }
671
-
672
  // Standard ALM
673
  else {
674
  $.ajax({
675
  type: "GET",
676
  url: alm_localize.ajaxurl,
677
  dataType: "JSON",
678
- data: {
679
  action : action,
680
  query_type : queryType,
681
  nonce : alm_localize.alm_nonce,
@@ -687,7 +691,7 @@
687
  cta : alm.cta_array,
688
  comments : alm.comments_array,
689
  post_type : alm.post_type,
690
- sticky_posts : alm.sticky_posts,
691
  post_format : alm.content.attr('data-post-format'),
692
  category : alm.content.attr('data-category'),
693
  category__not_in : alm.content.attr('data-category-not-in'),
@@ -700,7 +704,7 @@
700
  meta_key : alm.content.attr('data-meta-key'),
701
  meta_value : alm.content.attr('data-meta-value'),
702
  meta_compare : alm.content.attr('data-meta-compare'),
703
- meta_relation : alm.content.attr('data-meta-relation'),
704
  meta_type : alm.content.attr('data-meta-type'),
705
  author : alm.content.attr('data-author'),
706
  year : alm.content.attr('data-year'),
@@ -721,21 +725,19 @@
721
  preloaded_amount : alm.preloaded_amount,
722
  seo_start_page : alm.start_page,
723
  paging : alm.paging,
724
- previous_post : alm.previous_post,
725
- previous_post_id : alm.previous_post_id,
726
- previous_post_taxonomy: alm.previous_post_taxonomy,
727
  lang : alm.lang,
728
  slug : alm.slug,
729
  canonical_url : alm.canonical_url,
730
  id : el.attr('data-id')
731
  },
732
-
733
  beforeSend: function () {
734
  if (alm.page != 1 && !alm.paging) {
735
  alm.button.addClass('loading');
736
  }
737
  },
738
-
739
  success: function (data) {
740
  //console.log(data);
741
  if(queryType === 'standard'){
@@ -743,188 +745,188 @@
743
  }
744
  else if(queryType === 'totalpages' && alm.paging && alm.nextpage){
745
  // Next Page and Paging
746
- if($.isFunction($.fn.almBuildPagination)){
747
  $.fn.almBuildPagination(data, alm);
748
- }
749
  }
750
- else if(queryType === 'totalposts' && alm.paging){
751
- // Paging
752
- if($.isFunction($.fn.almBuildPagination)){
753
  $.fn.almBuildPagination(data, alm);
754
  }
755
- }
756
-
757
  },
758
-
759
  error: function (jqXHR, textStatus, errorThrown) {
760
  alm.AjaxLoadMore.error(jqXHR, textStatus, errorThrown);
761
  }
762
-
763
  });
764
- }
765
- };
766
-
767
-
768
-
769
  // If pagination enabled, run totalposts query
770
- if(alm.paging){
771
- if(alm.nextpage){
772
- alm.AjaxLoadMore.ajax('totalpages'); // Create paging menu and query for total pages
773
- } else {
774
- alm.AjaxLoadMore.ajax('totalposts'); // Create paging menu and query for total posts
775
- }
776
  }
777
-
778
-
779
-
780
  /* success()
781
- *
782
  * Success function after loading data
783
  *
784
  * @param data The results of the Ajax request
785
  * @param is_cache Are results of the Ajax request coming from cache
786
  * @since 2.6.0
787
  */
788
-
789
- alm.AjaxLoadMore.success = function (data, is_cache) {
790
-
791
- if(alm.previous_post){ // Get previous page data
792
- alm.AjaxLoadMore.getPreviousPost();
793
- }
794
-
795
- var html, meta, total;
796
-
797
- if(is_cache){
798
  // If content is cached don't look for json data - we won't be querying the DB.
799
- html = data;
800
- }else{
801
- // Standard ALM query results
802
  html = data.html;
803
  meta = data.meta;
804
- alm.posts = alm.posts + meta.postcount;
805
- total = meta.postcount;
806
  alm.totalposts = meta.totalposts;
807
  if(alm.preloaded === 'true'){
808
  alm.totalposts = alm.totalposts - alm.preloaded_amount;
809
- }
810
  }
811
-
812
- alm.data = $(html); // data converted to an object
813
-
814
  if(is_cache){ // If cache, get the length of the data object
815
- total = alm.data.length;
816
  }
817
-
818
  // First Run
819
- if (alm.init) {
820
-
821
- if(!alm.paging){
822
- alm.button.text(alm.button_label);
823
- } else {
824
  // Is pagination
825
- if (total > 0) {
826
  alm.el = $('<div class="alm-reveal"/>');
827
  alm.el.append('<div class="alm-paging-content"></div><div class="alm-paging-loading"></div>');
828
  $('.alm-paging-content', alm.el).append(alm.data).hide();
829
- alm.content.append(alm.el);
830
- alm.content.parent().removeClass('loading'); // Remove loading class from main container
831
  alm.AjaxLoadMore.resetBtnText();
832
-
833
- $('.alm-paging-content', alm.el).fadeIn( alm.speed, 'alm_easeInOutQuad', function(){
834
  var paddingT = parseInt(alm.content.css('padding-top')),
835
- paddingB = parseInt(alm.content.css('padding-bottom'));
836
  alm.content.css('height', alm.el.height() + paddingT + paddingB + 'px');
837
  if ($.isFunction($.fn.almFadePageControls)){
838
- $.fn.almFadePageControls(alm.btnWrap);
839
  }
840
  });
841
- }
842
  }
843
-
844
  // ALM Empty
845
  if(total === 0){
846
  if ($.isFunction($.fn.almEmpty)) {
847
  $.fn.almEmpty(alm);
848
  }
849
  }
850
-
851
  // isPaged
852
- if(alm.isPaged){
853
  alm.posts_per_page = alm.content.attr('data-posts-per-page'); // Reset our posts per page variable
854
  alm.page = alm.start_page - 1; // Set our new page #
855
- }
856
-
857
- }
858
-
859
-
860
  if (total > 0) {
861
-
862
  // Results!
863
  if(!alm.paging){
864
-
865
- if(alm.previous_post){ // If Previous Post, create container and append data
866
-
867
- alm.el = $('<div class="alm-reveal alm-previous-post post-'+alm.previous_post_id+'" data-id="'+alm.previous_post_id+'" data-title="'+alm.previous_post_title+'" data-url="'+alm.previous_post_permalink+'"/>');
868
- alm.el.append(alm.data).hide();
869
-
870
  } else {
871
-
872
- if(!alm.transition_container){
873
  // No transiton container
874
-
875
  alm.data.hide();
876
  alm.el = alm.data;
877
-
878
- } else {
879
  // Standard container
880
-
881
  // SEO
882
  if (alm.init && alm.start_page > 1){
883
  // loop through items and break into separate alm-reveal divs for paging
884
-
885
  var data = [],
886
  posts_per_page = parseInt(alm.posts_per_page);
887
-
888
  if(alm.cta === 'true'){
889
  // If CTA, +1 to posts_per_page to offset the CTA template and correct the display
890
- posts_per_page = posts_per_page + 1;
891
- }
892
-
893
  var pages = Math.ceil(total/posts_per_page); // slice data array into pages
894
  for (var i = 0; i < total; i += posts_per_page) {
895
  data.push(alm.data.slice(i, posts_per_page + i));
896
- }
897
-
898
  alm.el = alm.content; // Set alm.el to be alm-listing div
899
  for (var k = 0; k < data.length; k++){
900
-
901
  var p = 0; // Add 1 page if items are preloaded.
902
  if(alm.preloaded === 'true'){
903
  p = 1;
904
  }
905
-
906
  var div;
907
- if(k > 0 || alm.preloaded === 'true'){ // > Paged
908
  var pagenum = (k + 1 + p);
909
  if(alm.permalink === 'default'){
910
- div = $('<div class="alm-reveal alm-seo" data-url="'+alm.canonical_url+''+ alm.search_value +'&paged='+ pagenum+'" data-page="'+ pagenum +'" />');
911
  }else{
912
  div = $('<div class="alm-reveal alm-seo" data-url="'+alm.canonical_url+'page/'+ pagenum +'/'+ alm.search_value +'" data-page="'+ pagenum +'" />');
913
- }
914
  }else{ // First Page
915
  div = $('<div class="alm-reveal alm-seo" data-url="'+alm.canonical_url+''+ alm.search_value +'" data-page="1" />');
916
  }
917
  div.append(data[k]);
918
  div = $(div); // convert to object
919
  alm.el.append(div).hide(); // Add data to .alm-listing wrapper
920
- }
921
  }
922
  // End SEO -- /
923
-
924
  else {
925
  // If is SEO and paged, or preloaded.
926
  if(alm.seo && alm.page > 0 || alm.preloaded === 'true'){
927
-
928
  var p = 0; // Add 1 page if items are preloaded.
929
  if(alm.preloaded === 'true'){
930
  p = 1;
@@ -933,33 +935,33 @@
933
  var pagenum = (alm.page + 1 + p);
934
  if(alm.seo){
935
  if(alm.permalink === 'default'){
936
- alm.el = $('<div class="alm-reveal alm-seo" data-url="'+alm.canonical_url+''+ alm.search_value +'&paged='+ pagenum+'" data-page="'+ pagenum +'" />');
937
  }else{
938
  alm.el = $('<div class="alm-reveal alm-seo" data-url="'+alm.canonical_url+'page/'+ pagenum +'/'+ alm.search_value +'" data-page="'+ pagenum +'" />');
939
- }
940
  }else{
941
  // Basic ALM
942
- alm.el = $('<div class="alm-reveal" />');
943
- }
944
-
945
- }else{
946
  if(alm.seo){
947
  // SEO [Page 1]
948
- alm.el = $('<div class="alm-reveal alm-seo" data-url="'+alm.canonical_url+''+ alm.search_value +'" data-page="1" />');
949
  }else{
950
  // Basic ALM
951
- alm.el = $('<div class="alm-reveal" />');
952
  }
953
- }
954
-
955
- alm.el.append(alm.data).hide();
956
  }
957
- }
958
  }
959
-
960
- // Append alm.el to ALM container
961
  alm.content.append(alm.el);
962
-
963
  // Transition
964
  if (alm.transition === 'fade') { // Fade
965
  if(alm.images_loaded === 'true'){
@@ -968,7 +970,7 @@
968
  alm.loading = false;
969
  if(!alm.paging){
970
  alm.button.delay(alm.speed).removeClass('loading');
971
- alm.container.delay(alm.speed).removeClass('alm-loading');
972
  alm.AjaxLoadMore.resetBtnText();
973
  }
974
  alm.AjaxLoadMore.triggerAddons(alm);
@@ -981,19 +983,19 @@
981
  alm.button.delay(alm.speed).removeClass('loading');
982
  alm.container.delay(alm.speed).removeClass('loading');
983
  alm.AjaxLoadMore.resetBtnText();
984
- }
985
  alm.AjaxLoadMore.triggerAddons(alm);
986
  });
987
  }
988
-
989
  }else if(alm.transition === 'none') { // None
990
  if(alm.images_loaded === 'true'){
991
  alm.el.almWaitForImages().done(function(){
992
- alm.el.show();
993
  alm.AjaxLoadMore.triggerAddons(alm);
994
  });
995
  }else{
996
- alm.el.show();
997
  alm.AjaxLoadMore.triggerAddons(alm);
998
  }
999
  alm.loading = false;
@@ -1001,8 +1003,8 @@
1001
  alm.button.delay(alm.speed).removeClass('loading');
1002
  alm.container.delay(alm.speed).removeClass('loading');
1003
  alm.AjaxLoadMore.resetBtnText();
1004
- }
1005
-
1006
  }else { // Slide
1007
  if(alm.images_loaded === 'true'){
1008
  alm.el.almWaitForImages().done(function(){
@@ -1012,7 +1014,7 @@
1012
  alm.button.delay(alm.speed).removeClass('loading');
1013
  alm.container.delay(alm.speed).removeClass('loading');
1014
  alm.AjaxLoadMore.resetBtnText();
1015
- }
1016
  alm.AjaxLoadMore.triggerAddons(alm);
1017
  });
1018
  });
@@ -1023,32 +1025,32 @@
1023
  alm.button.delay(alm.speed).removeClass('loading');
1024
  alm.container.delay(alm.speed).removeClass('loading');
1025
  alm.AjaxLoadMore.resetBtnText();
1026
- }
1027
  alm.AjaxLoadMore.triggerAddons(alm);
1028
  });
1029
  }
1030
  }
1031
  // End Transition
1032
-
1033
- } else {
1034
-
1035
- // Paging
1036
- if(!alm.init){
1037
  $('.alm-paging-content', alm.el).html('').append(alm.data).almWaitForImages().done(function(){ // Remove loading class and append data
1038
  $('.alm-paging-loading', alm.el).fadeOut(alm.speed); // Fade out loader
1039
  if ($.isFunction($.fn.almOnPagingComplete)){
1040
- $.fn.almOnPagingComplete(alm);
1041
- }
1042
  alm.AjaxLoadMore.triggerAddons(alm);
1043
  });
1044
  } else {
1045
  alm.AjaxLoadMore.triggerAddons(alm);
1046
- }
1047
  // End Paging
1048
-
1049
- }
1050
-
1051
-
1052
  // ALM Complete
1053
  if ($.isFunction($.fn.almComplete)) {
1054
  if(alm.images_loaded === 'true'){
@@ -1057,43 +1059,43 @@
1057
  });
1058
  }else{
1059
  $.fn.almComplete(alm);
1060
- }
1061
- }
1062
  // End ALM Complete
1063
-
1064
-
1065
  // ALM Done
1066
- if(!alm.cache){
1067
- // Not Cache & Previous Post
1068
- if(alm.posts >= alm.totalposts && !alm.previous_post){
1069
  alm.AjaxLoadMore.triggerDone();
1070
- }
1071
- }else{ // Cache
1072
  if(total < alm.posts_per_page){
1073
  alm.AjaxLoadMore.triggerDone();
1074
- }
1075
- }
1076
- // End ALM Done
1077
-
1078
-
1079
- } else {
1080
-
1081
- // No Results!
1082
  if(!alm.paging){
1083
  alm.button.delay(alm.speed).removeClass('loading').addClass('done');
1084
  alm.AjaxLoadMore.resetBtnText();
1085
- }
1086
  alm.AjaxLoadMore.triggerDone(); // ALM Done
1087
-
1088
  }
1089
-
1090
-
1091
  // Destroy After
1092
  if (alm.destroy_after !== undefined && alm.destroy_after !== '') {
1093
- var currentPage = alm.page + 1; // Add 1 because alm.page starts at 0
1094
  if(alm.preload){
1095
  currentPage++;
1096
- }
1097
  if(currentPage == alm.destroy_after){ // - Disable ALM is page = alm.destroy_after value
1098
  alm.disable_ajax = true;
1099
  if(!alm.paging){
@@ -1102,85 +1104,85 @@
1102
  }
1103
  }
1104
  // End Destroy After
1105
-
1106
- alm.init = false;
1107
-
1108
  };
1109
-
1110
-
1111
-
1112
  /* pagingPreloadedInit()
1113
- *
1114
  * First run for Paging + Preloaded add-ons
1115
  * Moves preloaded content into ajax container
1116
  *
1117
  * @param data The results of the Ajax request
1118
  * @since 2.11.3
1119
- */
1120
  alm.AjaxLoadMore.pagingPreloadedInit = function(data){
1121
-
1122
  alm.el = $('<div class="alm-reveal"/>');
1123
  alm.el.append('<div class="alm-paging-content">'+data+'</div><div class="alm-paging-loading"></div>');
1124
- alm.content.append(alm.el);
1125
- alm.content.parent().removeClass('loading'); // Remove loading class from main container
1126
  alm.AjaxLoadMore.resetBtnText();
1127
-
1128
  var paddingT = parseInt(alm.content.css('padding-top')),
1129
- paddingB = parseInt(alm.content.css('padding-bottom'));
1130
  alm.content.css('height', alm.el.height() + paddingT + paddingB + 'px');
1131
-
1132
  if ($.isFunction($.fn.almFadePageControls)){
1133
- $.fn.almFadePageControls(alm.btnWrap);
1134
  }
1135
  }
1136
-
1137
-
1138
-
1139
  /* pagingNextpageInit()
1140
- *
1141
  * First run for Paging + Next Page add-ons
1142
  * Moves .alm-nextpage content into ajax container
1143
  *
1144
  * @param data The results of the Ajax request
1145
  * @since 2.14.0
1146
- */
1147
  alm.AjaxLoadMore.pagingNextpageInit = function(data){
1148
  alm.el = $('<div class="alm-reveal alm-nextpage"/>');
1149
  alm.el.append('<div class="alm-paging-content">'+data+'</div><div class="alm-paging-loading"></div>');
1150
- alm.el.appendTo(alm.content);
1151
- alm.content.parent().removeClass('loading'); // Remove loading class from main container
1152
  alm.AjaxLoadMore.resetBtnText();
1153
-
1154
  var paddingT = parseInt(alm.content.css('padding-top')),
1155
- paddingB = parseInt(alm.content.css('padding-bottom'));
1156
  alm.content.css('height', alm.el.height() + paddingT + paddingB + 'px');
1157
-
1158
  if ($.isFunction($.fn.almSetNextPageVars)){
1159
  $.fn.almSetNextPageVars(alm); // Next Page Add-on
1160
  }
1161
-
1162
  // Delay the following to avoid positioning
1163
- setTimeout(function(){
1164
  if ($.isFunction($.fn.almFadePageControls)){
1165
- $.fn.almFadePageControls(alm.btnWrap); // Paging Add-on
1166
- }
1167
-
1168
- if ($.isFunction($.fn.almOnWindowResize)){
1169
  $.fn.almOnWindowResize(alm); // Paging Add-on
1170
- }
1171
  }, 200);
1172
  }
1173
-
1174
-
1175
-
1176
-
1177
  /* getPreviousPost()
1178
- *
1179
  * Get the previous post ID via ajax
1180
  * @since 2.7.4
1181
  */
1182
  alm.fetchingPreviousPost = false;
1183
-
1184
  alm.AjaxLoadMore.getPreviousPost = function () {
1185
  alm.fetchingPreviousPost = true;
1186
  $.ajax({
@@ -1193,48 +1195,51 @@
1193
  taxonomy: alm.previous_post_taxonomy
1194
  },
1195
  success: function (data) {
1196
- if(data.has_previous_post){
1197
  alm.content.attr('data-previous-post-id', data.prev_id); // update previous-post-id on ALM element
1198
- alm.previous_post_permalink = data.prev_permalink;
1199
- alm.previous_post_title = data.prev_title;
 
 
 
1200
  }else{
1201
  if(!data.has_previous_post){
1202
  alm.AjaxLoadMore.triggerDone();
1203
  }
1204
- }
1205
- if($.isFunction($.fn.almSetPreviousPost)){
1206
  $.fn.almSetPreviousPost(alm, data.current_id, data.permalink, data.title);
1207
- }
1208
  alm.fetchingPreviousPost = false;
1209
  },
1210
  error: function (jqXHR, textStatus, errorThrown) {
1211
  alm.AjaxLoadMore.error(jqXHR, textStatus, errorThrown);
1212
  alm.fetchingPreviousPost = false;
1213
  }
1214
-
1215
  });
1216
  };
1217
-
1218
-
1219
-
1220
  /* loadComplete()
1221
- *
1222
  * Fires various add-on functions (if available) after load complete.
1223
  * @since 2.14.0
1224
  */
1225
  alm.AjaxLoadMore.triggerAddons = function(alm){
1226
  if ($.isFunction($.fn.almSEO) && alm.seo) {
1227
  $.fn.almSEO(alm);
1228
- }
1229
  if($.isFunction($.fn.almSetNextPage)){
1230
  $.fn.almSetNextPage(alm);
1231
  }
1232
  };
1233
-
1234
-
1235
-
1236
  /* triggerDone()
1237
- *
1238
  * Fires the almDone() function (if available).
1239
  * @since 2.11.3
1240
  */
@@ -1246,37 +1251,37 @@
1246
  }
1247
  if ($.isFunction($.fn.almDone)) {
1248
  // Delay done until after animation
1249
- setTimeout(function(){
1250
- $.fn.almDone(alm)
1251
- }, alm.speed + 10);
1252
- }
1253
  };
1254
-
1255
-
1256
-
1257
  /* resetBtnText()
1258
- *
1259
  * Resets the loading button text after loading has completed
1260
  * @since 2.8.4
1261
  */
1262
  alm.AjaxLoadMore.resetBtnText = function(){
1263
-
1264
- if(alm.button_loading_label !== false){ // Reset button text
1265
  if(!alm.paging){
1266
- alm.button.text(alm.button_label);
1267
  }
1268
- }
1269
-
1270
  };
1271
-
1272
-
1273
-
1274
  /* error()
1275
- *
1276
  * Error function after failed data
1277
  * @since 2.6.0
1278
  */
1279
-
1280
  alm.AjaxLoadMore.error = function (jqXHR, textStatus, errorThrown) {
1281
  alm.loading = false;
1282
  if(!alm.paging){
@@ -1285,15 +1290,15 @@
1285
  }
1286
  console.log(errorThrown);
1287
  };
1288
-
1289
-
1290
 
1291
  /* Button onClick()
1292
- *
1293
  * Load more button click event
1294
  * @since 1.0.0
1295
  */
1296
-
1297
  if(!alm.paging && !alm.fetchingPreviousPost){
1298
  alm.button.on('click', function () {
1299
  if (alm.pause === 'true') {
@@ -1308,22 +1313,22 @@
1308
  }
1309
  });
1310
  }
1311
-
1312
-
1313
-
1314
  /* Window Resize
1315
- *
1316
  * Add resize function for Paging add-on only.
1317
  * @since 2.1.2
1318
  */
1319
  if(alm.paging){
1320
-
1321
  alm.window.bind('resizeEnd', function() {
1322
  if ($.isFunction($.fn.almOnWindowResize)){
1323
- $.fn.almOnWindowResize(alm);
1324
- }
1325
- });
1326
-
1327
  alm.window.resize(function() {
1328
  if(this.resizeTO){
1329
  clearTimeout(this.resizeTO);
@@ -1331,18 +1336,18 @@
1331
  this.resizeTO = setTimeout(function() {
1332
  $(this).trigger('resizeEnd');
1333
  }, 250);
1334
- });
1335
-
1336
  }
1337
 
1338
 
1339
 
1340
  /* alm.AjaxLoadMore.isVisible()
1341
- *
1342
  * Check to see if element is visible before loading posts
1343
  * @since 2.1.2
1344
  */
1345
-
1346
  alm.AjaxLoadMore.isVisible = function () {
1347
  alm.visible = false;
1348
  if (alm.el.is(":visible")) {
@@ -1350,40 +1355,40 @@
1350
  }
1351
  return alm.visible;
1352
  };
1353
-
1354
-
1355
 
1356
  /* Window scroll and touchmove events
1357
- *
1358
  * Load posts as user scrolls the page
1359
  * @since 1.0
1360
  */
1361
  if (alm.scroll && !alm.paging) {
1362
  alm.window.bind("scroll touchstart", function () {
1363
- if (alm.AjaxLoadMore.isVisible() && !alm.fetchingPreviousPost) {
1364
  var content_offset = alm.button.offset(),
1365
- top = Math.round(content_offset.top - (alm.window.height() - alm.scroll_distance));
1366
-
1367
- // If Pause && Pause Override
1368
- if(!alm.loading && !alm.finished && (alm.window.scrollTop() >= top) && alm.page < (alm.max_pages - 1) && alm.proceed && alm.pause === 'true' && alm.pause_override === 'true'){
1369
- alm.button.trigger('click');
1370
  }
1371
-
1372
- // Standard Scroll event
1373
- else{
1374
- if (!alm.loading && !alm.finished && (alm.window.scrollTop() >= top) && alm.page < (alm.max_pages - 1) && alm.proceed && alm.pause !== 'true') {
1375
  alm.page++;
1376
- alm.AjaxLoadMore.loadPosts();
1377
  }
1378
- }
1379
  }
1380
  });
1381
  }
1382
-
1383
-
1384
 
1385
  /* Init Ajax load More
1386
- *
1387
  * Load posts as user scrolls the page
1388
  * @since 2.0
1389
  */
@@ -1392,10 +1397,10 @@
1392
  if(alm.disable_ajax){
1393
  alm.finished = true;
1394
  alm.button.addClass('done');
1395
-
1396
  }else{
1397
  if (alm.pause === 'true') {
1398
- alm.button.text(alm.button_label);
1399
  alm.loading = false;
1400
  } else {
1401
  alm.AjaxLoadMore.loadPosts();
@@ -1412,7 +1417,7 @@
1412
  // triggerDone is total equals total-pages
1413
  var alm_nextpage_pages = $('.alm-nextpage').length,
1414
  alm_nextpage_total = $('.alm-nextpage').eq(0).data('total-pages');
1415
-
1416
  if(alm_nextpage_pages == alm_nextpage_total){
1417
  alm.AjaxLoadMore.triggerDone();
1418
  }
@@ -1420,84 +1425,84 @@
1420
  }
1421
  }
1422
  alm.AjaxLoadMore.init();
1423
-
1424
 
1425
 
1426
  //flag to prevent unnecessary loading of post on init. Hold for 3/10 of a second
1427
  setTimeout(function () {
1428
  alm.proceed = true;
1429
  }, 300);
1430
-
1431
-
1432
-
1433
  /* $.fn.almUpdateCurrentPage()
1434
- *
1435
  * Update current page - triggered from paging add-on
1436
  * @since 2.7.0
1437
  */
1438
-
1439
  $.fn.almUpdateCurrentPage = function(current, obj, alm){
1440
  alm.page = current;
1441
-
1442
  // Next Page add-on
1443
- if(alm.nextpage && !alm.paging){
1444
- alm.page = alm.page - 1; // Remove 1 from next page since it starts at 0
1445
  }
1446
-
1447
  var data = '';
1448
-
1449
  /*
1450
  Paging + Preloaded & Paging + Next Page
1451
  If is paging init and preloaded, grab preloaded data, and append it .alm-reveal
1452
  */
1453
-
1454
- if(alm.paging_init && alm.preloaded === 'true'){
1455
-
1456
- // Paging + Preloaded Firstrun
1457
  data = $('.alm-preloaded .alm-reveal', alm.el).html(); // Content of preloaded page
1458
  $('.alm-preloaded', alm.el).remove();
1459
- alm.preloaded_amount = 0; // Reset
1460
  //alm.AjaxLoadMore.success(data, true); // Skip post loading and go right to success() for display
1461
  alm.AjaxLoadMore.pagingPreloadedInit(data);
1462
  alm.paging_init = false;
1463
- alm.init = false;
1464
-
1465
  }
1466
- else if(alm.paging_init && alm.nextpage){
1467
-
1468
  // Paging + Next Page Firstrun
1469
  data = $('.alm-nextpage', alm.el).html();
1470
  $('.alm-nextpage', alm.el).remove();
1471
  alm.AjaxLoadMore.pagingNextpageInit(data);
1472
  alm.paging_init = false;
1473
  alm.init = false;
1474
-
1475
- }
1476
- else{
1477
-
1478
  // Standard Paging
1479
- alm.AjaxLoadMore.loadPosts();
1480
-
1481
  }
1482
- };
1483
-
1484
-
1485
-
1486
- /* $.fn.almGetParentContainer()
1487
- *
1488
  * return the parent ALM container
1489
  *
1490
  * @since 2.7.0
1491
  * @return element
1492
  */
1493
  $.fn.almGetParentContainer = function(){
1494
- return alm.el.closest('#ajax-load-more'); // Return the parent #ajax-load-more div
1495
  };
1496
-
1497
-
1498
-
1499
  /* $.fn.almGetObj()
1500
- *
1501
  * return the current ALM obj
1502
  *
1503
  * @since 2.7.0
@@ -1506,11 +1511,11 @@
1506
  $.fn.almGetObj = function(){
1507
  return alm; // Return the entire alm object
1508
  };
1509
-
1510
-
1511
-
1512
  /* $.fn.almTriggerClick()
1513
- *
1514
  * Trigger ajaxloadmore from any element on page
1515
  *
1516
  * @since 2.12.0
@@ -1519,7 +1524,7 @@
1519
  $.fn.almTriggerClick = function(){
1520
  alm.button.trigger('click');
1521
  };
1522
-
1523
 
1524
 
1525
  //Custom easing function
@@ -1527,28 +1532,29 @@
1527
  if ((t /= d / 2) < 1) { return c / 2 * t * t + b; }
1528
  return -c / 2 * ((--t) * (t - 2) - 1) + b;
1529
  };
1530
-
1531
  };
1532
 
1533
  // End $.ajaxloadmore
1534
-
1535
-
1536
-
 
1537
  /* $.fn.almFilter(type, speed, data)
1538
- *
1539
  * Filter Ajax Load More
1540
  * @type ('slide', 'fade', null);
1541
  * @speed '300';
1542
- * @data obj;
1543
  *
1544
  * @since 2.6.1
1545
  */
1546
  $.fn.almFilter = function (transition, speed, data) {
1547
-
1548
  if(data.target){
1549
  // if a target has been specified
1550
- $(".ajax-load-more-wrap[data-id='" + data.target + "']").each(function (e) {
1551
- var el = $(this);
1552
  $.fn.almFilterTransition(transition, speed, data, el);
1553
  });
1554
  } else {
@@ -1559,10 +1565,10 @@
1559
  });
1560
  }
1561
  };
1562
-
1563
-
1564
  /* $.fn.almFilterTransition(transition, speed, data, el)
1565
- *
1566
  * Transition Ajax Load More
1567
  *
1568
  * @since 2.13.1
@@ -1571,34 +1577,34 @@
1571
  if(transition === 'slide'){ // Slide transition
1572
  el.slideUp(speed, function(){
1573
  $('.alm-listing', el).html(''); // Clear listings
1574
- $('.alm-btn-wrap', el).remove(); // remove buttons
1575
- el.fadeIn(speed);
1576
-
1577
  $.fn.almSetFilters(el, data);
1578
-
1579
  });
1580
  }else if(transition === 'fade'){ // Fade transition
1581
  el.fadeOut(speed, function(){
1582
- $('.alm-listing', el).html(''); // Clear listings
1583
- $('.alm-btn-wrap', el).remove(); // remove buttons
1584
- el.fadeIn(speed);
1585
-
1586
  $.fn.almSetFilters(el, data);
1587
-
1588
  });
1589
  }else{
1590
  $('.alm-listing', el).html(''); // Clear listings
1591
- $('.alm-btn-wrap', el).remove(); // remove buttons
1592
- el.fadeIn(speed);
1593
-
1594
  $.fn.almSetFilters(el, data);
1595
-
1596
  }
1597
  };
1598
-
1599
-
1600
  /* $.fn.almSetFilters(el, data)
1601
- *
1602
  * Set filter parameters on .alm-listing element
1603
  *
1604
  * @since 2.6.1
@@ -1608,24 +1614,24 @@
1608
  key = key.replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1-$2'); // Convert camelCase data() object back to dash (-)
1609
  $('.alm-listing', el).attr('data-'+key, value);
1610
  });
1611
-
1612
  if ($.isFunction($.fn.almFilterComplete)){
1613
  $.fn.almFilterComplete();
1614
  }
1615
-
1616
  if(data.target){
1617
  // if a target has been specified
1618
- $(".ajax-load-more-wrap[data-id="+data.target+"]").ajaxloadmore(); // re-initiate Ajax Load More
1619
  } else {
1620
  // Target not specified
1621
- $(".ajax-load-more-wrap").ajaxloadmore(); // re-initiate Ajax Load More
1622
  }
1623
  };
1624
-
1625
-
1626
 
1627
  /* $.fn.ajaxloadmore()
1628
- *
1629
  * Initiate all instances of Ajax load More
1630
  * @since 2.1.2
1631
  */
@@ -1634,24 +1640,24 @@
1634
  $(this).data('alm', new $.ajaxloadmore($(this), e));
1635
  });
1636
  };
1637
-
1638
-
1639
 
1640
- /*
 
 
1641
  * Initiate Ajax load More if div is present on screen
1642
  * @since 2.1.2
1643
  */
1644
  if ($(".ajax-load-more-wrap").length){
1645
  $(".ajax-load-more-wrap").ajaxloadmore();
1646
  }
1647
-
1648
 
1649
  })(jQuery);
1650
 
1651
 
1652
 
1653
 
1654
- /*! almWaitForImages
1655
  jQuery Plugin
1656
  v2.0.2
1657
  Based on https://github.com/alexanderdickson/almWaitForImages
10
  * Author: Darren Cooney
11
  * Twitter: @KaptonKaos
12
  */
13
+
14
+ (function ($) {
15
+ "use strict";
16
+
17
  $.ajaxloadmore = function (el, e) {
18
+
19
  //Prevent loading of unnessasry posts - move user to top of page
20
  if(alm_localize.scrolltop === 'true'){
21
+ $(window).scrollTop(0);
22
  }
23
+
24
  //Set variables
25
  var alm = this;
26
  alm.AjaxLoadMore = {};
34
  alm.finished = false;
35
  alm.window = $(window);
36
  alm.button_label = '';
 
37
  alm.el = el;
38
  alm.container = el;
39
  alm.container.addClass('alm-'+e).attr('data-alm-id', e); // Add unique classname and data id
44
  alm.slug = alm.el.attr('data-slug');
45
  alm.post_id = alm.el.attr('data-post-id');
46
  alm.prefix = 'alm-';
47
+
48
+ alm.cache = alm.content.attr('data-cache'); // Cache add-on
49
+ alm.cache_id = alm.content.attr('data-cache-id'); // cache value
50
+ alm.cache_path = alm.content.attr('data-cache-path'); // cache path
51
+ alm.cache_logged_in = alm.content.attr('data-cache-logged-in'); // cache logged in (settings)
52
+
53
+ alm.repeater = alm.content.attr('data-repeater'); // Repeaters
54
  alm.theme_repeater = alm.content.attr('data-theme-repeater');
55
+
56
  alm.scroll_distance = parseInt(alm.content.attr('data-scroll-distance'));
57
  alm.max_pages = parseInt(alm.content.attr('data-max-pages'));
58
+ alm.pause_override = alm.content.attr('data-pause-override'); // true | false
59
+ alm.pause = alm.content.attr('data-pause'); // true | false
60
+ alm.transition = alm.content.attr('data-transition');
61
  alm.transition_container = alm.content.attr('data-transition-container');
62
  alm.speed = alm.content.attr('data-transition-speed');
63
  alm.images_loaded = alm.content.attr('data-images-loaded');
64
  alm.destroy_after = alm.content.attr('data-destroy-after');
65
  alm.lang = alm.content.attr('data-lang');
66
  alm.orginal_posts_per_page = alm.content.attr('data-posts-per-page'); // Used for paging add-on
67
+ alm.posts_per_page = alm.content.attr('data-posts-per-page');
68
+
69
  alm.cta_array = '';
70
+ alm.cta = alm.content.attr('data-cta'); // CTA add-on
71
  alm.cta_position = alm.content.attr('data-cta-position');
72
  alm.cta_repeater = alm.content.attr('data-cta-repeater');
73
  alm.cta_theme_repeater = alm.content.attr('data-cta-theme-repeater');
74
+
75
  alm.acf_array = '';
76
+ alm.acf = alm.content.attr('data-acf'); // ACF add-on
77
+ alm.acf_field_type = alm.content.attr('data-acf-field-type'); // Field Type
78
+ alm.acf_field_name = alm.content.attr('data-acf-field-name'); // Field Name
79
+ alm.acf_post_id = alm.content.attr('data-acf-post-id'); // Get the Post ID
80
+
81
  alm.nextpage_array = '';
82
+ alm.nextpage = alm.content.attr('data-nextpage'); // Nextpage add-on
83
  alm.nextpage_urls = alm.content.attr('data-nextpage-urls'); // Update url
84
+ alm.nextpage_scroll = alm.content.attr('data-nextpage-scroll'); // Scroll
85
+ alm.nextpage_pageviews = alm.content.attr('data-nextpage-pageviews'); // pageviews
86
+ alm.nextpage_post_id = alm.content.attr('data-nextpage-post-id'); // Get the nextpage id
87
+ alm.nextpage_startpage = alm.content.attr('data-nextpage-startpage'); // nextpage startpage
88
+
89
+ alm.previous_post = alm.content.attr('data-previous-post'); // Previous Post add-on
90
+ alm.previous_post_id = alm.content.attr('data-previous-post-id'); // Get the post id
91
+ alm.previous_post_taxonomy = alm.content.attr('data-previous-post-taxonomy'); // Get the post taxonomy
92
+
93
+ alm.comments = alm.content.attr('data-comments'); // true | false
94
  if(alm.comments === 'true'){ // if comments, then set alm.content to comments wrap
95
  alm.content = $('.alm-comments', alm.container);
96
  }
97
  alm.comments_array = '';
98
+ alm.comments_post_id = alm.content.attr('data-comments_post_id'); // current post id
99
+ alm.comments_per_page = alm.content.attr('data-comments_per_page');
100
+ alm.comments_type = alm.content.attr('data-comments_type');
101
+ alm.comments_style = alm.content.attr('data-comments_style');
102
+ alm.comments_template = alm.content.attr('data-comments_template');
103
+ alm.comments_callback = alm.content.attr('data-comments_callback');
104
+
105
  alm.restapi = alm.content.attr('data-restapi');
106
  alm.restapi_base_url = alm.content.attr('data-restapi-base-url');
107
  alm.restapi_namespace = alm.content.attr('data-restapi-namespace');
108
  alm.restapi_endpoint = alm.content.attr('data-restapi-endpoint');
109
  alm.restapi_template_id = alm.content.attr('data-restapi-template-id');
110
  alm.restapi_debug = alm.content.attr('data-restapi-debug');
111
+
112
+ alm.seo = alm.content.attr('data-seo'); // true | false
113
+
114
+ alm.preloaded = alm.content.attr('data-preloaded'); // true | false
115
+ alm.preloaded_amount = alm.content.attr('data-preloaded-amount'); // 0
116
+
117
+ alm.paging = alm.content.attr('data-paging'); // is paging enabled
118
  alm.paging_controls = alm.content.attr('data-paging-controls');
119
  alm.paging_show_at_most = alm.content.attr('data-paging-show-at-most');
120
+ alm.paging_classes = alm.content.attr('data-paging-classes');
121
+ alm.paging_init = true;
122
+
123
+
124
  /* REST API */
125
  if(alm.restapi === 'true'){
126
+ alm.restapi = true;
127
+
128
  if(alm.restapi_debug === undefined){
129
  alm.restapi_debug = false;
130
+ }
131
  if(alm.restapi_template_id === ''){
132
  alm.restapi = false;
133
  }
134
+
135
  }else{
136
  alm.restapi = false;
137
  }
138
  /* End REST API */
139
+
140
+
141
  /* Paging */
142
  if(alm.paging === 'true'){
143
+ alm.paging = true;
144
  if(alm.paging_show_at_most === undefined){
145
  alm.paging_show_at_most = 7;
146
+ }
147
  // if paging and preload then pause.
148
  if(alm.preloaded === 'true'){
149
  alm.pause = true;
151
  }else{
152
  alm.paging = false;
153
  }
154
+
155
+
156
  if(alm.paging_controls === 'true'){
157
+ alm.paging_controls = true;
158
  }else{
159
  alm.paging_controls = false;
160
+ }
161
  /* End Paging */
162
+
163
+
164
  /* Cache */
165
  if (alm.cache === undefined){
166
  alm.cache = false;
167
  }
168
+
169
  if (alm.cache_logged_in === undefined){
170
+ alm.cache_logged_in = false;
171
  }
172
  /* End Cache */
173
+
174
+
175
  /* Comments */
176
  if (alm.comments_per_page === undefined){
177
  alm.comments_per_page = '5';
178
  }
179
  /* End Comments */
180
+
181
+
182
  /* Preloaded */
183
  /* If posts_per_page <= preloaded_total_posts disable ajax load more */
184
  if (alm.preloaded === 'true'){
194
  alm.preloaded = 'false';
195
  }
196
  /* End Preloaded */
197
+
198
+
199
+ /* SEO */
200
  if (alm.seo === undefined){
201
+ alm.seo = false;
202
  }
203
  if (alm.seo === 'true'){
204
+ alm.seo = true; // Convert string to boolean
205
+ }
206
  if (alm.is_search === undefined){
207
+ alm.is_search = false;
208
  }
209
  alm.search_value = (alm.is_search === 'true') ? alm.slug : ''; // Convert to value of slug for appending to seo url
210
+
211
  alm.permalink = alm.content.attr('data-seo-permalink');
212
  alm.pageview = alm.content.attr('data-seo-pageview');
213
  alm.start_page = alm.content.attr('data-seo-start-page');
214
+
215
+ if(alm.start_page){
216
+
217
  alm.seo_scroll = alm.content.attr('data-seo-scroll');
218
  alm.seo_scroll_speed = alm.content.attr('data-seo-scroll-speed');
219
  alm.seo_scrolltop = alm.content.attr('data-seo-scrolltop');
220
+
221
+ alm.isPaged = false;
222
+
223
  if (alm.start_page > 1) {
224
+ alm.isPaged = true; // Is this a $paged page > 1 ?
225
+ alm.posts_per_page = alm.start_page * alm.posts_per_page;
226
  }
227
  // If paging is enabled, reset our posts_per_page
228
  if(alm.paging){
229
+ alm.posts_per_page = alm.orginal_posts_per_page;
230
+ }
231
+
232
  }else{
233
+ alm.start_page = 1;
234
  }
235
+ /* End SEO */
236
+
237
+
238
+ /* Nextpage */
239
+
240
  if (alm.nextpage === 'true'){
241
+ alm.nextpage = true;
242
+ alm.posts_per_page = 1;
243
  }else{
244
  alm.nextpage = false;
245
+ }
246
  if (alm.nextpage_urls === undefined){
247
+ alm.nextpage = 'true';
248
+ }
249
  if (alm.nextpage_scroll === undefined){
250
+ alm.nextpage_scroll = '250:30';
251
+ }
252
  if (alm.nextpage_pageviews === undefined){
253
+ alm.nextpage_pageviews = 'true';
254
+ }
255
  if (alm.nextpage_post_id === undefined){
256
  alm.nextpage = false;
257
+ alm.nextpage_post_id = null;
258
+ }
259
  if (alm.nextpage_startpage === undefined){
260
+ alm.nextpage_startpage = 1;
261
+ }
262
  if (alm.nextpage_startpage > 1) {
263
  alm.isPaged = true;
264
  }
265
+
266
+ /* End Nextpage */
267
+
268
+
269
+ /* Advanced Custom Fields */
270
+
271
  if (alm.acf === 'true'){
272
+ alm.acf = true;
273
  }else{
274
  alm.acf = false;
275
  }
276
  if (alm.acf_field_type === undefined || alm.acf_field_name === undefined || alm.acf_post_id === undefined){
277
+ alm.acf = false;
278
+ }
279
+
280
+ /* End Advanced Custom Fields */
281
+
282
+
283
+ /* Previous Post */
284
  if (alm.previous_post === 'true'){
285
+ alm.previous_post = true;
286
  alm.previous_post_permalink = '';
287
+ alm.previous_post_title = '';
288
+ alm.previous_post_slug = '';
289
  }else{
290
  alm.previous_post = false;
291
+ }
292
  if (alm.previous_post_id === undefined){
293
+ alm.previous_post_id = '';
294
+ }
295
  if (alm.previous_post_taxonomy === undefined){
296
+ alm.previous_post_taxonomy = '';
297
+ }
298
  alm.previous_post_title_template = alm.content.attr('data-previous-post-title-template');
299
  alm.siteTitle = alm.content.attr('data-previous-post-site-title');
300
  alm.siteTagline = alm.content.attr('data-previous-post-site-tagline');
301
  alm.previous_post_pageview = alm.content.attr('data-previous-post-pageview');
302
  alm.previous_post_scroll = alm.content.attr('data-previous-post-scroll');
303
  alm.previous_post_scroll_speed = alm.content.attr('data-previous-post-scroll-speed');
304
+ alm.previous_post_scroll_top = alm.content.attr('data-previous-post-scrolltop');
305
  /* End Previous Post */
306
+
307
 
308
  /* Define offset */
309
  if (alm.content.attr('data-offset') === undefined){
310
  alm.offset = 0;
311
  }else{
312
  alm.offset = alm.content.attr('data-offset');
313
+ }
314
+
315
  /* Check for pause on init
316
  * Pause could be used to hold the loading of posts for a button click.
317
  */
318
  if (alm.pause === undefined || (alm.seo && alm.start_page > 1)){// SEO only
319
+ alm.pause = false;
320
+ }
321
  if (alm.preloaded === 'true' && alm.seo && alm.start_page > 0){ // SEO + Preloaded
322
  alm.pause = false;
323
+ }
324
  if(alm.preloaded === 'true' && alm.paging){
325
  alm.pause = true;
326
  }
333
  if (alm.theme_repeater === undefined){
334
  alm.theme_repeater = 'null';
335
  }
336
+
337
 
338
  /* Max number of pages to load while scrolling */
339
  if (alm.max_pages === undefined){
340
  alm.max_pages = 0;
341
+ }
342
  if (alm.max_pages === 0){
343
  alm.max_pages = 10000;
344
  }
345
+
346
+
347
  /* Scroll Distance */
348
  if (alm.scroll_distance === undefined){
349
  alm.scroll_distance = 150;
350
  }
 
351
 
352
+
353
+ /* Transition Params */
354
  if (alm.transition === undefined){
355
  alm.transition = 'slide';
356
+ }
357
+
358
+ /* Speed */
 
 
 
 
 
359
  if (alm.speed === undefined){
360
  alm.speed = 250;
361
  } else{
362
  alm.speed = parseInt(alm.speed);
363
  }
364
+
365
+ /* Transition Container */
366
  if (alm.transition_container === undefined || alm.transition_container === 'true'){
367
  alm.transition_container = true;
368
  }else {
369
  alm.transition_container = false;
370
  }
 
371
 
372
+
373
+ /* Images Loaded */
374
  if (alm.images_loaded === undefined){
375
  alm.images_loaded = 'false';
376
  }
 
377
 
378
+
379
+ /* Destroy After */
380
  if (alm.destroy_after !== undefined) {}
381
+
382
 
383
  /* Button Labels */
384
  if (alm.content.attr('data-button-label') === undefined){
385
  alm.button_label = 'Older Posts';
386
  }else{
387
  alm.button_label = alm.content.attr('data-button-label');
388
+ }
389
+
390
+
391
  alm.button_loading_label = alm.content.attr('data-button-loading-label');
392
  if (alm.button_loading_label === undefined){
393
  alm.button_loading_label = false;
394
  }
395
+
396
+
397
+ /* Button Class */
398
  if (alm.content.attr('data-button-class') === undefined){
399
  alm.button_class = '';
400
  }else{
401
  alm.button_class = ' ' + alm.content.attr('data-button-class');
402
  }
403
+
404
 
405
  /* Define scroll event */
406
  if (alm.content.attr('data-scroll') === undefined){
410
  }else{
411
  alm.scroll = true;
412
  }
 
413
 
414
+
415
+ /* Parse multiple Post Types */
416
  alm.post_type = alm.content.attr('data-post-type');
417
  alm.post_type = alm.post_type.split(",");
418
+
419
+
420
  /* Sticky Posts */
421
  alm.sticky_posts = alm.content.attr('data-sticky-posts');
422
+
423
 
424
  /* Append 'load More' button to .ajax-load-more-wrap */
425
  alm.container.append('<div class="' + alm.prefix + 'btn-wrap"/>');
426
  alm.btnWrap = $('.' + alm.prefix + 'btn-wrap', alm.container);
427
+
428
+ if(alm.paging){
429
+
430
+ // Paging add-on
431
  alm.content.parent().addClass('loading'); // add loading class to main container
432
+
433
+ }else{
434
+
435
+ // If paging is false
436
  $('.'+ alm.prefix + 'btn-wrap', alm.container).append('<button id="load-more" class="' + alm.prefix + 'load-more-btn more'+ alm.button_class +'">' + alm.button_label + '</button>');
437
  alm.button = $('.alm-load-more-btn', alm.container);
438
  }
440
 
441
 
442
  /* loadPosts()
443
+ *
444
  * The function to get posts via Ajax
445
  * @since 2.0.0
446
  */
447
+
448
+ alm.AjaxLoadMore.loadPosts = function () {
449
  if(!alm.disable_ajax){ // Check for ajax blocker
450
  if(!alm.paging){
451
  alm.button.addClass('loading');
452
+ alm.container.addClass('alm-loading');
453
  if(alm.button_loading_label !== false){
454
  alm.button.text(alm.button_loading_label);
455
  }
456
  }
457
+ alm.loading = true;
458
+
459
  // If cache = true && cache_logged_in setting is false
460
  if(alm.cache === 'true' && !alm.cache_logged_in){
461
+
462
  var cache_page;
463
+
464
+ if(alm.init && alm.seo && alm.isPaged){
465
  // SEO Add-on
466
  // If the request a paged URL (/page/3/)
467
+ var firstpage = '1';
468
+ cache_page = alm.cache_path + alm.cache_id + '/page-' + firstpage +'-'+ alm.start_page +'.html';
469
+ }
470
+
471
  else if(alm.nextpage){
472
  // Nextpage add-on
473
  var nextpage_cache_page;
474
+ if(alm.paging){
475
  nextpage_cache_page = parseInt(alm.page) + 1;
476
  }else{
477
  nextpage_cache_page = parseInt(alm.page) + 2;
478
  if(alm.isPaged){
479
+ // If the request a paged URL (/page/3/)
480
  nextpage_cache_page = parseInt(alm.page) + parseInt(alm.nextpage_startpage) + 1;
481
  }
482
  }
483
+ cache_page = alm.cache_path + alm.cache_id + '/page' +'-'+ nextpage_cache_page +'.html';
484
+ }
485
+
486
+ else if(alm.previous_post){
487
+ // Previous Post
488
+ cache_page = alm.cache_path + alm.cache_id + '/' + alm.previous_post_slug +'.html';
489
  }
490
+
491
+ else {
492
+ // Standard ALM URL request
493
+ cache_page = alm.cache_path + alm.cache_id + '/page-' + (alm.page + 1) +'.html';
494
  }
495
+
496
+