WordPress Infinite Scroll – Ajax Load More - Version 2.6.1

Version Description

  • NEW - Public function, almFilter(type, speed, data) function which will allow for filtering/resetting of a ajax load more object.
  • NEW - Callback function, almFilterComplete() function which is dispatched after a successful almFilter() event.
  • NEW - Adding 'post__in' parameter. You can now curate queries based on a comma separated list of post ids.
  • UPDATE - Updating data() variables in ajax-load-more.js to allow for manipulation via JS.
  • FIX - Fix for cache parameter always true in ajax-load-more.js.
Download this release

Release Info

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

Code changes from version 2.6.0 to 2.6.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://connekthq.com/donate/
4
  Tags: ajax, query, loop, paging, filter, infinite scroll, infinite, dynamic, jquery, shortcode builder, shortcode, search, tags, category, post types, taxonomy, meta_query, post format, wmpl, archives, date
5
  Requires at least: 3.6
6
  Tested up to: 4.1.1
7
- Stable tag: 2.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -50,10 +50,12 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
50
  * **meta_value** - Custom field value. Default = null
51
  * **meta_compare** - Operator to compare meta_key and meta_value against (IN/NOT IN/=/!=/>/>=/</<= etc.). Default = ‘IN’
52
  * **author** - Query by author id. Default = null
 
 
53
  * **search** - Query search term (‘s’). Default = null
 
54
  * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
55
  * **orderby** - Order posts by date, title, name, menu order, random, author, post ID or comment count. Default = ‘date’
56
- * **exclude** - Comma separated list of post ID’s to exclude from query. Default = null
57
  * **offset** - Offset the initial query (number). Default = ’0′
58
  * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
59
  * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
@@ -82,6 +84,7 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
82
  * **[Default](http://connekthq.com/plugins/ajax-load-more/)** - Out of the box functionality and styling
83
  * **[Destroy After](http://connekthq.com/plugins/ajax-load-more/examples/destroy-after/)** - Remove Ajax Load More functionality after 'n' number of pages
84
  * **[Fade Transition](http://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded
 
85
  * **[Mansory](http://connekthq.com/plugins/ajax-load-more/examples/masonry/)** - Creating a flexible grid layout with Masonry JS
86
  * **[Multiple Instances](http://connekthq.com/plugins/ajax-load-more/examples/multiple-instances/)** - Include multiple Ajax Load More' on a single page
87
  * **[Pause Loading](http://connekthq.com/plugins/ajax-load-more/examples/pause-loading/)** - Posts will not load until initiated by the user
@@ -117,22 +120,28 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
117
  ***
118
 
119
  = Callback Functions =
120
- The following functions are avaialble to be dispatched by Ajax Load More.
 
121
 
122
 
123
  **Ajax Complete** - The almComplete() function is triggered after every *successful* ajax call made by Ajax Load More.
124
- To utilize the almComplete() function simply place the following code inside your sites javascript file.
125
 
126
  $.fn.almComplete = function(alm){
127
  // Your on complete code goes here
128
- }
129
 
130
- **Ajax Empty** - The almEmpty() function is triggered if there are zero results returned in the initial query.
131
- To utilize the almEmpty() function simply place the following code inside your sites javascript file.
132
 
133
  $.fn.almEmpty = function(alm){
134
  console.log('Sorry, but we could not locate any posts that matched your criteria.');
135
- }
 
 
 
 
 
 
 
136
 
137
  ***
138
 
@@ -243,6 +252,13 @@ How to install Ajax Load More.
243
  == Changelog ==
244
 
245
 
 
 
 
 
 
 
 
246
  = 2.6.0 =
247
  * NEW - Adding scroll_distance parameter - easily adjust the distance from the bottom of the page that will trigger loading of posts.
248
  * NEW - Adding required functionality for Caching Add-on.
4
  Tags: ajax, query, loop, paging, filter, infinite scroll, infinite, dynamic, jquery, shortcode builder, shortcode, search, tags, category, post types, taxonomy, meta_query, post format, wmpl, archives, date
5
  Requires at least: 3.6
6
  Tested up to: 4.1.1
7
+ Stable tag: 2.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
50
  * **meta_value** - Custom field value. Default = null
51
  * **meta_compare** - Operator to compare meta_key and meta_value against (IN/NOT IN/=/!=/>/>=/</<= etc.). Default = ‘IN’
52
  * **author** - Query by author id. Default = null
53
+ * **post__in** - Comma separated list of post ID’s to include in query. Default = null
54
+ * **exclude** - Comma separated list of post ID’s to exclude from query. Default = null
55
  * **search** - Query search term (‘s’). Default = null
56
+ * **post_status** - Select status of the post. Default = 'publish'
57
  * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
58
  * **orderby** - Order posts by date, title, name, menu order, random, author, post ID or comment count. Default = ‘date’
 
59
  * **offset** - Offset the initial query (number). Default = ’0′
60
  * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
61
  * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
84
  * **[Default](http://connekthq.com/plugins/ajax-load-more/)** - Out of the box functionality and styling
85
  * **[Destroy After](http://connekthq.com/plugins/ajax-load-more/examples/destroy-after/)** - Remove Ajax Load More functionality after 'n' number of pages
86
  * **[Fade Transition](http://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded
87
+ * **[Filtering](http://connekthq.com/plugins/ajax-load-more/examples/filtering/)** - Reset and filter an Ajax Load More instance
88
  * **[Mansory](http://connekthq.com/plugins/ajax-load-more/examples/masonry/)** - Creating a flexible grid layout with Masonry JS
89
  * **[Multiple Instances](http://connekthq.com/plugins/ajax-load-more/examples/multiple-instances/)** - Include multiple Ajax Load More' on a single page
90
  * **[Pause Loading](http://connekthq.com/plugins/ajax-load-more/examples/pause-loading/)** - Posts will not load until initiated by the user
120
  ***
121
 
122
  = Callback Functions =
123
+ The following functions are available to be dispatched by Ajax Load More.
124
+ [Get More Information](https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/)
125
 
126
 
127
  **Ajax Complete** - The almComplete() function is triggered after every *successful* ajax call made by Ajax Load More.
 
128
 
129
  $.fn.almComplete = function(alm){
130
  // Your on complete code goes here
131
+ };
132
 
133
+ **ALM Empty** - The almEmpty() function is triggered if there are zero results returned in the initial query.
 
134
 
135
  $.fn.almEmpty = function(alm){
136
  console.log('Sorry, but we could not locate any posts that matched your criteria.');
137
+ };
138
+
139
+ ***
140
+ **ALM Filter Complete** - The almFilterComplete() function is triggered after a successful call to the public function almFilter().
141
+
142
+ $.fn.almFilterComplete = function(){
143
+ console.log('Ajax Load More filter has completed!');
144
+ };
145
 
146
  ***
147
 
252
  == Changelog ==
253
 
254
 
255
+ = 2.6.1 =
256
+ * NEW - Public function, almFilter(type, speed, data) function which will allow for filtering/resetting of a ajax load more object.
257
+ * NEW - Callback function, almFilterComplete() function which is dispatched after a successful almFilter() event.
258
+ * NEW - Adding 'post__in' parameter. You can now curate queries based on a comma separated list of post ids.
259
+ * UPDATE - Updating data() variables in ajax-load-more.js to allow for manipulation via JS.
260
+ * FIX - Fix for cache parameter always true in ajax-load-more.js.
261
+
262
  = 2.6.0 =
263
  * NEW - Adding scroll_distance parameter - easily adjust the distance from the bottom of the page that will trigger loading of posts.
264
  * NEW - Adding required functionality for Caching Add-on.
admin/admin.php CHANGED
@@ -77,8 +77,8 @@ function alm_core_update() {
77
  //Write to repeater file
78
  $data = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE name = 'default'");
79
  $f = ALM_PATH. 'core/repeater/default.php'; // File
80
- $o = fopen($f, 'w+'); //Open file
81
- $w = fwrite($o, $data); //Save the file
82
  $r = fread($o, 100000); //Read it
83
  fclose($o); //now close it
84
  }
77
  //Write to repeater file
78
  $data = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE name = 'default'");
79
  $f = ALM_PATH. 'core/repeater/default.php'; // File
80
+ $o = fopen($f, 'w+') or die(__('Unable to open the default repeater template.', ALM_NAME)); //Open file
81
+ $w = fwrite($o, $data) or die(__('Unable to save the default repeater.', ALM_NAME)); //Save the file
82
  $r = fread($o, 100000); //Read it
83
  fclose($o); //now close it
84
  }
admin/shortcode-builder/js/shortcode-builder.js CHANGED
@@ -240,6 +240,31 @@ jQuery(document).ready(function($) {
240
  output += ' author="'+author+'"';
241
 
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  // ---------------------------
244
  // - Search
245
  // ---------------------------
@@ -294,21 +319,6 @@ jQuery(document).ready(function($) {
294
  var post_status = $('select#post-status').val();
295
  if(post_status !== 'publish')
296
  output += ' post_status="'+post_status+'"';
297
-
298
-
299
- // ---------------------------
300
- // - Exclude posts
301
- // ---------------------------
302
-
303
- var exclude = $('.exclude input').val();
304
- exclude = $.trim(exclude);
305
- if(exclude !== ''){
306
- //Remove trailing comma, if present
307
- if(exclude.charAt( exclude.length-1 ) == ",") {
308
- exclude = exclude.slice(0, -1)
309
- }
310
- output += ' exclude="'+exclude+'"';
311
- }
312
 
313
 
314
  // ---------------------------
240
  output += ' author="'+author+'"';
241
 
242
 
243
+ // ---------------------------
244
+ // - Posts
245
+ // ---------------------------
246
+
247
+ var post__in = $('input#post__in').val();
248
+ post__in = $.trim(post__in);
249
+ if(post__in !== '')
250
+ output += ' post__in="'+post__in+'"';
251
+
252
+
253
+ // ---------------------------
254
+ // - Exclude posts
255
+ // ---------------------------
256
+
257
+ var exclude = $('input#exclude-posts').val();
258
+ exclude = $.trim(exclude);
259
+ if(exclude !== ''){
260
+ //Remove trailing comma, if present
261
+ if(exclude.charAt( exclude.length-1 ) == ",") {
262
+ exclude = exclude.slice(0, -1)
263
+ }
264
+ output += ' exclude="'+exclude+'"';
265
+ }
266
+
267
+
268
  // ---------------------------
269
  // - Search
270
  // ---------------------------
319
  var post_status = $('select#post-status').val();
320
  if(post_status !== 'publish')
321
  output += ' post_status="'+post_status+'"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
 
324
  // ---------------------------
admin/shortcode-builder/shortcode-builder.php CHANGED
@@ -481,7 +481,34 @@
481
  </div>
482
  </div>
483
  </div>
484
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
 
486
  <!-- Post Status -->
487
  <div class="row input post-status" id="alm-post-status">
@@ -537,21 +564,6 @@
537
  </div>
538
  </div>
539
 
540
- <!-- Exclude posts -->
541
- <div class="row input exclude" id="alm-exclude-posts">
542
- <h3 class="heading"><?php _e('Exclude', ALM_NAME); ?></h3>
543
- <div class="expand-wrap">
544
- <div class="section-title">
545
- <p><?php _e('A comma separated list of post ID\'s to exclude from query.', ALM_NAME); ?><br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-exclude">view example</a></p>
546
- </div>
547
- <div class="wrap">
548
- <div class="inner">
549
- <input class="alm_element" name="exclude-posts" type="text" id="exclude-posts" value="" placeholder="199, 216, 345, 565">
550
- </div>
551
- </div>
552
- </div>
553
- </div>
554
-
555
  <!-- Offset -->
556
  <div class="row input offset" id="alm-offset">
557
  <h3 class="heading"><?php _e('Offset', ALM_NAME); ?></h3>
481
  </div>
482
  </div>
483
  </div>
484
+ </div>
485
+
486
+ <!-- Post Parameters -->
487
+ <div class="row input post-in" id="alm-post-in">
488
+ <h3 class="heading"><?php _e('Post Parameters', ALM_NAME); ?></h3>
489
+ <div class="expand-wrap">
490
+ <div class="section-title">
491
+ <h4>Include</h4>
492
+ <p><?php _e('A comma separated list of post ID\'s to query.', ALM_NAME); ?></p>
493
+ </div>
494
+ <div class="wrap">
495
+ <div class="inner">
496
+ <input name="post__in" class="alm_element numbers-only" type="text" id="post__in" value="" placeholder="<?php _e('225, 340, 818, etc...', ALM_NAME); ?>">
497
+ </div>
498
+ </div>
499
+ <div class="clear"></div>
500
+ <hr/>
501
+ <div class="section-title">
502
+ <h4>Exclude</h4>
503
+ <p><?php _e('A comma separated list of post ID\'s to exclude from query.', ALM_NAME); ?><br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-exclude">view example</a></p>
504
+ </div>
505
+ <div class="wrap">
506
+ <div class="inner">
507
+ <input class="alm_element numbers-only" name="exclude-posts" type="text" id="exclude-posts" value="" placeholder="199, 216, 345, etc...">
508
+ </div>
509
+ </div>
510
+ </div>
511
+ </div>
512
 
513
  <!-- Post Status -->
514
  <div class="row input post-status" id="alm-post-status">
564
  </div>
565
  </div>
566
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  <!-- Offset -->
568
  <div class="row input offset" id="alm-offset">
569
  <h3 class="heading"><?php _e('Offset', ALM_NAME); ?></h3>
ajax-load-more.php CHANGED
@@ -6,13 +6,13 @@ Description: A simple solution for lazy loading WordPress posts and pages with A
6
  Author: Darren Cooney
7
  Twitter: @KaptonKaos
8
  Author URI: http://connekthq.com
9
- Version: 2.6.0
10
  License: GPL
11
  Copyright: Darren Cooney & Connekt Media
12
  */
13
 
14
- define('ALM_VERSION', '2.6.0');
15
- define('ALM_RELEASE', 'March 12, 2015');
16
 
17
  /*
18
  * alm_install
@@ -172,6 +172,7 @@ if( !class_exists('AjaxLoadMore') ):
172
  'post_status' => '',
173
  'order' => 'DESC',
174
  'orderby' => 'date',
 
175
  'exclude' => '',
176
  'offset' => '0',
177
  'posts_per_page' => '5',
@@ -248,6 +249,7 @@ if( !class_exists('AjaxLoadMore') ):
248
  'month' => $month,
249
  'day' => $day,
250
  'author' => $author,
 
251
  'search' => $search,
252
  'post_status' => $post_status,
253
  'order' => $order,
@@ -292,13 +294,15 @@ if( !class_exists('AjaxLoadMore') ):
292
 
293
  //Cache Add-on
294
  if(has_action('alm_cache_installed')){
295
- $ajaxloadmore .= ' data-cache="'.$cache.'"';
296
- $ajaxloadmore .= ' data-cache-id="'.$cache_id.'"';
297
- $ajaxloadmore .= ' data-cache-path="'.ALM_CACHE_URL.'/_cache/'.$cache_id.'"';
298
-
299
- // Check for known users
300
- if(isset($options['_alm_cache_known_users']) && $options['_alm_cache_known_users'] === '1' && is_user_logged_in())
301
- $ajaxloadmore .= ' data-cache-logged-in="true"';
 
 
302
  }
303
 
304
  // Preloaded Add-on
@@ -312,9 +316,9 @@ if( !class_exists('AjaxLoadMore') ):
312
  $ajaxloadmore .= ' data-post-type="'.$post_type.'"';
313
  $ajaxloadmore .= ' data-post-format="'.$post_format.'"';
314
  $ajaxloadmore .= ' data-category="'.$category.'"';
315
- $ajaxloadmore .= ' data-category__not_in="'.$category__not_in.'"';
316
  $ajaxloadmore .= ' data-tag="'.$tag.'"';
317
- $ajaxloadmore .= ' data-tag__not_in="'.$tag__not_in.'"';
318
  $ajaxloadmore .= ' data-taxonomy="'.$taxonomy.'"';
319
  $ajaxloadmore .= ' data-taxonomy-terms="'.$taxonomy_terms.'"';
320
  $ajaxloadmore .= ' data-taxonomy-operator="'.$taxonomy_operator.'"';
@@ -325,11 +329,12 @@ if( !class_exists('AjaxLoadMore') ):
325
  $ajaxloadmore .= ' data-month="'.$month.'"';
326
  $ajaxloadmore .= ' data-day="'.$day.'"';
327
  $ajaxloadmore .= ' data-author="'.$author.'"';
 
 
328
  $ajaxloadmore .= ' data-search="'.$search.'"';
329
  $ajaxloadmore .= ' data-post-status="'.$post_status.'"';
330
  $ajaxloadmore .= ' data-order="'.$order.'"';
331
  $ajaxloadmore .= ' data-orderby="'.$orderby.'"';
332
- $ajaxloadmore .= ' data-exclude="'.$exclude.'"';
333
  $ajaxloadmore .= ' data-offset="'.$offset.'"';
334
  $ajaxloadmore .= ' data-posts-per-page="'.$posts_per_page.'"';
335
  $ajaxloadmore .= ' data-lang="'.$lang.'"';
@@ -457,7 +462,8 @@ if( !class_exists('AjaxLoadMore') ):
457
  $order = (isset($_GET['order'])) ? $_GET['order'] : 'DESC';
458
  $orderby = (isset($_GET['orderby'])) ? $_GET['orderby'] : 'date';
459
 
460
- // Exclude, Offset, Status
 
461
  $exclude = (isset($_GET['exclude'])) ? $_GET['exclude'] : '';
462
  $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
463
  $post_status = $_GET['post_status'];
@@ -543,6 +549,18 @@ if( !class_exists('AjaxLoadMore') ):
543
  // Author
544
  if(!empty($author_id)){
545
  $args['author'] = $author_id;
 
 
 
 
 
 
 
 
 
 
 
 
546
  }
547
 
548
  // Search Term
@@ -553,13 +571,7 @@ if( !class_exists('AjaxLoadMore') ):
553
  // Meta_key, used for ordering by meta value
554
  if(!empty($meta_key)){
555
  $args['meta_key'] = $meta_key;
556
- }
557
-
558
- // Exclude posts
559
- if(!empty($exclude)){
560
- $exclude = explode(",",$exclude);
561
- $args['post__not_in'] = $exclude;
562
- }
563
 
564
  // Language
565
  if(!empty($lang)){
6
  Author: Darren Cooney
7
  Twitter: @KaptonKaos
8
  Author URI: http://connekthq.com
9
+ Version: 2.6.1
10
  License: GPL
11
  Copyright: Darren Cooney & Connekt Media
12
  */
13
 
14
+ define('ALM_VERSION', '2.6.1');
15
+ define('ALM_RELEASE', 'April 6, 2015');
16
 
17
  /*
18
  * alm_install
172
  'post_status' => '',
173
  'order' => 'DESC',
174
  'orderby' => 'date',
175
+ 'post__in' => '',
176
  'exclude' => '',
177
  'offset' => '0',
178
  'posts_per_page' => '5',
249
  'month' => $month,
250
  'day' => $day,
251
  'author' => $author,
252
+ 'post__in' => $post__in,
253
  'search' => $search,
254
  'post_status' => $post_status,
255
  'order' => $order,
294
 
295
  //Cache Add-on
296
  if(has_action('alm_cache_installed')){
297
+ if($cache === 'true'){
298
+ $ajaxloadmore .= ' data-cache="'.$cache.'"';
299
+ $ajaxloadmore .= ' data-cache-id="'.$cache_id.'"';
300
+ $ajaxloadmore .= ' data-cache-path="'.ALM_CACHE_URL.'/_cache/'.$cache_id.'"';
301
+
302
+ // Check for known users
303
+ if(isset($options['_alm_cache_known_users']) && $options['_alm_cache_known_users'] === '1' && is_user_logged_in())
304
+ $ajaxloadmore .= ' data-cache-logged-in="true"';
305
+ }
306
  }
307
 
308
  // Preloaded Add-on
316
  $ajaxloadmore .= ' data-post-type="'.$post_type.'"';
317
  $ajaxloadmore .= ' data-post-format="'.$post_format.'"';
318
  $ajaxloadmore .= ' data-category="'.$category.'"';
319
+ $ajaxloadmore .= ' data-category-not-in="'.$category__not_in.'"';
320
  $ajaxloadmore .= ' data-tag="'.$tag.'"';
321
+ $ajaxloadmore .= ' data-tag-not-in="'.$tag__not_in.'"';
322
  $ajaxloadmore .= ' data-taxonomy="'.$taxonomy.'"';
323
  $ajaxloadmore .= ' data-taxonomy-terms="'.$taxonomy_terms.'"';
324
  $ajaxloadmore .= ' data-taxonomy-operator="'.$taxonomy_operator.'"';
329
  $ajaxloadmore .= ' data-month="'.$month.'"';
330
  $ajaxloadmore .= ' data-day="'.$day.'"';
331
  $ajaxloadmore .= ' data-author="'.$author.'"';
332
+ $ajaxloadmore .= ' data-post-in="'.$post__in.'"';
333
+ $ajaxloadmore .= ' data-exclude="'.$exclude.'"';
334
  $ajaxloadmore .= ' data-search="'.$search.'"';
335
  $ajaxloadmore .= ' data-post-status="'.$post_status.'"';
336
  $ajaxloadmore .= ' data-order="'.$order.'"';
337
  $ajaxloadmore .= ' data-orderby="'.$orderby.'"';
 
338
  $ajaxloadmore .= ' data-offset="'.$offset.'"';
339
  $ajaxloadmore .= ' data-posts-per-page="'.$posts_per_page.'"';
340
  $ajaxloadmore .= ' data-lang="'.$lang.'"';
462
  $order = (isset($_GET['order'])) ? $_GET['order'] : 'DESC';
463
  $orderby = (isset($_GET['orderby'])) ? $_GET['orderby'] : 'date';
464
 
465
+ // Include, Exclude, Offset, Status
466
+ $post__in = (isset($_GET['post__in'])) ? $_GET['post__in'] : '';
467
  $exclude = (isset($_GET['exclude'])) ? $_GET['exclude'] : '';
468
  $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
469
  $post_status = $_GET['post_status'];
549
  // Author
550
  if(!empty($author_id)){
551
  $args['author'] = $author_id;
552
+ }
553
+
554
+ // Include posts
555
+ if(!empty($post__in)){
556
+ $post__in = explode(",",$post__in);
557
+ $args['post__in'] = $post__in;
558
+ }
559
+
560
+ // Exclude posts
561
+ if(!empty($exclude)){
562
+ $exclude = explode(",",$exclude);
563
+ $args['post__not_in'] = $exclude;
564
  }
565
 
566
  // Search Term
571
  // Meta_key, used for ordering by meta value
572
  if(!empty($meta_key)){
573
  $args['meta_key'] = $meta_key;
574
+ }
 
 
 
 
 
 
575
 
576
  // Language
577
  if(!empty($lang)){
core/css/ajax-load-more.css CHANGED
@@ -187,10 +187,8 @@ button.alm-load-more-btn{
187
  overflow: hidden;
188
  position: relative;
189
  list-style: none;
190
- }
191
- .alm-listing li.no-img{
192
- padding: 0;
193
- }
194
  .alm-listing li a{
195
  color: #34383D;
196
  }
@@ -207,4 +205,5 @@ button.alm-load-more-btn{
207
  -webkit-border-radius:3px;
208
  -moz-border-radius:3px;
209
  border-radius:3px;
210
- }
 
187
  overflow: hidden;
188
  position: relative;
189
  list-style: none;
190
+ }
191
+ .alm-listing li.no-img{ padding: 0; }
 
 
192
  .alm-listing li a{
193
  color: #34383D;
194
  }
205
  -webkit-border-radius:3px;
206
  -moz-border-radius:3px;
207
  border-radius:3px;
208
+ }
209
+
core/js/ajax-load-more.js CHANGED
@@ -1,7 +1,7 @@
1
  /*
2
- * WordPress Ajax Load More
3
  * http://wordpress.org/plugins/ajax-load-more/
4
- * https://github.com/dcooney/wordpress-ajax-load-more
5
  *
6
  * Copyright 2015 Connekt Media - http://connekthq.com
7
  * Free to use under the GPLv2 license.
@@ -14,7 +14,7 @@
14
  (function ($) {
15
  "use strict";
16
 
17
- // $(window).scrollTop(0); //Prevent loading of unnessasry posts - move user to top of page
18
 
19
  $.ajaxloadmore = function (el) {
20
 
@@ -34,34 +34,34 @@
34
  alm.el = el;
35
  alm.content = $('.alm-listing.alm-ajax', alm.el);
36
  alm.prefix = 'alm-';
37
- alm.cache = alm.content.data('cache'); // cache (true/false)
38
- alm.cache_id = alm.content.data('cache-id'); // cache value
39
- alm.cache_path = alm.content.data('cache-path'); // cache path
40
- alm.cache_logged_in = alm.content.data('cache-logged-in'); // cache logged in (settings)
41
- alm.repeater = alm.content.data('repeater');
42
- alm.scroll_distance = alm.content.data('scroll-distance');
43
- alm.max_pages = alm.content.data('max-pages');
44
- alm.pause = alm.content.data('pause'); // true | false
45
- alm.transition = alm.content.data('transition');
46
- alm.destroy_after = alm.content.data('destroy-after');
47
- alm.lang = alm.content.data('lang');
48
- alm.posts_per_page = alm.content.data('posts-per-page');
49
- alm.seo = alm.content.data('seo'); // true | false
50
- alm.preloaded = alm.content.data('preloaded'); // true | false
51
- alm.preloaded_amount = alm.content.data('preloaded-amount'); // 0 - ?
52
 
53
 
54
  /* Define offset */
55
- if (alm.content.data('offset') === undefined)
56
  alm.offset = 0;
57
  else
58
- alm.offset = alm.content.data('offset');
59
 
60
 
61
  /* Cache */
62
  if (alm.cache === undefined)
63
  alm.cache = false;
64
-
65
  if (alm.cache_logged_in === undefined)
66
  alm.cache_logged_in = false;
67
 
@@ -70,13 +70,14 @@
70
  * Check preloaded posts to ensure posts_per_page > alm.total_posts
71
  * - if posts_per_page <= total_posts disable ajax load more
72
  */
73
- if(alm.preloaded){
74
  alm.preload_wrap = alm.content.prev('.alm-preloaded');
75
- alm.total_posts = alm.preload_wrap.data('total-posts');
76
  if (alm.preloaded_amount === undefined)
77
  alm.preloaded_amount = false;
78
- if(alm.total_posts <= alm.preloaded_amount)
79
  alm.disable_ajax = true;
 
80
  }
81
 
82
 
@@ -84,14 +85,14 @@
84
  if (alm.seo === undefined)
85
  alm.seo = false;
86
 
87
- alm.permalink = alm.content.data('seo-permalink');
88
- alm.start_page = alm.content.data('seo-start-page');
89
 
90
  if(alm.start_page){
91
 
92
- alm.seo_scroll = alm.content.data('seo-scroll');
93
- alm.seo_scroll_speed = alm.content.data('seo-scroll-speed');
94
- alm.seo_scrolltop = alm.content.data('seo-scrolltop');
95
 
96
  alm.isPaged = false;
97
 
@@ -144,29 +145,29 @@
144
  if (alm.destroy_after !== undefined) {}
145
 
146
  // Button Label & classes */
147
- if (alm.content.data('button-label') === undefined)
148
  alm.button_label = 'Older Posts';
149
  else
150
- alm.button_label = alm.content.data('button-label');
151
 
152
 
153
- if (alm.content.data('button-class') === undefined)
154
  alm.button_class = '';
155
  else
156
- alm.button_class = ' ' + alm.content.data('button-class');
157
 
158
 
159
  /* Define on Scroll event */
160
- if (alm.content.data('scroll') === undefined)
161
  alm.scroll = true;
162
- else if (alm.content.data('scroll') === false)
163
  alm.scroll = false;
164
  else
165
  alm.scroll = true;
166
 
167
 
168
  /* Parse multiple Post Types */
169
- alm.post_type = alm.content.data('post-type');
170
  alm.post_type = alm.post_type.split(",");
171
 
172
  /* Append 'load More' button to .ajax-load-more-wrap */
@@ -187,7 +188,7 @@
187
  alm.button.addClass('loading');
188
  alm.loading = true;
189
 
190
- if(alm.cache && !alm.cache_logged_in){ // If cache = true
191
 
192
  var cachePage = alm.cache_path + '/page-' + alm.page +'.html';
193
  $.get(cachePage, function( data ) {
@@ -225,26 +226,27 @@
225
  cache_id: alm.cache_id,
226
  repeater: alm.repeater,
227
  postType: alm.post_type,
228
- post_format: alm.content.data('post-format'),
229
- category: alm.content.data('category'),
230
- category__not_in: alm.content.data('category__not_in'),
231
- tag: alm.content.data('tag'),
232
- tag__not_in: alm.content.data('tag__not_in'),
233
- taxonomy: alm.content.data('taxonomy'),
234
- taxonomy_terms: alm.content.data('taxonomy-terms'),
235
- taxonomy_operator: alm.content.data('taxonomy-operator'),
236
- meta_key: alm.content.data('meta-key'),
237
- meta_value: alm.content.data('meta-value'),
238
- meta_compare: alm.content.data('meta-compare'),
239
- author: alm.content.data('author'),
240
- year: alm.content.data('year'),
241
- month: alm.content.data('month'),
242
- day: alm.content.data('day'),
243
- post_status: alm.content.data('post-status'),
244
- order: alm.content.data('order'),
245
- orderby: alm.content.data('orderby'),
246
- search: alm.content.data('search'),
247
- exclude: alm.content.data('exclude'),
 
248
  posts_per_page: alm.posts_per_page,
249
  pageNumber: alm.page,
250
  offset: alm.offset,
@@ -290,7 +292,7 @@
290
  }
291
 
292
  if(alm.isPaged){
293
- alm.posts_per_page = alm.content.data('posts-per-page'); // Reset our posts per page variable
294
  alm.page = alm.start_page - 1; // Set our new page #
295
  }
296
  }
@@ -350,9 +352,10 @@
350
  // Destroy After param
351
  if (alm.destroy_after !== undefined && alm.destroy_after !== '') {
352
  var currentPage = alm.page + 1; // Add 1 because alm.page starts at 0
 
353
  if(alm.preload) currentPage++;
354
 
355
- if(currentPage === alm.destroy_after){ // - Disable ALM is page = alm.destroy_after value
356
  alm.disable_ajax = true;
357
  alm.button.delay(alm.speed).fadeOut(alm.speed);
358
  }
@@ -382,7 +385,7 @@
382
  */
383
 
384
  alm.button.on('click', function () {
385
- if (alm.pause === true) {
386
  alm.pause = false;
387
  alm.AjaxLoadMore.loadPosts();
388
  }
@@ -409,7 +412,7 @@
409
  return alm.visible;
410
  };
411
 
412
-
413
 
414
  /* Window scroll and touchmove events
415
  *
@@ -420,7 +423,7 @@
420
  alm.window.bind("scroll touchstart", function () {
421
  if (alm.AjaxLoadMore.isVisible()) {
422
  var content_offset = alm.button.offset();
423
- if (!alm.loading && !alm.finished && (alm.window.scrollTop() >= Math.round(content_offset.top - (alm.window.height() - alm.scroll_distance))) && alm.page < (alm.max_pages - 1) && alm.proceed && !alm.pause) {
424
  alm.page++;
425
  alm.AjaxLoadMore.loadPosts();
426
  }
@@ -439,7 +442,7 @@
439
  alm.finished = true;
440
  alm.button.addClass('done');
441
  }else{
442
- if (alm.pause === true) {
443
  alm.button.text(alm.button_label);
444
  alm.loading = false;
445
  } else {
@@ -464,6 +467,71 @@
464
  // End $.ajaxloadmore
465
 
466
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
 
468
  /* $.fn.ajaxloadmore()
469
  *
@@ -474,7 +542,9 @@
474
  return this.each(function () {
475
  $(this).data('alm', new $.ajaxloadmore($(this)));
476
  });
477
- }
 
 
478
 
479
  /*
480
  * Initiate Ajax load More if div is present on screen
1
  /*
2
+ * Ajax Load More
3
  * http://wordpress.org/plugins/ajax-load-more/
4
+ * https://github.com/dcooney/wordpress-ajax-load-more/
5
  *
6
  * Copyright 2015 Connekt Media - http://connekthq.com
7
  * Free to use under the GPLv2 license.
14
  (function ($) {
15
  "use strict";
16
 
17
+ $(window).scrollTop(0); //Prevent loading of unnessasry posts - move user to top of page
18
 
19
  $.ajaxloadmore = function (el) {
20
 
34
  alm.el = el;
35
  alm.content = $('.alm-listing.alm-ajax', alm.el);
36
  alm.prefix = 'alm-';
37
+ alm.cache = alm.content.attr('data-cache'); // cache (true/false)
38
+ alm.cache_id = alm.content.attr('data-cache-id'); // cache value
39
+ alm.cache_path = alm.content.attr('data-cache-path'); // cache path
40
+ alm.cache_logged_in = alm.content.attr('data-cache-logged-in'); // cache logged in (settings)
41
+ alm.repeater = alm.content.attr('data-repeater');
42
+ alm.scroll_distance = alm.content.attr('data-scroll-distance');
43
+ alm.max_pages = alm.content.attr('data-max-pages');
44
+ alm.pause = alm.content.attr('data-pause'); // true | false
45
+ alm.transition = alm.content.attr('data-transition');
46
+ alm.destroy_after = alm.content.attr('data-destroy-after');
47
+ alm.lang = alm.content.attr('data-lang');
48
+ alm.posts_per_page = alm.content.attr('data-posts-per-page');
49
+ alm.seo = alm.content.attr('data-seo'); // true | false
50
+ alm.preloaded = alm.content.attr('data-preloaded'); // true | false
51
+ alm.preloaded_amount = alm.content.attr('data-preloaded-amount'); // 0 - ?
52
 
53
 
54
  /* Define offset */
55
+ if (alm.content.attr('data-offset') === undefined)
56
  alm.offset = 0;
57
  else
58
+ alm.offset = alm.content.attr('data-offset');
59
 
60
 
61
  /* Cache */
62
  if (alm.cache === undefined)
63
  alm.cache = false;
64
+
65
  if (alm.cache_logged_in === undefined)
66
  alm.cache_logged_in = false;
67
 
70
  * Check preloaded posts to ensure posts_per_page > alm.total_posts
71
  * - if posts_per_page <= total_posts disable ajax load more
72
  */
73
+ if(alm.preloaded === 'true'){
74
  alm.preload_wrap = alm.content.prev('.alm-preloaded');
75
+ alm.total_posts = parseInt(alm.preload_wrap.attr('data-total-posts'));
76
  if (alm.preloaded_amount === undefined)
77
  alm.preloaded_amount = false;
78
+ if(alm.total_posts <= alm.preloaded_amount){
79
  alm.disable_ajax = true;
80
+ }
81
  }
82
 
83
 
85
  if (alm.seo === undefined)
86
  alm.seo = false;
87
 
88
+ alm.permalink = alm.content.attr('data-seo-permalink');
89
+ alm.start_page = alm.content.attr('data-seo-start-page');
90
 
91
  if(alm.start_page){
92
 
93
+ alm.seo_scroll = alm.content.attr('data-seo-scroll');
94
+ alm.seo_scroll_speed = alm.content.attr('data-seo-scroll-speed');
95
+ alm.seo_scrolltop = alm.content.attr('data-seo-scrolltop');
96
 
97
  alm.isPaged = false;
98
 
145
  if (alm.destroy_after !== undefined) {}
146
 
147
  // Button Label & classes */
148
+ if (alm.content.attr('data-button-label') === undefined)
149
  alm.button_label = 'Older Posts';
150
  else
151
+ alm.button_label = alm.content.attr('data-button-label');
152
 
153
 
154
+ if (alm.content.attr('data-button-class') === undefined)
155
  alm.button_class = '';
156
  else
157
+ alm.button_class = ' ' + alm.content.attr('data-button-class');
158
 
159
 
160
  /* Define on Scroll event */
161
+ if (alm.content.attr('data-scroll') === undefined)
162
  alm.scroll = true;
163
+ else if (alm.content.attr('data-scroll') === 'false')
164
  alm.scroll = false;
165
  else
166
  alm.scroll = true;
167
 
168
 
169
  /* Parse multiple Post Types */
170
+ alm.post_type = alm.content.attr('data-post-type');
171
  alm.post_type = alm.post_type.split(",");
172
 
173
  /* Append 'load More' button to .ajax-load-more-wrap */
188
  alm.button.addClass('loading');
189
  alm.loading = true;
190
 
191
+ if(alm.cache === 'true' && !alm.cache_logged_in){ // If cache = true
192
 
193
  var cachePage = alm.cache_path + '/page-' + alm.page +'.html';
194
  $.get(cachePage, function( data ) {
226
  cache_id: alm.cache_id,
227
  repeater: alm.repeater,
228
  postType: alm.post_type,
229
+ post_format: alm.content.attr('data-post-format'),
230
+ category: alm.content.attr('data-category'),
231
+ category__not_in: alm.content.attr('data-category-not-in'),
232
+ tag: alm.content.attr('data-tag'),
233
+ tag__not_in: alm.content.attr('data-tag-not-in'),
234
+ taxonomy: alm.content.attr('data-taxonomy'),
235
+ taxonomy_terms: alm.content.attr('data-taxonomy-terms'),
236
+ taxonomy_operator: alm.content.attr('data-taxonomy-operator'),
237
+ meta_key: alm.content.attr('data-meta-key'),
238
+ meta_value: alm.content.attr('data-meta-value'),
239
+ meta_compare: alm.content.attr('data-meta-compare'),
240
+ author: alm.content.attr('data-author'),
241
+ year: alm.content.attr('data-year'),
242
+ month: alm.content.attr('data-month'),
243
+ day: alm.content.attr('data-day'),
244
+ post_status: alm.content.attr('data-post-status'),
245
+ order: alm.content.attr('data-order'),
246
+ orderby: alm.content.attr('data-orderby'),
247
+ post__in: alm.content.attr('data-post-in'),
248
+ exclude: alm.content.attr('data-exclude'),
249
+ search: alm.content.attr('data-search'),
250
  posts_per_page: alm.posts_per_page,
251
  pageNumber: alm.page,
252
  offset: alm.offset,
292
  }
293
 
294
  if(alm.isPaged){
295
+ alm.posts_per_page = alm.content.attr('data-posts-per-page'); // Reset our posts per page variable
296
  alm.page = alm.start_page - 1; // Set our new page #
297
  }
298
  }
352
  // Destroy After param
353
  if (alm.destroy_after !== undefined && alm.destroy_after !== '') {
354
  var currentPage = alm.page + 1; // Add 1 because alm.page starts at 0
355
+
356
  if(alm.preload) currentPage++;
357
 
358
+ if(currentPage == alm.destroy_after){ // - Disable ALM is page = alm.destroy_after value
359
  alm.disable_ajax = true;
360
  alm.button.delay(alm.speed).fadeOut(alm.speed);
361
  }
385
  */
386
 
387
  alm.button.on('click', function () {
388
+ if (alm.pause === 'true') {
389
  alm.pause = false;
390
  alm.AjaxLoadMore.loadPosts();
391
  }
412
  return alm.visible;
413
  };
414
 
415
+
416
 
417
  /* Window scroll and touchmove events
418
  *
423
  alm.window.bind("scroll touchstart", function () {
424
  if (alm.AjaxLoadMore.isVisible()) {
425
  var content_offset = alm.button.offset();
426
+ if (!alm.loading && !alm.finished && (alm.window.scrollTop() >= Math.round(content_offset.top - (alm.window.height() - alm.scroll_distance))) && alm.page < (alm.max_pages - 1) && alm.proceed && alm.pause !== 'true') {
427
  alm.page++;
428
  alm.AjaxLoadMore.loadPosts();
429
  }
442
  alm.finished = true;
443
  alm.button.addClass('done');
444
  }else{
445
+ if (alm.pause === 'true') {
446
  alm.button.text(alm.button_label);
447
  alm.loading = false;
448
  } else {
467
  // End $.ajaxloadmore
468
 
469
 
470
+
471
+ /* $.fn.almFilter(type, speed, data)
472
+ *
473
+ * Filter Ajax Load More
474
+ * @type ('slide', 'fade', null);
475
+ * @speed '300';
476
+ * @data obj;
477
+ *
478
+ * @since 2.6.1
479
+ */
480
+ $.fn.almFilter = function (transition, speed, data) {
481
+
482
+ $(".ajax-load-more-wrap").each(function (e) {
483
+ var el = $(this);
484
+ if(transition === 'slide'){ // Slide transition
485
+ el.slideUp(speed, function(){
486
+ $('.alm-listing', el).html(''); // Clear listings
487
+ $('.alm-btn-wrap', el).remove(); // remove buttons
488
+ el.fadeIn(speed);
489
+
490
+ $.fn.almSetFilters(el, data);
491
+
492
+ });
493
+ }else if(transition === 'fade'){ // Fade transition
494
+ el.fadeOut(speed, function(){
495
+ $('.alm-listing', el).html(''); // Clear listings
496
+ $('.alm-btn-wrap', el).remove(); // remove buttons
497
+ el.fadeIn(speed);
498
+
499
+ $.fn.almSetFilters(el, data);
500
+
501
+ });
502
+ }else{
503
+ $('.alm-listing', el).html(''); // Clear listings
504
+ $('.alm-btn-wrap', el).remove(); // remove buttons
505
+ el.fadeIn(speed);
506
+
507
+ $.fn.almSetFilters(el, data);
508
+
509
+ }
510
+
511
+ });
512
+ };
513
+
514
+
515
+
516
+ /* $.fn.almSetFilters(el, data)
517
+ *
518
+ * Set filter parameters on .alm-listing element
519
+ *
520
+ * @since 2.6.1
521
+ */
522
+ $.fn.almSetFilters = function(el, data){
523
+ $.each(data, function(key, value) {
524
+ key = key.replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1-$2'); // Convert camelCase data() object back to dash (-)
525
+ $('.alm-listing', el).attr('data-'+key, value);
526
+ });
527
+
528
+ if ($.isFunction($.fn.almFilterComplete))
529
+ $.fn.almFilterComplete();
530
+
531
+ $(".ajax-load-more-wrap").ajaxloadmore(); // re-initiate Ajax Load More
532
+ };
533
+
534
+
535
 
536
  /* $.fn.ajaxloadmore()
537
  *
542
  return this.each(function () {
543
  $(this).data('alm', new $.ajaxloadmore($(this)));
544
  });
545
+ };
546
+
547
+
548
 
549
  /*
550
  * Initiate Ajax load More if div is present on screen
core/js/ajax-load-more.min.js CHANGED
@@ -11,15 +11,14 @@
11
  * Twitter: @KaptonKaos
12
  */
13
 
14
- (function($){"use strict";$.ajaxloadmore=function(el){var alm=this;alm.AjaxLoadMore={};alm.page=0;alm.speed=300;alm.proceed=false;alm.disable_ajax=false;alm.init=true;alm.loading=true;alm.finished=false;alm.window=$(window);alm.button_label='';alm.data;alm.el=el;alm.content=$('.alm-listing.alm-ajax',alm.el);alm.prefix='alm-';alm.cache=alm.content.data('cache');alm.cache_id=alm.content.data('cache-id');alm.cache_path=alm.content.data('cache-path');alm.cache_logged_in=alm.content.data('cache-logged-in');alm.repeater=alm.content.data('repeater');alm.scroll_distance=alm.content.data('scroll-distance');alm.max_pages=alm.content.data('max-pages');alm.pause=alm.content.data('pause');alm.transition=alm.content.data('transition');alm.destroy_after=alm.content.data('destroy-after');alm.lang=alm.content.data('lang');alm.posts_per_page=alm.content.data('posts-per-page');alm.seo=alm.content.data('seo');alm.preloaded=alm.content.data('preloaded');alm.preloaded_amount=alm.content.data('preloaded-amount');if(alm.content.data('offset')===undefined)
15
  alm.offset=0;else
16
- alm.offset=alm.content.data('offset');if(alm.cache===undefined)
17
  alm.cache=false;if(alm.cache_logged_in===undefined)
18
- alm.cache_logged_in=false;if(alm.preloaded){alm.preload_wrap=alm.content.prev('.alm-preloaded');alm.total_posts=alm.preload_wrap.data('total-posts');if(alm.preloaded_amount===undefined)
19
- alm.preloaded_amount=false;if(alm.total_posts<=alm.preloaded_amount)
20
- alm.disable_ajax=true;}
21
  if(alm.seo===undefined)
22
- alm.seo=false;alm.permalink=alm.content.data('seo-permalink');alm.start_page=alm.content.data('seo-start-page');if(alm.start_page){alm.seo_scroll=alm.content.data('seo-scroll');alm.seo_scroll_speed=alm.content.data('seo-scroll-speed');alm.seo_scrolltop=alm.content.data('seo-scrolltop');alm.isPaged=false;if(alm.start_page>1){alm.isPaged=true;alm.posts_per_page=alm.start_page*alm.posts_per_page;}}
23
  if(alm.pause===undefined||(alm.seo&&alm.start_page>1))
24
  alm.pause=false;if(alm.preloaded&&alm.start_page>=1)
25
  alm.pause=false;if(alm.repeater===undefined)
@@ -31,22 +30,22 @@ alm.transition='slide';else if(alm.transition==="fade")
31
  alm.transition='fade';else if(alm.transition==="none")
32
  alm.transition='none';else
33
  alm.transition='slide';if(alm.destroy_after!==undefined){}
34
- if(alm.content.data('button-label')===undefined)
35
  alm.button_label='Older Posts';else
36
- alm.button_label=alm.content.data('button-label');if(alm.content.data('button-class')===undefined)
37
  alm.button_class='';else
38
- alm.button_class=' '+alm.content.data('button-class');if(alm.content.data('scroll')===undefined)
39
- alm.scroll=true;else if(alm.content.data('scroll')===false)
40
  alm.scroll=false;else
41
- alm.scroll=true;alm.post_type=alm.content.data('post-type');alm.post_type=alm.post_type.split(",");alm.el.append('<div class="'+alm.prefix+'btn-wrap"><button id="load-more" class="'+alm.prefix+'load-more-btn more'+alm.button_class+'">'+alm.button_label+'</button></div>');alm.button=$('.alm-load-more-btn',alm.el);alm.AjaxLoadMore.loadPosts=function(){if(!alm.disable_ajax){alm.button.addClass('loading');alm.loading=true;if(alm.cache&&!alm.cache_logged_in){var cachePage=alm.cache_path+'/page-'+alm.page+'.html';$.get(cachePage,function(data){alm.AjaxLoadMore.success(data);}).fail(function(){alm.AjaxLoadMore.ajax();});}else{alm.AjaxLoadMore.ajax();}}};alm.AjaxLoadMore.ajax=function(){$.ajax({type:"GET",url:alm_localize.ajaxurl,data:{action:'ajax_load_more_init',nonce:alm_localize.alm_nonce,cache_id:alm.cache_id,repeater:alm.repeater,postType:alm.post_type,post_format:alm.content.data('post-format'),category:alm.content.data('category'),category__not_in:alm.content.data('category__not_in'),tag:alm.content.data('tag'),tag__not_in:alm.content.data('tag__not_in'),taxonomy:alm.content.data('taxonomy'),taxonomy_terms:alm.content.data('taxonomy-terms'),taxonomy_operator:alm.content.data('taxonomy-operator'),meta_key:alm.content.data('meta-key'),meta_value:alm.content.data('meta-value'),meta_compare:alm.content.data('meta-compare'),author:alm.content.data('author'),year:alm.content.data('year'),month:alm.content.data('month'),day:alm.content.data('day'),post_status:alm.content.data('post-status'),order:alm.content.data('order'),orderby:alm.content.data('orderby'),search:alm.content.data('search'),exclude:alm.content.data('exclude'),posts_per_page:alm.posts_per_page,pageNumber:alm.page,offset:alm.offset,preloaded:alm.preloaded,preloaded_amount:alm.preloaded_amount,lang:alm.lang},dataType:"html",beforeSend:function(){if(alm.page!=1){alm.button.addClass('loading');}},success:function(data){alm.AjaxLoadMore.success(data);},error:function(jqXHR,textStatus,errorThrown){alm.AjaxLoadMore.error(jqXHR,textStatus,errorThrown);}});};alm.AjaxLoadMore.success=function(data){alm.data=$(data);if(alm.init){alm.button.text(alm.button_label);alm.init=false;if(!alm.data.length>0){if($.isFunction($.fn.almEmpty)){$.fn.almEmpty(alm);}}
42
- if(alm.isPaged){alm.posts_per_page=alm.content.data('posts-per-page');alm.page=alm.start_page-1;}}
43
  if(alm.data.length>0){alm.el=$('<div class="'+alm.prefix+'reveal"/>');alm.el.append(alm.data);alm.el.hide();alm.content.append(alm.el);if(alm.transition==='fade'){alm.el.fadeIn(alm.speed,'alm_easeInOutQuad',function(){alm.loading=false;alm.button.delay(alm.speed).removeClass('loading');if(alm.data.length<alm.posts_per_page){alm.finished=true;alm.button.addClass('done');}});}else if(alm.transition==='none'){alm.el.show();alm.loading=false;alm.button.delay(alm.speed).removeClass('loading');if(alm.data.length<alm.posts_per_page){alm.finished=true;alm.button.addClass('done');}}else{alm.el.slideDown(alm.speed,'alm_easeInOutQuad',function(){alm.loading=false;alm.button.delay(alm.speed).removeClass('loading');if(alm.data.length<alm.posts_per_page){alm.finished=true;alm.button.addClass('done');}});}
44
  if($.isFunction($.fn.almComplete)){$.fn.almComplete(alm);}
45
  if($(".ajax-load-more-wrap").length===1){if($.isFunction($.fn.almSEO)&&alm.seo){$.fn.almSEO(alm);}}}else{alm.button.delay(alm.speed).removeClass('loading').addClass('done');alm.loading=false;alm.finished=true;}
46
- if(alm.destroy_after!==undefined&&alm.destroy_after!==''){var currentPage=alm.page+1;if(alm.preload)currentPage++;if(currentPage===alm.destroy_after){alm.disable_ajax=true;alm.button.delay(alm.speed).fadeOut(alm.speed);}}};alm.AjaxLoadMore.error=function(jqXHR,textStatus,errorThrown){alm.loading=false;alm.button.removeClass('loading');console.log(errorThrown);};alm.button.on('click',function(){if(alm.pause===true){alm.pause=false;alm.AjaxLoadMore.loadPosts();}
47
  if(!alm.loading&&!alm.finished&&!$(this).hasClass('done')){alm.loading=true;alm.page++;alm.AjaxLoadMore.loadPosts();}});alm.AjaxLoadMore.isVisible=function(){alm.visible=false;if(alm.el.is(":visible")){alm.visible=true;}
48
- return alm.visible;};if(alm.scroll){alm.window.bind("scroll touchstart",function(){if(alm.AjaxLoadMore.isVisible()){var content_offset=alm.button.offset();if(!alm.loading&&!alm.finished&&(alm.window.scrollTop()>=Math.round(content_offset.top-(alm.window.height()-alm.scroll_distance)))&&alm.page<(alm.max_pages-1)&&alm.proceed&&!alm.pause){alm.page++;alm.AjaxLoadMore.loadPosts();}}});}
49
- if(alm.disable_ajax){alm.finished=true;alm.button.addClass('done');}else{if(alm.pause===true){alm.button.text(alm.button_label);alm.loading=false;}else{alm.AjaxLoadMore.loadPosts();}}
50
- setTimeout(function(){alm.proceed=true;},1000);$.easing.alm_easeInOutQuad=function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;};};$.fn.ajaxloadmore=function(){return this.each(function(){$(this).data('alm',new $.ajaxloadmore($(this)));});}
51
- if($(".ajax-load-more-wrap").length)
52
  $(".ajax-load-more-wrap").ajaxloadmore();})(jQuery);
11
  * Twitter: @KaptonKaos
12
  */
13
 
14
+ (function($){"use strict";$(window).scrollTop(0);$.ajaxloadmore=function(el){var alm=this;alm.AjaxLoadMore={};alm.page=0;alm.speed=300;alm.proceed=false;alm.disable_ajax=false;alm.init=true;alm.loading=true;alm.finished=false;alm.window=$(window);alm.button_label='';alm.data;alm.el=el;alm.content=$('.alm-listing.alm-ajax',alm.el);alm.prefix='alm-';alm.cache=alm.content.attr('data-cache');alm.cache_id=alm.content.attr('data-cache-id');alm.cache_path=alm.content.attr('data-cache-path');alm.cache_logged_in=alm.content.attr('data-cache-logged-in');alm.repeater=alm.content.attr('data-repeater');alm.scroll_distance=alm.content.attr('data-scroll-distance');alm.max_pages=alm.content.attr('data-max-pages');alm.pause=alm.content.attr('data-pause');alm.transition=alm.content.attr('data-transition');alm.destroy_after=alm.content.attr('data-destroy-after');alm.lang=alm.content.attr('data-lang');alm.posts_per_page=alm.content.attr('data-posts-per-page');alm.seo=alm.content.attr('data-seo');alm.preloaded=alm.content.attr('data-preloaded');alm.preloaded_amount=alm.content.attr('data-preloaded-amount');if(alm.content.attr('data-offset')===undefined)
15
  alm.offset=0;else
16
+ alm.offset=alm.content.attr('data-offset');if(alm.cache===undefined)
17
  alm.cache=false;if(alm.cache_logged_in===undefined)
18
+ alm.cache_logged_in=false;if(alm.preloaded==='true'){alm.preload_wrap=alm.content.prev('.alm-preloaded');alm.total_posts=parseInt(alm.preload_wrap.attr('data-total-posts'));if(alm.preloaded_amount===undefined)
19
+ alm.preloaded_amount=false;if(alm.total_posts<=alm.preloaded_amount){alm.disable_ajax=true;}}
 
20
  if(alm.seo===undefined)
21
+ alm.seo=false;alm.permalink=alm.content.attr('data-seo-permalink');alm.start_page=alm.content.attr('data-seo-start-page');if(alm.start_page){alm.seo_scroll=alm.content.attr('data-seo-scroll');alm.seo_scroll_speed=alm.content.attr('data-seo-scroll-speed');alm.seo_scrolltop=alm.content.attr('data-seo-scrolltop');alm.isPaged=false;if(alm.start_page>1){alm.isPaged=true;alm.posts_per_page=alm.start_page*alm.posts_per_page;}}
22
  if(alm.pause===undefined||(alm.seo&&alm.start_page>1))
23
  alm.pause=false;if(alm.preloaded&&alm.start_page>=1)
24
  alm.pause=false;if(alm.repeater===undefined)
30
  alm.transition='fade';else if(alm.transition==="none")
31
  alm.transition='none';else
32
  alm.transition='slide';if(alm.destroy_after!==undefined){}
33
+ if(alm.content.attr('data-button-label')===undefined)
34
  alm.button_label='Older Posts';else
35
+ alm.button_label=alm.content.attr('data-button-label');if(alm.content.attr('data-button-class')===undefined)
36
  alm.button_class='';else
37
+ alm.button_class=' '+alm.content.attr('data-button-class');if(alm.content.attr('data-scroll')===undefined)
38
+ alm.scroll=true;else if(alm.content.attr('data-scroll')==='false')
39
  alm.scroll=false;else
40
+ alm.scroll=true;alm.post_type=alm.content.attr('data-post-type');alm.post_type=alm.post_type.split(",");alm.el.append('<div class="'+alm.prefix+'btn-wrap"><button id="load-more" class="'+alm.prefix+'load-more-btn more'+alm.button_class+'">'+alm.button_label+'</button></div>');alm.button=$('.alm-load-more-btn',alm.el);alm.AjaxLoadMore.loadPosts=function(){if(!alm.disable_ajax){alm.button.addClass('loading');alm.loading=true;if(alm.cache==='true'&&!alm.cache_logged_in){var cachePage=alm.cache_path+'/page-'+alm.page+'.html';$.get(cachePage,function(data){alm.AjaxLoadMore.success(data);}).fail(function(){alm.AjaxLoadMore.ajax();});}else{alm.AjaxLoadMore.ajax();}}};alm.AjaxLoadMore.ajax=function(){$.ajax({type:"GET",url:alm_localize.ajaxurl,data:{action:'ajax_load_more_init',nonce:alm_localize.alm_nonce,cache_id:alm.cache_id,repeater:alm.repeater,postType:alm.post_type,post_format:alm.content.attr('data-post-format'),category:alm.content.attr('data-category'),category__not_in:alm.content.attr('data-category-not-in'),tag:alm.content.attr('data-tag'),tag__not_in:alm.content.attr('data-tag-not-in'),taxonomy:alm.content.attr('data-taxonomy'),taxonomy_terms:alm.content.attr('data-taxonomy-terms'),taxonomy_operator:alm.content.attr('data-taxonomy-operator'),meta_key:alm.content.attr('data-meta-key'),meta_value:alm.content.attr('data-meta-value'),meta_compare:alm.content.attr('data-meta-compare'),author:alm.content.attr('data-author'),year:alm.content.attr('data-year'),month:alm.content.attr('data-month'),day:alm.content.attr('data-day'),post_status:alm.content.attr('data-post-status'),order:alm.content.attr('data-order'),orderby:alm.content.attr('data-orderby'),post__in:alm.content.attr('data-post-in'),exclude:alm.content.attr('data-exclude'),search:alm.content.attr('data-search'),posts_per_page:alm.posts_per_page,pageNumber:alm.page,offset:alm.offset,preloaded:alm.preloaded,preloaded_amount:alm.preloaded_amount,lang:alm.lang},dataType:"html",beforeSend:function(){if(alm.page!=1){alm.button.addClass('loading');}},success:function(data){alm.AjaxLoadMore.success(data);},error:function(jqXHR,textStatus,errorThrown){alm.AjaxLoadMore.error(jqXHR,textStatus,errorThrown);}});};alm.AjaxLoadMore.success=function(data){alm.data=$(data);if(alm.init){alm.button.text(alm.button_label);alm.init=false;if(!alm.data.length>0){if($.isFunction($.fn.almEmpty)){$.fn.almEmpty(alm);}}
41
+ if(alm.isPaged){alm.posts_per_page=alm.content.attr('data-posts-per-page');alm.page=alm.start_page-1;}}
42
  if(alm.data.length>0){alm.el=$('<div class="'+alm.prefix+'reveal"/>');alm.el.append(alm.data);alm.el.hide();alm.content.append(alm.el);if(alm.transition==='fade'){alm.el.fadeIn(alm.speed,'alm_easeInOutQuad',function(){alm.loading=false;alm.button.delay(alm.speed).removeClass('loading');if(alm.data.length<alm.posts_per_page){alm.finished=true;alm.button.addClass('done');}});}else if(alm.transition==='none'){alm.el.show();alm.loading=false;alm.button.delay(alm.speed).removeClass('loading');if(alm.data.length<alm.posts_per_page){alm.finished=true;alm.button.addClass('done');}}else{alm.el.slideDown(alm.speed,'alm_easeInOutQuad',function(){alm.loading=false;alm.button.delay(alm.speed).removeClass('loading');if(alm.data.length<alm.posts_per_page){alm.finished=true;alm.button.addClass('done');}});}
43
  if($.isFunction($.fn.almComplete)){$.fn.almComplete(alm);}
44
  if($(".ajax-load-more-wrap").length===1){if($.isFunction($.fn.almSEO)&&alm.seo){$.fn.almSEO(alm);}}}else{alm.button.delay(alm.speed).removeClass('loading').addClass('done');alm.loading=false;alm.finished=true;}
45
+ if(alm.destroy_after!==undefined&&alm.destroy_after!==''){var currentPage=alm.page+1;if(alm.preload)currentPage++;if(currentPage==alm.destroy_after){alm.disable_ajax=true;alm.button.delay(alm.speed).fadeOut(alm.speed);}}};alm.AjaxLoadMore.error=function(jqXHR,textStatus,errorThrown){alm.loading=false;alm.button.removeClass('loading');console.log(errorThrown);};alm.button.on('click',function(){if(alm.pause==='true'){alm.pause=false;alm.AjaxLoadMore.loadPosts();}
46
  if(!alm.loading&&!alm.finished&&!$(this).hasClass('done')){alm.loading=true;alm.page++;alm.AjaxLoadMore.loadPosts();}});alm.AjaxLoadMore.isVisible=function(){alm.visible=false;if(alm.el.is(":visible")){alm.visible=true;}
47
+ return alm.visible;};if(alm.scroll){alm.window.bind("scroll touchstart",function(){if(alm.AjaxLoadMore.isVisible()){var content_offset=alm.button.offset();if(!alm.loading&&!alm.finished&&(alm.window.scrollTop()>=Math.round(content_offset.top-(alm.window.height()-alm.scroll_distance)))&&alm.page<(alm.max_pages-1)&&alm.proceed&&alm.pause!=='true'){alm.page++;alm.AjaxLoadMore.loadPosts();}}});}
48
+ if(alm.disable_ajax){alm.finished=true;alm.button.addClass('done');}else{if(alm.pause==='true'){alm.button.text(alm.button_label);alm.loading=false;}else{alm.AjaxLoadMore.loadPosts();}}
49
+ setTimeout(function(){alm.proceed=true;},1000);$.easing.alm_easeInOutQuad=function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;};};$.fn.almFilter=function(transition,speed,data){$(".ajax-load-more-wrap").each(function(e){var el=$(this);if(transition==='slide'){el.slideUp(speed,function(){$('.alm-listing',el).html('');$('.alm-btn-wrap',el).remove();el.fadeIn(speed);$.fn.almSetFilters(el,data);});}else if(transition==='fade'){el.fadeOut(speed,function(){$('.alm-listing',el).html('');$('.alm-btn-wrap',el).remove();el.fadeIn(speed);$.fn.almSetFilters(el,data);});}else{$('.alm-listing',el).html('');$('.alm-btn-wrap',el).remove();el.fadeIn(speed);$.fn.almSetFilters(el,data);}});};$.fn.almSetFilters=function(el,data){$.each(data,function(key,value){key=key.replace(/\W+/g,'-').replace(/([a-z\d])([A-Z])/g,'$1-$2');$('.alm-listing',el).attr('data-'+key,value);});if($.isFunction($.fn.almFilterComplete))
50
+ $.fn.almFilterComplete();$(".ajax-load-more-wrap").ajaxloadmore();};$.fn.ajaxloadmore=function(){return this.each(function(){$(this).data('alm',new $.ajaxloadmore($(this)));});};if($(".ajax-load-more-wrap").length)
51
  $(".ajax-load-more-wrap").ajaxloadmore();})(jQuery);