WordPress Infinite Scroll – Ajax Load More - Version 2.6.0

Version Description

  • NEW - Adding scroll_distance parameter - easily adjust the distance from the bottom of the page that will trigger loading of posts.
  • NEW - Adding required functionality for Caching Add-on.
  • NEW - Adding new almEmpty function triggered if zero results were returned.
  • FIX - Disabled in previous versions, Preloaded and SEO can now work together to produce SEO URLs.
  • UPDATE - Performance updates, various UI improvements.
Download this release

Release Info

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

Code changes from version 2.5.1 to 2.6.0

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dcooney
3
  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
7
- Stable tag: 2.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,7 +16,6 @@ Ajax Load More is a simple yet powerful solution for lazy loading WordPress post
16
  Build complex WordPress queries using our shortcode builder then add the shortcode to your pages via the content editor or directly into your template files.
17
 
18
 
19
-
20
  = Features =
21
 
22
  * **Multiple Instances** - One, two, three or ten - you can now include multiple instances of Ajax Load More on a single page.
@@ -33,7 +32,7 @@ Check out the **[demo site](http://connekthq.com/plugins/ajax-load-more/)** for
33
 
34
  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 shortcode is simple with our intuitive Shortcode Builder.
35
 
36
- * **repeater** - Choose a repeater template (Add-on available). Default = ‘default’
37
  * **post_type** - Comma separated list of post types. Default = ‘post’
38
  * **post_format** - Query by post format. Default = null
39
  * **category** - A comma separated list of categories to include by slug. Default = null
@@ -58,14 +57,18 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
58
  * **offset** - Offset the initial query (number). Default = ’0′
59
  * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
60
  * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
 
61
  * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '5'
62
  * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
63
  * **transition** - Choose a posts reveal transition (slide/fade/none). Default = 'slide'
64
  * **destroy_after** - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null
65
  * **button_label** - The label text for Load More button. Default = 'Older Posts'
 
 
66
  * **seo** - Enable address bar URL rewrites as users page through content - <a href="http://connekthq.com/plugins/ajax-load-more/search-engine-optimization/">add-on only</a> (true/false). Default = ‘false’
67
- * **preloaded** - Should Ajax Load More preload posts? - <a href="http://connekthq.com/plugins/ajax-load-more/preloaded/">add-on only</a> (true/false). Default = ‘false’
68
- * **preloaded_amount** - The amount of posts to preload. - <a href="http://connekthq.com/plugins/ajax-load-more/preloaded/">add-on only</a> Default = ‘5’
 
69
 
70
  ***
71
 
@@ -77,6 +80,7 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
77
 
78
  = Demos =
79
  * **[Default](http://connekthq.com/plugins/ajax-load-more/)** - Out of the box functionality and styling
 
80
  * **[Fade Transition](http://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded
81
  * **[Mansory](http://connekthq.com/plugins/ajax-load-more/examples/masonry/)** - Creating a flexible grid layout with Masonry JS
82
  * **[Multiple Instances](http://connekthq.com/plugins/ajax-load-more/examples/multiple-instances/)** - Include multiple Ajax Load More' on a single page
@@ -98,6 +102,10 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
98
  > The **[Custom Repeaters](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)** add-on will allow for **unlimited repeater templates** and provide the ability to create unique templates for different content types throughout your theme.<br />
99
  > [Get More Information](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)
100
  >
 
 
 
 
101
  > #### Preloaded
102
  > The **[Preloaded](http://connekthq.com/plugins/ajax-load-more/preloaded)** add-on will allow you to quickly and easily preload an initial set of posts before completing any Ajax requests to the server.<br />
103
  > [Get More Information](http://connekthq.com/plugins/ajax-load-more/preloaded)
@@ -118,6 +126,13 @@ To utilize the almComplete() function simply place the following code inside you
118
  $.fn.almComplete = function(alm){
119
  // Your on complete code goes here
120
  }
 
 
 
 
 
 
 
121
 
122
  ***
123
 
@@ -228,12 +243,21 @@ How to install Ajax Load More.
228
  == Changelog ==
229
 
230
 
 
 
 
 
 
 
 
 
231
  = 2.5.1 =
232
  * FIX - Dynamic population of category, tag and author content within Shortcode Builder - now this actually works as requested and no database queries happen if this setting is true.
233
  * FIX - Small issue with new destory_after parameter in core js.
234
  * UPDATE - Updated language .pot file.
235
  * UPDATE - Small admin interface tweaks.
236
 
 
237
  = 2.5.0 =
238
  * NEW - Adding query by multiple categories and tags.
239
  * NEW - Adding required functionality for new Preloaded add-on - preload posts before any ajax queries kick in.
@@ -246,6 +270,7 @@ How to install Ajax Load More.
246
  * FIX - Issue with simultaneous query by category and custom taxonomy.
247
  * Fix - Issue for SEO add-on when pause = "true". ALM will now set pause to false if page > 1 when using the SEO add-on.
248
 
 
249
  = 2.4.0 =
250
  * Adding date query parameters - users can now query by day, month and year.
251
  * Admin UX improvements including sticky navigation in shortcode builder.
3
  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
 
16
  Build complex WordPress queries using our shortcode builder then add the shortcode to your pages via the content editor or directly into your template files.
17
 
18
 
 
19
  = Features =
20
 
21
  * **Multiple Instances** - One, two, three or ten - you can now include multiple instances of Ajax Load More on a single page.
32
 
33
  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 shortcode is simple with our intuitive Shortcode Builder.
34
 
35
+ * **repeater** - Choose a repeater template (<a href="http://connekthq.com/plugins/ajax-load-more/custom-repeaters/">Add-on available</a>). Default = ‘default’
36
  * **post_type** - Comma separated list of post types. Default = ‘post’
37
  * **post_format** - Query by post format. Default = null
38
  * **category** - A comma separated list of categories to include by slug. 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’
60
+ * **scroll_distance** - The distance from the bottom of the screen to trigger the loading of posts while scrolling. Default = '150'
61
  * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '5'
62
  * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
63
  * **transition** - Choose a posts reveal transition (slide/fade/none). Default = 'slide'
64
  * **destroy_after** - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null
65
  * **button_label** - The label text for Load More button. Default = 'Older Posts'
66
+ * **cache** - Turn on content caching for the specific Ajax Load More query. <a href="http://connekthq.com/plugins/ajax-load-more/cache/">add-on only</a> - (true/false). Default = ‘false’
67
+ * **cache_id** - A unique 10 digit ID for the cached query. <a href="http://connekthq.com/plugins/ajax-load-more/cache/">add-on only</a> - Default = A random 10 digit integer
68
  * **seo** - Enable address bar URL rewrites as users page through content - <a href="http://connekthq.com/plugins/ajax-load-more/search-engine-optimization/">add-on only</a> (true/false). Default = ‘false’
69
+ * **preloaded** - Should Ajax Load More preload posts? <a href="http://connekthq.com/plugins/ajax-load-more/preloaded/">add-on only</a> - (true/false). Default = ‘false’
70
+ * **preloaded_amount** - The amount of posts to preload. <a href="http://connekthq.com/plugins/ajax-load-more/preloaded/">add-on only</a> - Default = ‘5’
71
+
72
 
73
  ***
74
 
80
 
81
  = Demos =
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
102
  > The **[Custom Repeaters](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)** add-on will allow for **unlimited repeater templates** and provide the ability to create unique templates for different content types throughout your theme.<br />
103
  > [Get More Information](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)
104
  >
105
+ > #### Cache
106
+ > The **[Cache](http://connekthq.com/plugins/ajax-load-more/cache)** creates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.<br />
107
+ > [Get More Information](http://connekthq.com/plugins/ajax-load-more/cache)
108
+ >
109
  > #### Preloaded
110
  > The **[Preloaded](http://connekthq.com/plugins/ajax-load-more/preloaded)** add-on will allow you to quickly and easily preload an initial set of posts before completing any Ajax requests to the server.<br />
111
  > [Get More Information](http://connekthq.com/plugins/ajax-load-more/preloaded)
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
  == 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.
249
+ * NEW - Adding new almEmpty function triggered if zero results were returned.
250
+ * FIX - Disabled in previous versions, Preloaded and SEO can now work together to produce SEO URLs.
251
+ * UPDATE - Performance updates, various UI improvements.
252
+
253
+
254
  = 2.5.1 =
255
  * FIX - Dynamic population of category, tag and author content within Shortcode Builder - now this actually works as requested and no database queries happen if this setting is true.
256
  * FIX - Small issue with new destory_after parameter in core js.
257
  * UPDATE - Updated language .pot file.
258
  * UPDATE - Small admin interface tweaks.
259
 
260
+
261
  = 2.5.0 =
262
  * NEW - Adding query by multiple categories and tags.
263
  * NEW - Adding required functionality for new Preloaded add-on - preload posts before any ajax queries kick in.
270
  * FIX - Issue with simultaneous query by category and custom taxonomy.
271
  * Fix - Issue for SEO add-on when pause = "true". ALM will now set pause to false if page > 1 when using the SEO add-on.
272
 
273
+
274
  = 2.4.0 =
275
  * Adding date query parameters - users can now query by day, month and year.
276
  * Admin UX improvements including sticky navigation in shortcode builder.
admin/admin.php CHANGED
@@ -4,11 +4,13 @@
4
 
5
  add_action( 'admin_head', 'alm_admin_vars' );
6
  add_action( 'wp_ajax_alm_save_repeater', 'alm_save_repeater' ); // Ajax Save Repeater
7
- add_action( 'wp_ajax_nopriv_alm_save_repeater', 'alm_save_repeater' ); // Ajax Save Repeater
8
  add_action( 'wp_ajax_alm_update_repeater', 'alm_update_repeater' ); // Ajax Update Repeater
9
- add_action( 'wp_ajax_nopriv_alm_update_repeater', 'alm_update_repeater' ); // Ajax Update Repeater
10
  add_action( 'wp_ajax_alm_get_tax_terms', 'alm_get_tax_terms' ); // Ajax Get Taxonomy Terms
11
- add_action( 'wp_ajax_nopriv_alm_get_tax_terms', 'alm_get_tax_terms' ); // Ajax Get Taxonomy Terms
 
 
12
 
13
 
14
  /*
@@ -116,11 +118,22 @@ function alm_admin_menu() {
116
  $icon = 'dashicons-plus-alt';
117
  $icon = ALM_ADMIN_URL . "/img/alm-logo-16x16.png";
118
  $alm_page = add_menu_page( 'Ajax Load More', 'Ajax Load More', 'edit_theme_options', 'ajax-load-more', 'alm_settings_page', $icon );
 
119
  $alm_settings_page = add_submenu_page( 'ajax-load-more', 'Settings', 'Settings', 'edit_theme_options', 'ajax-load-more', 'alm_settings_page');
120
- $alm_template_page = add_submenu_page( 'ajax-load-more', 'Repeater Templates', 'Repeater Templates', 'edit_theme_options', 'ajax-load-more-repeaters', 'alm_repeater_page');
121
- $alm_shortcode_page = add_submenu_page( 'ajax-load-more', 'Shortcode Builder', 'Shortcode Builder', 'edit_theme_options', 'ajax-load-more-shortcode-builder', 'alm_shortcode_builder_page');
122
- $alm_examples_page = add_submenu_page( 'ajax-load-more', 'Examples', 'Examples', 'edit_theme_options', 'ajax-load-more-examples', 'alm_example_page');
123
- $alm_addons_page = add_submenu_page( 'ajax-load-more', 'Add-ons', 'Add-ons', 'edit_theme_options', 'ajax-load-more-add-ons', 'alm_add_ons_page');
 
 
 
 
 
 
 
 
 
 
124
 
125
  //Add our admin scripts
126
  add_action( 'load-' . $alm_settings_page, 'alm_load_admin_js' );
@@ -128,9 +141,8 @@ function alm_admin_menu() {
128
  add_action( 'load-' . $alm_shortcode_page, 'alm_load_admin_js' );
129
  add_action( 'load-' . $alm_examples_page, 'alm_load_admin_js' );
130
  add_action( 'load-' . $alm_addons_page, 'alm_load_admin_js' );
131
-
132
- }
133
-
134
 
135
 
136
  /**
@@ -143,6 +155,9 @@ function alm_admin_menu() {
143
  function alm_load_admin_js(){
144
  add_action( 'admin_enqueue_scripts', 'alm_enqueue_admin_scripts' );
145
  }
 
 
 
146
 
147
 
148
 
@@ -158,7 +173,6 @@ function alm_enqueue_admin_scripts(){
158
  //Load Admin CSS
159
  wp_enqueue_style( 'alm-admin-css', ALM_ADMIN_URL. 'css/admin.css');
160
  wp_enqueue_style( 'alm-select2-css', ALM_ADMIN_URL. 'css/select2.css');
161
- //wp_enqueue_style( 'alm-chosen-css', ALM_ADMIN_URL. 'css/chosen.css');
162
  wp_enqueue_style( 'alm-core-css', ALM_URL. '/core/css/ajax-load-more.css');
163
  wp_enqueue_style( 'alm-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
164
 
@@ -189,6 +203,10 @@ function alm_enqueue_admin_scripts(){
189
  wp_enqueue_script( 'alm-shortcode-builder', ALM_ADMIN_URL. 'shortcode-builder/js/shortcode-builder.js', array( 'jquery' ));
190
  }
191
 
 
 
 
 
192
 
193
 
194
  /*
@@ -255,6 +273,49 @@ function alm_add_ons_page(){
255
  }
256
 
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
 
259
  /*
260
  * alm_save_repeater
@@ -491,7 +552,32 @@ function alm_admin_init(){
491
  'alm_general_settings'
492
  );
493
 
494
- //
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  if(has_action('alm_seo_installed')){
496
 
497
  add_settings_section(
@@ -521,6 +607,13 @@ function alm_admin_init(){
521
  'ajax-load-more',
522
  'alm_seo_settings'
523
  );
 
 
 
 
 
 
 
524
 
525
  }
526
  }
@@ -551,6 +644,7 @@ function alm_sanitize_settings( $input ) {
551
  }
552
 
553
 
 
554
  /*
555
  * alm_disable_css_callback
556
  * Diabale Ajax Load More CSS.
@@ -565,12 +659,13 @@ function alm_disable_css_callback(){
565
 
566
  $html = '<input type="hidden" name="alm_settings[_alm_disable_css]" value="0" />';
567
  $html .= '<input type="checkbox" id="alm_disable_css_input" name="alm_settings[_alm_disable_css]" value="1"'. (($options['_alm_disable_css']) ? ' checked="checked"' : '') .' />';
568
- $html .= '<label for="alm_disable_css_input">'.__('I want to use my own CSS styles', ALM_NAME).'<br/><span style="display:block;"><i class="fa fa-file-text-o"></i> &nbsp;<a href="'.ALM_URL.'/core/css/ajax-load-more.css" target="blank">'.__('View Ajax Load More CSS', ALM_NAME).'</a></span></label>';
569
 
570
  echo $html;
571
  }
572
 
573
 
 
574
  /*
575
  * alm_hide_btn_callback
576
  * Disbale the ALM shortcode button in the WordPress content editor
@@ -584,7 +679,7 @@ function alm_hide_btn_callback(){
584
  $options['_alm_hide_btn'] = '0';
585
 
586
  $html = '<input type="hidden" name="alm_settings[_alm_hide_btn]" value="0" /><input type="checkbox" id="alm_hide_btn" name="alm_settings[_alm_hide_btn]" value="1"'. (($options['_alm_hide_btn']) ? ' checked="checked"' : '') .' />';
587
- $html .= '<label for="alm_hide_btn">'.__('Hide shortcode button in WYSIWYG editor', ALM_NAME).'</label>';
588
 
589
  echo $html;
590
  }
@@ -621,7 +716,7 @@ function alm_disable_dynamic_callback(){
621
  function alm_class_callback(){
622
  $options = get_option( 'alm_settings' );
623
 
624
- $html = '<label for="alm_settings[_alm_classname]">'.__('Add classes to Ajax Load More container', ALM_NAME).'</label><br/>';
625
  $html .= '<input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="'.$options['_alm_classname'].'" placeholder="posts listing etc..." /> ';
626
 
627
  echo $html;
@@ -669,35 +764,28 @@ function alm_btn_color_callback() {
669
  if(!isset($color))
670
  $options['_alm_btn_color'] = '0';
671
 
672
- $selected0 = '';
673
- if($color == 'default')
674
- $selected0 = 'selected="selected"';
675
 
676
- $selected1 = '';
677
- if($color == 'blue')
678
- $selected1 = 'selected="selected"';
679
 
680
- $selected2 = '';
681
- if($color == 'green')
682
- $selected2 = 'selected="selected"';
683
 
684
- $selected3 = '';
685
- if($color == 'red')
686
- $selected3 = 'selected="selected"';
687
 
688
- $selected4 = '';
689
- if($color == 'purple')
690
- $selected4 = 'selected="selected"';
691
 
692
- $selected5 = '';
693
- if($color == 'grey')
694
- $selected5 = 'selected="selected"';
695
 
696
- $selected6 = '';
697
- if($color == 'white')
698
- $selected5 = 'selected="selected"';
699
 
700
- $html = '<label for="alm_settings_btn_color">'.__('Choose your <strong>Load More</strong> button color', ALM_NAME).'</label><br/>';
701
  $html .= '<select id="alm_settings_btn_color" name="alm_settings[_alm_btn_color]">';
702
  $html .= '<option value="default" ' . $selected0 .'>Default (Orange)</option>';
703
  $html .= '<option value="blue" ' . $selected1 .'>Blue</option>';
@@ -727,7 +815,7 @@ function alm_btn_class_callback(){
727
  if(!isset($options['_alm_btn_classname']))
728
  $options['_alm_btn_classname'] = '';
729
 
730
- $html = '<label for="alm_settings[_alm_btn_classname]">'.__('Add classes to your <strong>Load More</strong> button', ALM_NAME).'</label>';
731
  $html .= '<input type="text" class="btn-classes" id="alm_settings[_alm_btn_classname]" name="alm_settings[_alm_btn_classname]" value="'.$options['_alm_btn_classname'].'" placeholder="button rounded listing etc..." /> ';
732
 
733
  echo $html;
@@ -763,6 +851,71 @@ function alm_btn_class_callback(){
763
 
764
 
765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
 
767
  /*
768
  * alm_seo_settings_callback
@@ -846,19 +999,43 @@ function _alm_seo_speed_callback() {
846
 
847
 
848
  echo '<label for="alm_settings[_alm_seo_speed]">'.__('Set the scrolling speed of the page in milliseconds. <br/><span>e.g. 1 second = 1000</span>', ALM_NAME).'</label><br/><input type="number" class="sm" id="alm_settings[_alm_seo_speed]" name="alm_settings[_alm_seo_speed]" step="50" min="0" value="'.$options['_alm_seo_speed'].'" placeholder="1000" /> ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
 
850
  ?>
851
  <script>
852
  // Check if Scroll to Page != true
853
  if(!jQuery('input#alm_scroll_page').is(":checked")){
854
  jQuery('input#alm_scroll_page').parent().parent('tr').next('tr').hide();
 
855
  }
856
  jQuery('input#alm_scroll_page').change(function() {
857
  var el = jQuery(this);
858
  if(el.is(":checked")) {
859
  el.parent().parent('tr').next('tr').show();
 
860
  }else{
861
  el.parent().parent('tr').next('tr').hide();
 
862
  }
863
  });
864
 
4
 
5
  add_action( 'admin_head', 'alm_admin_vars' );
6
  add_action( 'wp_ajax_alm_save_repeater', 'alm_save_repeater' ); // Ajax Save Repeater
7
+ add_action( 'wp_ajax_nopriv_alm_save_repeater', 'alm_save_repeater' );
8
  add_action( 'wp_ajax_alm_update_repeater', 'alm_update_repeater' ); // Ajax Update Repeater
9
+ add_action( 'wp_ajax_nopriv_alm_update_repeater', 'alm_update_repeater' );
10
  add_action( 'wp_ajax_alm_get_tax_terms', 'alm_get_tax_terms' ); // Ajax Get Taxonomy Terms
11
+ add_action( 'wp_ajax_nopriv_alm_get_tax_terms', 'alm_get_tax_terms' );
12
+ add_action( 'wp_ajax_alm_delete_cache', 'alm_delete_cache' ); // Delete Cache
13
+ add_action( 'wp_ajax_nopriv_alm_delete_cache', 'alm_delete_cache' );
14
 
15
 
16
  /*
118
  $icon = 'dashicons-plus-alt';
119
  $icon = ALM_ADMIN_URL . "/img/alm-logo-16x16.png";
120
  $alm_page = add_menu_page( 'Ajax Load More', 'Ajax Load More', 'edit_theme_options', 'ajax-load-more', 'alm_settings_page', $icon );
121
+
122
  $alm_settings_page = add_submenu_page( 'ajax-load-more', 'Settings', 'Settings', 'edit_theme_options', 'ajax-load-more', 'alm_settings_page');
123
+
124
+ $alm_template_page = add_submenu_page( 'ajax-load-more', 'Repeater Templates', 'Repeater Templates', 'edit_theme_options', 'ajax-load-more-repeaters', 'alm_repeater_page');
125
+
126
+ $alm_shortcode_page = add_submenu_page( 'ajax-load-more', 'Shortcode Builder', 'Shortcode Builder', 'edit_theme_options', 'ajax-load-more-shortcode-builder', 'alm_shortcode_builder_page');
127
+
128
+ $alm_examples_page = add_submenu_page( 'ajax-load-more', 'Examples', 'Examples', 'edit_theme_options', 'ajax-load-more-examples', 'alm_example_page');
129
+
130
+ $alm_addons_page = add_submenu_page( 'ajax-load-more', 'Add-ons', 'Add-ons', 'edit_theme_options', 'ajax-load-more-add-ons', 'alm_add_ons_page');
131
+
132
+ if(has_action('alm_cache_installed')){
133
+ $alm_cache_page = add_submenu_page( 'ajax-load-more', 'Cache', '<span style="color: #f2f5bf">Cache<span>', 'edit_theme_options', 'ajax-load-more-cache', 'alm_cache_page');
134
+ add_action( 'load-' . $alm_cache_page, 'alm_load_admin_js' );
135
+ add_action( 'load-' . $alm_cache_page, 'alm_load_cache_admin_js' );
136
+ }
137
 
138
  //Add our admin scripts
139
  add_action( 'load-' . $alm_settings_page, 'alm_load_admin_js' );
141
  add_action( 'load-' . $alm_shortcode_page, 'alm_load_admin_js' );
142
  add_action( 'load-' . $alm_examples_page, 'alm_load_admin_js' );
143
  add_action( 'load-' . $alm_addons_page, 'alm_load_admin_js' );
144
+ }
145
+
 
146
 
147
 
148
  /**
155
  function alm_load_admin_js(){
156
  add_action( 'admin_enqueue_scripts', 'alm_enqueue_admin_scripts' );
157
  }
158
+ function alm_load_cache_admin_js(){
159
+ add_action( 'admin_enqueue_scripts', 'alm_enqueue_cache_admin_scripts' );
160
+ }
161
 
162
 
163
 
173
  //Load Admin CSS
174
  wp_enqueue_style( 'alm-admin-css', ALM_ADMIN_URL. 'css/admin.css');
175
  wp_enqueue_style( 'alm-select2-css', ALM_ADMIN_URL. 'css/select2.css');
 
176
  wp_enqueue_style( 'alm-core-css', ALM_URL. '/core/css/ajax-load-more.css');
177
  wp_enqueue_style( 'alm-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
178
 
203
  wp_enqueue_script( 'alm-shortcode-builder', ALM_ADMIN_URL. 'shortcode-builder/js/shortcode-builder.js', array( 'jquery' ));
204
  }
205
 
206
+ function alm_enqueue_cache_admin_scripts(){
207
+ wp_enqueue_script( 'alm-cache-admin', ALM_CACHE_URL. '/js/alm-cache.js', array( 'jquery' ));
208
+ }
209
+
210
 
211
 
212
  /*
273
  }
274
 
275
 
276
+ /*
277
+ * alm_cache_page
278
+ * Cache Add-on page
279
+ *
280
+ * @since 2.6.0
281
+ */
282
+
283
+ function alm_cache_page(){
284
+ include_once( ALM_CACHE_PATH . 'admin/views/cache.php');
285
+ }
286
+
287
+
288
+
289
+ /*
290
+ * alm_delete_cache
291
+ * Delete induvidual cached items
292
+ *
293
+ * @return null
294
+ * @since 2.6.0
295
+ */
296
+
297
+ function alm_delete_cache(){
298
+ $nonce = $_POST["nonce"];
299
+ $cache = $_POST["cache"];
300
+ // Check our nonce, if they don't match then bounce!
301
+ if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
302
+ die('Get Bounced!');
303
+
304
+ $dir = ALM_CACHE_PATH .'_cache/'.$cache;
305
+
306
+ if (is_dir($dir)) {
307
+ foreach (glob($dir."/*.*") as $filename) {
308
+ if (is_file($filename)) {
309
+ unlink($filename);
310
+ }
311
+ }
312
+ rmdir($dir);
313
+ }
314
+
315
+ die();
316
+ }
317
+
318
+
319
 
320
  /*
321
  * alm_save_repeater
552
  'alm_general_settings'
553
  );
554
 
555
+ // CACHE
556
+ if(has_action('alm_cache_installed')){
557
+ add_settings_section(
558
+ 'alm_cache_settings',
559
+ 'Cache Settings',
560
+ 'alm_cache_settings_callback',
561
+ 'ajax-load-more'
562
+ );
563
+ add_settings_field(
564
+ '_alm_cache_publish',
565
+ __('Published Posts', ALM_NAME ),
566
+ '_alm_cache_publish_callback',
567
+ 'ajax-load-more',
568
+ 'alm_cache_settings'
569
+ );
570
+ add_settings_field(
571
+ '_alm_cache_known_users',
572
+ __('Known Users', ALM_NAME ),
573
+ '_alm_cache_known_users_callback',
574
+ 'ajax-load-more',
575
+ 'alm_cache_settings'
576
+ );
577
+
578
+ }
579
+
580
+ // SEO
581
  if(has_action('alm_seo_installed')){
582
 
583
  add_settings_section(
607
  'ajax-load-more',
608
  'alm_seo_settings'
609
  );
610
+ add_settings_field(
611
+ '_alm_seo_scrolltop',
612
+ __('Scroll Top', ALM_NAME ),
613
+ '_alm_seo_scrolltop_callback',
614
+ 'ajax-load-more',
615
+ 'alm_seo_settings'
616
+ );
617
 
618
  }
619
  }
644
  }
645
 
646
 
647
+
648
  /*
649
  * alm_disable_css_callback
650
  * Diabale Ajax Load More CSS.
659
 
660
  $html = '<input type="hidden" name="alm_settings[_alm_disable_css]" value="0" />';
661
  $html .= '<input type="checkbox" id="alm_disable_css_input" name="alm_settings[_alm_disable_css]" value="1"'. (($options['_alm_disable_css']) ? ' checked="checked"' : '') .' />';
662
+ $html .= '<label for="alm_disable_css_input">'.__('I want to use my own CSS styles.', ALM_NAME).'<br/><span style="display:block;"><i class="fa fa-file-text-o"></i> &nbsp;<a href="'.ALM_URL.'/core/css/ajax-load-more.css" target="blank">'.__('View Ajax Load More CSS', ALM_NAME).'</a></span></label>';
663
 
664
  echo $html;
665
  }
666
 
667
 
668
+
669
  /*
670
  * alm_hide_btn_callback
671
  * Disbale the ALM shortcode button in the WordPress content editor
679
  $options['_alm_hide_btn'] = '0';
680
 
681
  $html = '<input type="hidden" name="alm_settings[_alm_hide_btn]" value="0" /><input type="checkbox" id="alm_hide_btn" name="alm_settings[_alm_hide_btn]" value="1"'. (($options['_alm_hide_btn']) ? ' checked="checked"' : '') .' />';
682
+ $html .= '<label for="alm_hide_btn">'.__('Hide shortcode button in WYSIWYG editor.', ALM_NAME).'</label>';
683
 
684
  echo $html;
685
  }
716
  function alm_class_callback(){
717
  $options = get_option( 'alm_settings' );
718
 
719
+ $html = '<label for="alm_settings[_alm_classname]">'.__('Add classes to Ajax Load More container.', ALM_NAME).'</label><br/>';
720
  $html .= '<input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="'.$options['_alm_classname'].'" placeholder="posts listing etc..." /> ';
721
 
722
  echo $html;
764
  if(!isset($color))
765
  $options['_alm_btn_color'] = '0';
766
 
767
+ $selected0 = '';
768
+ if($color == 'default') $selected0 = 'selected="selected"';
 
769
 
770
+ $selected1 = '';
771
+ if($color == 'blue') $selected1 = 'selected="selected"';
 
772
 
773
+ $selected2 = '';
774
+ if($color == 'green') $selected2 = 'selected="selected"';
 
775
 
776
+ $selected3 = '';
777
+ if($color == 'red') $selected3 = 'selected="selected"';
 
778
 
779
+ $selected4 = '';
780
+ if($color == 'purple') $selected4 = 'selected="selected"';
 
781
 
782
+ $selected5 = '';
783
+ if($color == 'grey') $selected5 = 'selected="selected"';
 
784
 
785
+ $selected6 = '';
786
+ if($color == 'white') $selected6 = 'selected="selected"';
 
787
 
788
+ $html = '<label for="alm_settings_btn_color">'.__('Choose your <strong>Load More</strong> button color', ALM_NAME).'.</label><br/>';
789
  $html .= '<select id="alm_settings_btn_color" name="alm_settings[_alm_btn_color]">';
790
  $html .= '<option value="default" ' . $selected0 .'>Default (Orange)</option>';
791
  $html .= '<option value="blue" ' . $selected1 .'>Blue</option>';
815
  if(!isset($options['_alm_btn_classname']))
816
  $options['_alm_btn_classname'] = '';
817
 
818
+ $html = '<label for="alm_settings[_alm_btn_classname]">'.__('Add classes to your <strong>Load More</strong> button', ALM_NAME).'.</label>';
819
  $html .= '<input type="text" class="btn-classes" id="alm_settings[_alm_btn_classname]" name="alm_settings[_alm_btn_classname]" value="'.$options['_alm_btn_classname'].'" placeholder="button rounded listing etc..." /> ';
820
 
821
  echo $html;
851
 
852
 
853
 
854
+ /*
855
+ * alm_cache_settings_callback
856
+ * Cache Setting Heading
857
+ *
858
+ * @since 2.6.0
859
+ */
860
+
861
+ function alm_cache_settings_callback() {
862
+ $html = '<p>' . __('Customize your installation of the <a href="http://connekthq.com/plugins/ajax-load-more/cache/">Cache</a> add-on.', ALM_NAME) . '</p>';
863
+
864
+ echo $html;
865
+ }
866
+
867
+
868
+
869
+ /*
870
+ * _alm_cache_publish_callback
871
+ * Clear cache when a new post is published
872
+ *
873
+ * @since 2.6.0
874
+ */
875
+
876
+ function _alm_cache_publish_callback() {
877
+
878
+ $options = get_option( 'alm_settings' );
879
+
880
+ if(!isset($options['_alm_cache_publish']))
881
+ $options['_alm_cache_publish'] = '0';
882
+
883
+ $html = '<input type="hidden" name="alm_settings[_alm_cache_publish]" value="0" /><input type="checkbox" id="alm_cache_publish" name="alm_settings[_alm_cache_publish]" value="1"'. (($options['_alm_cache_publish']) ? ' checked="checked"' : '') .' />';
884
+ $html .= '<label for="alm_cache_publish">'.__('Delete cache when new posts are published.', ALM_NAME);
885
+ $html .= '<span style="display:block">'.__('Cache will be fully cleared whenever a post, page or Custom Post Type is published or updated.', ALM_NAME).'</span>';
886
+ $html .=' </label>';
887
+
888
+
889
+ echo $html;
890
+
891
+ }
892
+
893
+
894
+
895
+ /*
896
+ * _alm_cache_known_users_callback
897
+ * Don't cache files for known users
898
+ *
899
+ * @since 2.6.0
900
+ */
901
+
902
+ function _alm_cache_known_users_callback() {
903
+
904
+ $options = get_option( 'alm_settings' );
905
+
906
+ if(!isset($options['_alm_cache_known_users']))
907
+ $options['_alm_cache_known_users'] = '0';
908
+
909
+ $html = '<input type="hidden" name="alm_settings[_alm_cache_known_users]" value="0" /><input type="checkbox" id="alm_cache_known_users" name="alm_settings[_alm_cache_known_users]" value="1"'. (($options['_alm_cache_known_users']) ? ' checked="checked"' : '') .' />';
910
+ $html .= '<label for="alm_cache_known_users">'.__('Don\'t cache files for logged in users.', ALM_NAME);
911
+ $html .= '<span style="display:block">'.__('Logged in users will retrieve content directly from the database and will not view any cached content.', ALM_NAME).'</span>';
912
+ $html .=' </label>';
913
+
914
+ echo $html;
915
+
916
+ }
917
+
918
+
919
 
920
  /*
921
  * alm_seo_settings_callback
999
 
1000
 
1001
  echo '<label for="alm_settings[_alm_seo_speed]">'.__('Set the scrolling speed of the page in milliseconds. <br/><span>e.g. 1 second = 1000</span>', ALM_NAME).'</label><br/><input type="number" class="sm" id="alm_settings[_alm_seo_speed]" name="alm_settings[_alm_seo_speed]" step="50" min="0" value="'.$options['_alm_seo_speed'].'" placeholder="1000" /> ';
1002
+
1003
+ }
1004
+
1005
+
1006
+
1007
+ /*
1008
+ * _alm_seo_scrolltop_callback
1009
+ * Set the scrlltop value of window scrolling
1010
+ *
1011
+ * @since 2.6.0
1012
+ */
1013
+
1014
+ function _alm_seo_scrolltop_callback() {
1015
+
1016
+ $options = get_option( 'alm_settings' );
1017
+
1018
+ if(!isset($options['_alm_seo_scrolltop']))
1019
+ $options['_alm_seo_scrolltop'] = '30';
1020
+
1021
+
1022
+ echo '<label for="alm_settings[_alm_seo_scrolltop]">'.__('Set the scrolltop position of the window when scrolling to post.', ALM_NAME).'</label><br/><input type="number" class="sm" id="alm_settings[_alm_seo_scrolltop]" name="alm_settings[_alm_seo_scrolltop]" step="1" min="0" value="'.$options['_alm_seo_scrolltop'].'" placeholder="30" /> ';
1023
 
1024
  ?>
1025
  <script>
1026
  // Check if Scroll to Page != true
1027
  if(!jQuery('input#alm_scroll_page').is(":checked")){
1028
  jQuery('input#alm_scroll_page').parent().parent('tr').next('tr').hide();
1029
+ jQuery('input#alm_scroll_page').parent().parent('tr').next('tr').next('tr').hide();
1030
  }
1031
  jQuery('input#alm_scroll_page').change(function() {
1032
  var el = jQuery(this);
1033
  if(el.is(":checked")) {
1034
  el.parent().parent('tr').next('tr').show();
1035
+ el.parent().parent('tr').next('tr').next('tr').show();
1036
  }else{
1037
  el.parent().parent('tr').next('tr').hide();
1038
+ el.parent().parent('tr').next('tr').next('tr').hide();
1039
  }
1040
  });
1041
 
admin/css/admin.css CHANGED
@@ -17,6 +17,11 @@
17
  font-family: 'Open Sans', sans-serif;
18
  max-width: 1100px;
19
  }
 
 
 
 
 
20
 
21
  .ajax-load-more *{
22
  -webkit-box-sizing: border-box;
@@ -545,7 +550,8 @@
545
  line-height: normal !important;
546
  }
547
 
548
- .preload_amount{
 
549
  display: none;
550
  }
551
 
@@ -868,9 +874,18 @@
868
  margin: 0 0 20px;
869
  border-bottom: 1px solid #efefef;
870
  }
871
- .ajax-load-more p.desc{
 
872
  font-size: 12px !important;
873
- padding: 0 0 8px 30px;
 
 
 
 
 
 
 
 
874
  }
875
 
876
  .ajax-load-more p.back2top{
@@ -1047,7 +1062,7 @@ table.highlight{
1047
  #alm-add-ons .group .section-title p{
1048
  padding-left: 0 !important;
1049
  }
1050
- #alm-add-ons .group a.btn{
1051
  position: absolute;
1052
  bottom: 20px;
1053
  right: 20px;
@@ -1074,7 +1089,7 @@ table.highlight{
1074
  width: calc(100% - 20px);
1075
  margin: 10px;
1076
  }
1077
- .call-out .btn{
1078
  padding: 5px 8px;
1079
  display: inline-block;
1080
  background: #fff;
@@ -1094,7 +1109,7 @@ table.highlight{
1094
  .call-out a:hover{
1095
  color: #222 !important;
1096
  }
1097
- a.btn{
1098
  padding: 6px 10px;
1099
  display: inline-block;
1100
  background: #73d3b9;
@@ -1107,36 +1122,36 @@ table.highlight{
1107
  font-size: 13px;
1108
  font-weight: 600;
1109
  }
1110
- a.btn:hover,
1111
- a.btn:hover i{
1112
  background-color: #935eaf;
1113
  border-color: #935eaf;
1114
  color:#fff !important;
1115
  box-shadow: none;
1116
  }
1117
- a.btn:active{
1118
  background-color: #83519d;
1119
  border-color: #935eaf;
1120
  color:#fff !important;
1121
  box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.1);
1122
  outline: none;
1123
  }
1124
- a.btn i{
1125
  color: #397666;
1126
  margin-right: 3px;
1127
  position: relative;
1128
  top:1px;
1129
  background: none !important;
1130
  }
1131
- a.btn.installed{
1132
  background: #efefef !important;
1133
  border-color: #ccc !important;
1134
  color:#666 !important;
1135
  cursor: default;
1136
  box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.1) !important;
1137
  }
1138
- a.btn.installed i,
1139
- a.btn.installed:hover i{
1140
  background: none !important;
1141
  color: #5da592 !important;
1142
  top: 0;
@@ -1334,13 +1349,6 @@ table.highlight{
1334
  -moz-transition: background-color 0.3s ease;
1335
  transition: background-color 0.3s ease;
1336
  }
1337
- .repeaters .row:hover,
1338
- .shortcode-builder .row:hover{
1339
- /*
1340
- box-shadow: 0 0 0 3px #efefef;
1341
- border-color: #ccc;
1342
- */
1343
- }
1344
  .repeaters .row.no-brd:hover,
1345
  .shortcode-builder .row.no-brd:hover{
1346
  box-shadow: none;
@@ -1507,6 +1515,223 @@ box-shadow: 0 0 0 3px #efefef;
1507
  }
1508
 
1509
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1510
  /*
1511
  * Form Replacements
1512
  *
@@ -1777,7 +2002,7 @@ box-shadow: 0 0 0 3px #efefef;
1777
  .ajax-load-more input[type=number],
1778
  .select2-container,
1779
  #alm-builder .select2-container-multi{
1780
- width: 100% !important;;
1781
  }
1782
  .ajax-load-more .row .wrap .inner.half {
1783
  display: block;
17
  font-family: 'Open Sans', sans-serif;
18
  max-width: 1100px;
19
  }
20
+ .ajax-load-more a:focus{
21
+ -webkit-box-shadow: none;
22
+ -moz-box-shadow: none;
23
+ box-shadow: none;
24
+ }
25
 
26
  .ajax-load-more *{
27
  -webkit-box-sizing: border-box;
550
  line-height: normal !important;
551
  }
552
 
553
+ .preload_amount,
554
+ .cache_id{
555
  display: none;
556
  }
557
 
874
  margin: 0 0 20px;
875
  border-bottom: 1px solid #efefef;
876
  }
877
+ .ajax-load-more p.desc,
878
+ .ajax-load-more p.writeable-title{
879
  font-size: 12px !important;
880
+ padding: 0 0 5px 28px;
881
+ }
882
+ .ajax-load-more p.writeable-title{
883
+ position: relative;
884
+ }
885
+ .ajax-load-more p.writeable-title i{
886
+ position: absolute !important;
887
+ left: 0 !important;
888
+ top:0 !important;
889
  }
890
 
891
  .ajax-load-more p.back2top{
1062
  #alm-add-ons .group .section-title p{
1063
  padding-left: 0 !important;
1064
  }
1065
+ #alm-add-ons .group a.cnkt-button{
1066
  position: absolute;
1067
  bottom: 20px;
1068
  right: 20px;
1089
  width: calc(100% - 20px);
1090
  margin: 10px;
1091
  }
1092
+ .call-out .cnkt-button{
1093
  padding: 5px 8px;
1094
  display: inline-block;
1095
  background: #fff;
1109
  .call-out a:hover{
1110
  color: #222 !important;
1111
  }
1112
+ a.cnkt-button{
1113
  padding: 6px 10px;
1114
  display: inline-block;
1115
  background: #73d3b9;
1122
  font-size: 13px;
1123
  font-weight: 600;
1124
  }
1125
+ a.cnkt-button:hover,
1126
+ a.cnkt-button:hover i{
1127
  background-color: #935eaf;
1128
  border-color: #935eaf;
1129
  color:#fff !important;
1130
  box-shadow: none;
1131
  }
1132
+ a.cnkt-button:active{
1133
  background-color: #83519d;
1134
  border-color: #935eaf;
1135
  color:#fff !important;
1136
  box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.1);
1137
  outline: none;
1138
  }
1139
+ a.cnkt-button i{
1140
  color: #397666;
1141
  margin-right: 3px;
1142
  position: relative;
1143
  top:1px;
1144
  background: none !important;
1145
  }
1146
+ a.cnkt-button.installed{
1147
  background: #efefef !important;
1148
  border-color: #ccc !important;
1149
  color:#666 !important;
1150
  cursor: default;
1151
  box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.1) !important;
1152
  }
1153
+ a.cnkt-button.installed i,
1154
+ a.cnkt-button.installed:hover i{
1155
  background: none !important;
1156
  color: #5da592 !important;
1157
  top: 0;
1349
  -moz-transition: background-color 0.3s ease;
1350
  transition: background-color 0.3s ease;
1351
  }
 
 
 
 
 
 
 
1352
  .repeaters .row.no-brd:hover,
1353
  .shortcode-builder .row.no-brd:hover{
1354
  box-shadow: none;
1515
  }
1516
 
1517
 
1518
+ /*
1519
+ * Cache
1520
+ *
1521
+ * @since 2.6.0
1522
+ */
1523
+
1524
+
1525
+ .generate-cache-id{
1526
+ margin: 10px 0 0 !important;
1527
+ font-size: 12px !important;
1528
+ }
1529
+ .generate-cache-id i{
1530
+ margin: 0 5px 0 0;
1531
+ }
1532
+
1533
+ /* Live Search */
1534
+
1535
+ .alm-cache-search-wrap{
1536
+ position: relative;
1537
+ display: block;
1538
+ margin: -5px 0 25px;
1539
+ }
1540
+ .alm-cache-search-wrap input{
1541
+ width: 100% !important;
1542
+ margin: 0 !important;
1543
+ display: block;
1544
+ }
1545
+ .alm-cache-search-wrap i{
1546
+ position: absolute;
1547
+ right: 10px;
1548
+ top:10px;
1549
+ color: #ccc;
1550
+ font-size: 20px;
1551
+ z-index: 1;
1552
+ }
1553
+
1554
+ /* Directory Listing */
1555
+
1556
+ .alm-dir-listing{
1557
+ border: 1px solid #efefef;
1558
+ padding: 0;
1559
+ margin: 10px 0;
1560
+ }
1561
+ .alm-dir-listing.deleting{
1562
+ opacity: 0.5;
1563
+ background: #fff url(../img/loader-unlimited.gif) no-repeat center center;
1564
+ }
1565
+
1566
+ .alm-dir-listing .dir-title{
1567
+ margin: 0 0 5px;
1568
+ position: relative;
1569
+ }
1570
+ .ajax-load-more .alm-dir-listing h3.heading{
1571
+ padding-left: 40px !important;
1572
+ }
1573
+ .ajax-load-more .alm-dir-listing h3.heading:after {
1574
+ content: "\f07c";
1575
+ }
1576
+ .ajax-load-more .alm-dir-listing h3.heading.open:after {
1577
+ content: "\f07b";
1578
+ }
1579
+ .alm-dir-listing .dir-title .delete{
1580
+ position: absolute;
1581
+ right:8px;
1582
+ top:7px;
1583
+ font-size: 13px;
1584
+ text-decoration: none;
1585
+ padding: 5px 10px;
1586
+ border: 1px solid #efefef;
1587
+ color: #ccc;
1588
+ -webkit-border-radius: 2px;
1589
+ -moz-border-radius: 2px;
1590
+ border-radius: 2px;
1591
+ }
1592
+ .alm-dir-listing:hover .dir-title .delete{
1593
+ border-color: #ccc;
1594
+ color: #666;
1595
+ }
1596
+ .alm-dir-listing .dir-title .delete:hover{
1597
+ background-color: #c94141;
1598
+ border-color: #c94141;
1599
+ color: #fff;
1600
+ -webkit-box-shadow: 0 0 3px #ccc;
1601
+ -moz-box-shadow: 0 0 3px #ccc;
1602
+ box-shadow: 0 0 3px #ccc;
1603
+ }
1604
+ .alm-dir-listing .dir-title .delete:active{
1605
+ -webkit-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2);
1606
+ -moz-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2);
1607
+ box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.2);
1608
+ }
1609
+ .alm-dir-listing ul{
1610
+ padding: 10px;
1611
+ margin: 0;
1612
+ border: 1px solid #efefef;
1613
+ }
1614
+ .alm-dir-listing ul li{
1615
+ margin: 0 -2px;
1616
+ padding: 7px 0 7px 40px;
1617
+ display: inline-block;
1618
+ vertical-align: top;
1619
+ overflow: hidden;
1620
+ width: 47%;
1621
+ font-size: 13px;
1622
+ background: transparent url(../img/directory-list.gif) no-repeat left center;
1623
+ }
1624
+ .alm-dir-listing ul li:last-child,
1625
+ .alm-dir-listing ul li:nth-last-child(2){
1626
+ background-image: url(../img/directory-list-btm.gif);
1627
+ }
1628
+ .alm-dir-listing ul li a{
1629
+ text-decoration: none;
1630
+ }
1631
+ .alm-dir-listing li i{
1632
+ color: #999;
1633
+ padding: 0 5px 0 0;
1634
+ }
1635
+
1636
+ .cache-page-title{
1637
+ font-size: 13px;
1638
+ display: block;
1639
+ width: 100%;
1640
+ padding: 0 0 10px 12px;
1641
+ font-weight: 600;
1642
+ }
1643
+
1644
+ .cache-page-wrap{
1645
+ padding: 0 15px 15px;
1646
+ }
1647
+
1648
+ .alm-dir-listing ul.cache-details{
1649
+ display: block;
1650
+ padding: 6px 10px 12px;
1651
+ margin: 0;
1652
+ border: none;
1653
+ }
1654
+ .alm-dir-listing ul.cache-details li{
1655
+ display: block;
1656
+ width: 100%;
1657
+ background: none;
1658
+ padding: 6px 4px 6px;
1659
+ color: #333;
1660
+ }
1661
+ .alm-dir-listing ul.cache-details li i{
1662
+ color: #ccc;
1663
+ font-size: 18px;
1664
+ position: relative;
1665
+ top:1px;
1666
+ }
1667
+
1668
+
1669
+
1670
+ .dir-empty,
1671
+ .cache-cleared{
1672
+ background-color: #fefeed;
1673
+ border: 1px solid #efefef;
1674
+ padding: 10px;
1675
+ display: block;
1676
+ color: #222;
1677
+ }
1678
+ .cache-cleared{
1679
+ margin: 0 0 20px;
1680
+ background-color: #e0f5ff;
1681
+ border-color: #bad0da;
1682
+ color: #666;
1683
+ }
1684
+ .cache-cleared i{
1685
+ color: #111;
1686
+ margin: 0 5px 0 0;
1687
+ }
1688
+
1689
+ .cache-cleared .remove{
1690
+ float: right;
1691
+ font-size: 12px;
1692
+ font-weight: 600;
1693
+ }
1694
+
1695
+
1696
+ p.cache-stats{
1697
+ height: 44px;
1698
+ line-height: 37px;
1699
+ margin: 0;
1700
+ display: block;
1701
+ }
1702
+ p.cache-stats.last{
1703
+ height: 52px;
1704
+ padding-bottom: 16px;
1705
+ border-bottom: 1px solid #efefef;
1706
+ }
1707
+ p.cache-stats span{
1708
+ display: inline-block;
1709
+ width: 38px;
1710
+ height: 38px;
1711
+ line-height: 36px;
1712
+ text-align: center;
1713
+ margin: 0 9px 0 0;
1714
+ font-weight: 700;
1715
+ font-size: 15px;
1716
+ -webkit-border-radius: 2px;
1717
+ -moz-border-radius:2px;
1718
+ border-radius: 2px;
1719
+ background: #a4a5e2;
1720
+ background: -moz-linear-gradient(top, #a4a5e2 0%, #9ea0d9 50%, #8d8fce 51%, #a4a5e2 100%);
1721
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a4a5e2), color-stop(50%,#9ea0d9), color-stop(51%,#8d8fce), color-stop(100%,#a4a5e2));
1722
+ background: -webkit-linear-gradient(top, #a4a5e2 0%,#9ea0d9 50%,#8d8fce 51%,#a4a5e2 100%);
1723
+ background: -o-linear-gradient(top, #a4a5e2 0%,#9ea0d9 50%,#8d8fce 51%,#a4a5e2 100%);
1724
+ background: -ms-linear-gradient(top, #a4a5e2 0%,#9ea0d9 50%,#8d8fce 51%,#a4a5e2 100%);
1725
+ background: linear-gradient(to bottom, #a4a5e2 0%,#9ea0d9 50%,#8d8fce 51%,#a4a5e2 100%);
1726
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a4a5e2', endColorstr='#a4a5e2',GradientType=0 );
1727
+
1728
+ border: 1px solid #8586be;
1729
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
1730
+ color: #fff;
1731
+ text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.1);
1732
+ }
1733
+
1734
+
1735
  /*
1736
  * Form Replacements
1737
  *
2002
  .ajax-load-more input[type=number],
2003
  .select2-container,
2004
  #alm-builder .select2-container-multi{
2005
+ width: 100% !important;
2006
  }
2007
  .ajax-load-more .row .wrap .inner.half {
2008
  display: block;
admin/img/add-ons/cache-add-ons.jpg ADDED
Binary file
admin/img/directory-list-btm.gif ADDED
Binary file
admin/img/directory-list.gif ADDED
Binary file
admin/includes/components/repeater-options.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="btn alm-repeater-options">
2
  <a href="javascript:void(0);" class="target"><i class="fa fa-cog"></i> <?php _e('Options', ALM_NAME); ?></a>
3
  <div class="alm-dropdown">
4
  <div class="alm-drop-inner">
1
+ <div class="alm-drop-btn alm-repeater-options">
2
  <a href="javascript:void(0);" class="target"><i class="fa fa-cog"></i> <?php _e('Options', ALM_NAME); ?></a>
3
  <div class="alm-dropdown">
4
  <div class="alm-drop-inner">
admin/includes/cta/extend.php CHANGED
@@ -1 +1 @@
1
- <div class="clear"></div><div class="call-out"><?php _e('Unlock additional templates with the <a href="?page=ajax-load-more-add-ons" target="_parent">Custom Repeaters add-on</a>', ALM_NAME); ?> <a class="btn" href="http://connekthq.com/plugins/ajax-load-more/custom-repeaters" target="_blank"><?php _e('More Info', ALM_NAME); ?></a></div>
1
+ <div class="clear"></div><div class="call-out"><?php _e('Unlock additional templates with the <a href="?page=ajax-load-more-add-ons" target="_parent">Custom Repeaters add-on</a>', ALM_NAME); ?> <a class="cnkt-button" href="http://connekthq.com/plugins/ajax-load-more/custom-repeaters" target="_blank"><?php _e('More Info', ALM_NAME); ?></a></div>
admin/includes/cta/writeable.php CHANGED
@@ -7,11 +7,11 @@
7
  $alm_file = ALM_PATH .'core/repeater/default.php'; // Default ALM repeater
8
  if(file_exists($alm_file)){
9
  if (is_writable($alm_file))
10
- echo __('<p><i class="fa fa-check"></i><strong>Ajax Load More</strong></p><p class="desc">Yay! Read/Write access is enabled within the /ajax-load-more/ directory.', ALM_NAME);
11
  else
12
- echo __('<p><i class="fa fa-exclamation"></i><strong>Ajax Load More</strong></p>Access Denied! You must enable read and write access for Ajax Load More directory (/ajax-load-more/core/repeater/) in order to save repeater template data.<br/><br/>Please contact your hosting provider or site administrator for more information.', ALM_NAME);
13
  }else{
14
- echo __('<p><i class="fa fa-exclamation"></i><strong>Ajax Load More</strong></p><p class="desc">Unable to locate configuration file. Directory access may not be granted.', ALM_NAME);
15
  }
16
  ?>
17
 
@@ -22,11 +22,11 @@
22
  $alm_custom_repeater_file = ALM_REPEATER_PATH. '/repeaters/repeater2.php'; // Test file
23
  if(file_exists($alm_custom_repeater_file)){
24
  if (is_writable($alm_custom_repeater_file))
25
- echo __('<p><i class="fa fa-check"></i><strong>ALM - Custom Repeaters</strong></p><p class="desc">Nice! Read/Write access is enabled within the /ajax-load-more-repeaters/repeaters/ directory.', ALM_NAME);
26
  else
27
- echo __('<p><i class="fa fa-exclamation"></i><strong>ALM Custom Repeaters</strong></p><p class="desc">Access Denied! You must enable read and write access for Ajax Load More Custom Repeaters directory (/ajax-load-more-repeaters/repeaters/) in order to save repeater template data.<br/><br/>Please contact your hosting provider or site administrator for more information.', ALM_NAME);
28
  }else{
29
- echo __('<p><i class="fa fa-exclamation"></i><strong>ALM Custom Repeaters</strong></p><p class="desc">Unable to locate configuration file. Directory access may not be granted.', ALM_NAME);
30
  }
31
  }
32
  ?>
@@ -38,11 +38,11 @@
38
  $alm_unlimited_file = ALM_UNLIMITED_REPEATER_PATH .'_is_writeable.php'; // Test file
39
  if(file_exists($alm_unlimited_file)){
40
  if (is_writable($alm_unlimited_file))
41
- echo __('<p><i class="fa fa-check"></i><strong>ALM - Custom Repeaters v2</strong></p><p class="desc">Oh Ya! Read/Write access is enabled within the /ajax-load-more-repeaters-v2/repeaters/ directory.', ALM_NAME);
42
  else
43
- echo __('<p><i class="fa fa-exclamation"></i><strong>ALM - Custom Repeaters v2</strong></p><p class="desc">Access Denied! You must enable read and write access for Ajax Load More Unlimited directory (/ajax-load-more-repeaters-v2/repeaters/) in order to save repeater template data.<br/><br/>Please contact your hosting provider or site administrator for more information.', ALM_NAME);
44
  }else{
45
- echo __('<p><i class="fa fa-exclamation"></i><strong>ALM Unlimited</strong></p><p class="desc">Unable to locate configuration file. Directory access may not be granted.', ALM_NAME);
46
  }
47
  }
48
  ?>
7
  $alm_file = ALM_PATH .'core/repeater/default.php'; // Default ALM repeater
8
  if(file_exists($alm_file)){
9
  if (is_writable($alm_file))
10
+ echo __('<p class="writeable-title"><i class="fa fa-check"></i><strong>Ajax Load More</strong></p><p class="desc">Yay! Read/Write access is enabled within the /ajax-load-more/ directory.', ALM_NAME);
11
  else
12
+ echo __('<p class="writeable-title"><i class="fa fa-exclamation"></i><strong>Ajax Load More</strong></p>Access Denied! You must enable read and write access for Ajax Load More directory (/ajax-load-more/core/repeater/) in order to save repeater template data.<br/><br/>Please contact your hosting provider or site administrator for more information.', ALM_NAME);
13
  }else{
14
+ echo __('<p class="writeable-title"><i class="fa fa-exclamation"></i><strong>Ajax Load More</strong></p><p class="desc">Unable to locate configuration file. Directory access may not be granted.', ALM_NAME);
15
  }
16
  ?>
17
 
22
  $alm_custom_repeater_file = ALM_REPEATER_PATH. '/repeaters/repeater2.php'; // Test file
23
  if(file_exists($alm_custom_repeater_file)){
24
  if (is_writable($alm_custom_repeater_file))
25
+ echo __('<p class="writeable-title"><i class="fa fa-check"></i><strong>ALM - Custom Repeaters</strong></p><p class="desc">Nice! Read/Write access is enabled within the /ajax-load-more-repeaters/repeaters/ directory.', ALM_NAME);
26
  else
27
+ echo __('<p class="writeable-title"><i class="fa fa-exclamation"></i><strong>ALM Custom Repeaters</strong></p><p class="desc">Access Denied! You must enable read and write access for Ajax Load More Custom Repeaters directory (/ajax-load-more-repeaters/repeaters/) in order to save repeater template data.<br/><br/>Please contact your hosting provider or site administrator for more information.', ALM_NAME);
28
  }else{
29
+ echo __('<p class="writeable-title"><i class="fa fa-exclamation"></i><strong>ALM Custom Repeaters</strong></p><p class="desc">Unable to locate configuration file. Directory access may not be granted.', ALM_NAME);
30
  }
31
  }
32
  ?>
38
  $alm_unlimited_file = ALM_UNLIMITED_REPEATER_PATH .'_is_writeable.php'; // Test file
39
  if(file_exists($alm_unlimited_file)){
40
  if (is_writable($alm_unlimited_file))
41
+ echo __('<p class="writeable-title"><i class="fa fa-check"></i><strong>ALM - Custom Repeaters v2</strong></p><p class="desc">Oh Ya! Read/Write access is enabled within the /ajax-load-more-repeaters-v2/repeaters/ directory.', ALM_NAME);
42
  else
43
+ echo __('<p class="writeable-title"><i class="fa fa-exclamation"></i><strong>ALM - Custom Repeaters v2</strong></p><p class="desc">Access Denied! You must enable read and write access for Ajax Load More Unlimited directory (/ajax-load-more-repeaters-v2/repeaters/) in order to save repeater template data.<br/><br/>Please contact your hosting provider or site administrator for more information.', ALM_NAME);
44
  }else{
45
+ echo __('<p class="writeable-title"><i class="fa fa-exclamation"></i><strong>ALM Unlimited</strong></p><p class="desc">Unable to locate configuration file. Directory access may not be granted.', ALM_NAME);
46
  }
47
  }
48
  ?>
admin/js/libs/jquery.drops.js CHANGED
@@ -38,7 +38,7 @@ jQuery(document).ready(function($) {
38
 
39
  //Dropdown links
40
  $('.alm-dropdown').each(function(i){
41
- var el = $(this).parent('.btn');
42
  $('> a', el).click(function(e){
43
  var e = $(this);
44
  drops.dropdown(e);
38
 
39
  //Dropdown links
40
  $('.alm-dropdown').each(function(i){
41
+ var el = $(this).parent('.alm-drop-btn');
42
  $('> a', el).click(function(e){
43
  var e = $(this);
44
  drops.dropdown(e);
admin/shortcode-builder/js/shortcode-builder.js CHANGED
@@ -25,6 +25,9 @@ jQuery(document).ready(function($) {
25
  });
26
  $('.ajax-load-more .tags select.multiple').select2({
27
  placeholder : 'Select Tags'
 
 
 
28
  });
29
  };
30
  _alm.select2();
@@ -55,31 +58,52 @@ jQuery(document).ready(function($) {
55
 
56
 
57
  // ---------------------------
58
- // - Preload
59
  // ---------------------------
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  var preload = $('.preload input[name=preload]:checked').val();
62
  if(preload !== 'false' && preload != undefined){
63
- $('.preload_amount').slideDown(100, 'alm_easeInOutQuad');
 
 
 
64
  output += ' preloaded="'+preload+'"';
65
  var preload_amount = $('.preload input#preload-amount').val();
66
  if(preload_amount > 0 && preload_amount != 5)
67
  output += ' preloaded_amount="'+preload_amount+'"';
68
  }else{
69
- $('.preload_amount').slideUp(100, 'alm_easeInOutQuad')
70
  }
71
 
72
 
73
  // ---------------------------
74
  // - SEO
75
- // ---------------------------
76
-
77
- var seo = $('.seo input[name=seo]:checked').val();
78
  if(seo !== 'false' && seo != undefined){
79
  if(preload === 'true')
80
- alert("Sorry, at this time Preloaded and SEO can not be used together. Sorry for any inconvenience this may cause.");
81
- else
82
- output += ' seo="'+seo+'"';
83
  }
84
 
85
  // ---------------------------
@@ -321,14 +345,17 @@ jQuery(document).ready(function($) {
321
 
322
  var scroll_load = $('.scroll_load input[name=scroll]:checked').val();
323
  if(scroll_load === 'f'){
324
- $('.max_pages').slideUp(100, 'alm_easeInOutQuad');
325
  if($('.scroll_load input').hasClass('changed'))
326
  output += ' scroll="false"';
327
  }else{
328
- $('.max_pages').slideDown(100, 'alm_easeInOutQuad');
329
- var max_pages = $('.max_pages input').val();
 
 
 
330
  if(max_pages != 5)
331
- output += ' max_pages="'+$('.max_pages input').val()+'"';
332
  }
333
 
334
 
@@ -578,6 +605,33 @@ jQuery(document).ready(function($) {
578
  _alm.buildShortcode();
579
  });
580
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
 
582
 
583
  });
25
  });
26
  $('.ajax-load-more .tags select.multiple').select2({
27
  placeholder : 'Select Tags'
28
+ });
29
+ $('.ajax-load-more.settings select.multiple.post-types').select2({
30
+ placeholder : 'Select Post Types'
31
  });
32
  };
33
  _alm.select2();
58
 
59
 
60
  // ---------------------------
61
+ // - Cache
62
  // ---------------------------
63
 
64
+ var cache = $('#alm-cache input[name=cache]:checked').val();
65
+ if(cache !== 'false' && cache != undefined){
66
+ if($('input#cache-id').val() === '')
67
+ _alm.generateUniqueID(10); // Generate unique ID on first load
68
+
69
+ $('.cache_id').slideDown(100, 'alm_easeInOutQuad');
70
+ output += ' cache="'+cache+'"';
71
+ var cache_id = $('input#cache-id').val();
72
+ if(cache_id)
73
+ output += ' cache_id="'+cache_id+'"';
74
+ }else{
75
+ $('.cache_id').slideUp(100, 'alm_easeInOutQuad')
76
+ }
77
+
78
+
79
+ // ---------------------------
80
+ // - Preload
81
+ // ---------------------------
82
+ var seo = $('.seo input[name=seo]:checked').val();
83
  var preload = $('.preload input[name=preload]:checked').val();
84
  if(preload !== 'false' && preload != undefined){
85
+
86
+ if(seo !== 'true')
87
+ $('.preload_amount').slideDown(100, 'alm_easeInOutQuad');
88
+
89
  output += ' preloaded="'+preload+'"';
90
  var preload_amount = $('.preload input#preload-amount').val();
91
  if(preload_amount > 0 && preload_amount != 5)
92
  output += ' preloaded_amount="'+preload_amount+'"';
93
  }else{
94
+ $('.preload_amount').slideUp(100, 'alm_easeInOutQuad');
95
  }
96
 
97
 
98
  // ---------------------------
99
  // - SEO
100
+ // ---------------------------
101
+
 
102
  if(seo !== 'false' && seo != undefined){
103
  if(preload === 'true')
104
+ $('.preload_amount').slideUp(100, 'alm_easeInOutQuad');
105
+
106
+ output += ' seo="'+seo+'"';
107
  }
108
 
109
  // ---------------------------
345
 
346
  var scroll_load = $('.scroll_load input[name=scroll]:checked').val();
347
  if(scroll_load === 'f'){
348
+ $('.max_pages, .scroll_distance').slideUp(100, 'alm_easeInOutQuad');
349
  if($('.scroll_load input').hasClass('changed'))
350
  output += ' scroll="false"';
351
  }else{
352
+ $('.max_pages, .scroll_distance').slideDown(100, 'alm_easeInOutQuad');
353
+ var scroll_distance = $('.scroll_distance input').val();
354
+ if(scroll_distance != 150)
355
+ output += ' scroll_distance="'+$('.scroll_distance input').val()+'"';
356
+ var max_pages = $('.max_pages input').val();
357
  if(max_pages != 5)
358
+ output += ' max_pages="'+$('.max_pages input').val()+'"';
359
  }
360
 
361
 
605
  _alm.buildShortcode();
606
  });
607
 
608
+
609
+
610
+ /*
611
+ * _alm.generateUniqueID
612
+ * Generate Unique Cache ID
613
+ *
614
+ * @since 2.6.0
615
+ */
616
+
617
+ _alm.generateUniqueID = function(length) {
618
+ var id = Math.floor(Math.pow(10, length-1) + Math.random() * 9 * Math.pow(10, length-1));
619
+ $('#cache-id').val(id);
620
+
621
+ }
622
+
623
+
624
+
625
+ /*
626
+ * Generate Unique Cache ID Click
627
+ *
628
+ * @since 2.6.0
629
+ */
630
+
631
+ $(document).on('click', '.generate-cache-id', function(){
632
+ _alm.generateUniqueID(10);
633
+ });
634
+
635
 
636
 
637
  });
admin/shortcode-builder/shortcode-builder.php CHANGED
@@ -8,6 +8,51 @@
8
  $disable_dynamic_content = $alm_options['_alm_disable_dynamic'];
9
  ?>
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <?php if(has_action('alm_preload_installed')){ ?>
12
  <!-- PRELOAD -->
13
  <div class="row input preload add-on" id="alm-preload">
@@ -24,7 +69,7 @@
24
  <label for="preload-true"><?php _e('True', ALM_NAME); ?></label>
25
  </li>
26
  <li>
27
- <input class="alm_element" type="radio" name="preload" value="false" id="preload-false" checked>
28
  <label for="preload-false"><?php _e('False', ALM_NAME); ?></label>
29
  </li>
30
  </ul>
@@ -42,10 +87,7 @@
42
  <div class="inner">
43
  <input type="number" class="alm_element numbers-only" name="preload-amount" id="preload-amount" step="1" min="1" value="5">
44
  </div>
45
- </div>
46
- <?php if(has_action('alm_seo_installed')){ ?>
47
- <!-- <p class="warning-callout">If using <strong>Preload</strong> and <strong>SEO</strong> together, the value of <strong>preload_amount</strong> will be determined by the value set within the <strong>posts_per_page</strong> parameter.</p> -->
48
- <?php } ?>
49
  </div>
50
  </div>
51
  </div>
@@ -68,15 +110,12 @@
68
  <label for="seo-true"><?php _e('True', ALM_NAME); ?></label>
69
  </li>
70
  <li>
71
- <input class="alm_element" type="radio" name="seo" value="false" id="seo-false" checked>
72
  <label for="seo-false"><?php _e('False', ALM_NAME); ?></label>
73
  </li>
74
  </ul>
75
  </div>
76
  </div>
77
- <?php if(has_action('alm_preload_installed')){ ?>
78
- <p class="warning-callout"><?php _e('At this time it is not possible to use <strong>preloaded</strong> and <strong>SEO</strong> together - We are still working out the kinks but you can expect a fix to be released shortly.', ALM_NAME); ?></p>
79
- <?php } ?>
80
  </div>
81
  </div>
82
  <?php } ?>
@@ -125,7 +164,7 @@
125
  echo '<p>'.__('Select Post Types to query.', ALM_NAME). '</p>';
126
  echo '</div>';
127
  echo '<div class="wrap"><div class="inner"><ul>';
128
- foreach( $types as $type ){
129
  $typeobj = get_post_type_object( $type );
130
  $name = $typeobj->name;
131
  if( $name != 'revision' && $name != 'attachment' && $name != 'nav_menu_item' && $name != 'acf'){
@@ -537,7 +576,7 @@
537
  </div>
538
  <div class="wrap">
539
  <div class="inner">
540
- <input type="number" class="alm_element numbers-only" name="display_posts-select" id="display_posts-select" step="1" min="0" value="5">
541
  </div>
542
  </div>
543
  </div>
@@ -590,6 +629,19 @@
590
  </div>
591
  </div>
592
  <div class="clear"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  <div class="max_pages">
594
  <div class="clear"></div>
595
  <hr>
@@ -602,7 +654,7 @@
602
  <input type="number" class="alm_element numbers-only" name="max-select" id="max-select" step="1" min="0" value="5">
603
  </div>
604
  </div>
605
- </div>
606
  </div>
607
  </div>
608
 
8
  $disable_dynamic_content = $alm_options['_alm_disable_dynamic'];
9
  ?>
10
 
11
+
12
+
13
+ <?php if(has_action('alm_cache_installed')){ ?>
14
+ <!-- CACHE -->
15
+ <div class="row input cache add-on" id="alm-cache">
16
+ <h3 class="heading"><?php _e('Cache', ALM_NAME); ?></h3>
17
+ <div class="expand-wrap">
18
+ <div class="section-title">
19
+ <h4>Enable Caching</h4>
20
+ <p><?php _e('Turn on content caching for this Ajax Load More query.', ALM_NAME); ?></p>
21
+ </div>
22
+ <div class="wrap">
23
+ <div class="inner">
24
+ <ul>
25
+ <li>
26
+ <input class="alm_element" type="radio" name="cache" value="true" id="cache-true" >
27
+ <label for="cache-true"><?php _e('True', ALM_NAME); ?></label>
28
+ </li>
29
+ <li>
30
+ <input class="alm_element" type="radio" name="cache" value="false" id="cache-false" checked="checked">
31
+ <label for="cache-false"><?php _e('False', ALM_NAME); ?></label>
32
+ </li>
33
+ </ul>
34
+ </div>
35
+ </div>
36
+ <div class="clear"></div>
37
+ <div class="cache_id">
38
+ <div class="clear"></div>
39
+ <hr>
40
+ <div class="section-title">
41
+ <h4>Cache ID</h4>
42
+ <p><?php _e('You <u>must</u> generate a unique ID for this cached query - this unique ID will be used as a content identifier.', ALM_NAME); ?></p>
43
+ </div>
44
+ <div class="wrap">
45
+ <div class="inner">
46
+ <input type="text" class="alm_element disabled" name="cache-id" id="cache-id" disabled="disabled">
47
+ <div class="clear"></div>
48
+ <p class="generate-cache-id"><a href="javascript:void(0);"><i class="fa fa-random"></i> <?php _e('Generate New ID', ALM_NAME); ?></a></p>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <?php } ?>
55
+
56
  <?php if(has_action('alm_preload_installed')){ ?>
57
  <!-- PRELOAD -->
58
  <div class="row input preload add-on" id="alm-preload">
69
  <label for="preload-true"><?php _e('True', ALM_NAME); ?></label>
70
  </li>
71
  <li>
72
+ <input class="alm_element" type="radio" name="preload" value="false" id="preload-false" checked="checked">
73
  <label for="preload-false"><?php _e('False', ALM_NAME); ?></label>
74
  </li>
75
  </ul>
87
  <div class="inner">
88
  <input type="number" class="alm_element numbers-only" name="preload-amount" id="preload-amount" step="1" min="1" value="5">
89
  </div>
90
+ </div>
 
 
 
91
  </div>
92
  </div>
93
  </div>
110
  <label for="seo-true"><?php _e('True', ALM_NAME); ?></label>
111
  </li>
112
  <li>
113
+ <input class="alm_element" type="radio" name="seo" value="false" id="seo-false" checked="checked">
114
  <label for="seo-false"><?php _e('False', ALM_NAME); ?></label>
115
  </li>
116
  </ul>
117
  </div>
118
  </div>
 
 
 
119
  </div>
120
  </div>
121
  <?php } ?>
164
  echo '<p>'.__('Select Post Types to query.', ALM_NAME). '</p>';
165
  echo '</div>';
166
  echo '<div class="wrap"><div class="inner"><ul>';
167
+ foreach( $types as $type ){
168
  $typeobj = get_post_type_object( $type );
169
  $name = $typeobj->name;
170
  if( $name != 'revision' && $name != 'attachment' && $name != 'nav_menu_item' && $name != 'acf'){
576
  </div>
577
  <div class="wrap">
578
  <div class="inner">
579
+ <input type="number" class="alm_element numbers-only" name="display_posts-select" id="display_posts-select" step="1" min="1" value="5">
580
  </div>
581
  </div>
582
  </div>
629
  </div>
630
  </div>
631
  <div class="clear"></div>
632
+ <div class="scroll_distance">
633
+ <div class="clear"></div>
634
+ <hr>
635
+ <div class="section-title">
636
+ <h4>Scroll Distance</h4>
637
+ <p><?php _e('The distance from the bottom of the screen to trigger the loading of posts while scrolling. (Default = 150)', ALM_NAME); ?></p>
638
+ </div>
639
+ <div class="wrap">
640
+ <div class="inner">
641
+ <input type="number" class="alm_element numbers-only" name="scroll-distance" id="scroll-distance" step="10" min="0" value="150">
642
+ </div>
643
+ </div>
644
+ </div>
645
  <div class="max_pages">
646
  <div class="clear"></div>
647
  <hr>
654
  <input type="number" class="alm_element numbers-only" name="max-select" id="max-select" step="1" min="0" value="5">
655
  </div>
656
  </div>
657
+ </div>
658
  </div>
659
  </div>
660
 
admin/views/add-ons.php CHANGED
@@ -1,10 +1,35 @@
1
  <div class="admin ajax-load-more" id="alm-add-ons">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
- <h2><?php _e('Ajax Load More: Add-ons', ALM_NAME); ?></h2>
5
  <p><?php _e('Add-ons are available to extend and enhance the core functionality of Ajax Load More.', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  <!-- Custom Repeaters -->
10
  <div class="group">
@@ -23,9 +48,9 @@
23
  <?php
24
  $cr_url = 'http://connekthq.com/plugins/ajax-load-more/custom-repeaters/';
25
  if (has_action('alm_unlimited_installed')){
26
- echo '<a class="btn installed" href="'. $cr_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
27
  }else{
28
- echo '<a class="btn" href="'. $cr_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
29
  }
30
  ?>
31
  </div>
@@ -48,9 +73,9 @@
48
  <?php
49
  $cr_url = 'http://connekthq.com/plugins/ajax-load-more/preloaded/';
50
  if (has_action('alm_preload_installed')){
51
- echo '<a class="btn installed" href="'. $cr_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
52
  }else{
53
- echo '<a class="btn" href="'. $cr_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
54
  }
55
  ?>
56
  </div>
@@ -73,9 +98,9 @@
73
  <?php
74
  $seo_url = 'http://connekthq.com/plugins/ajax-load-more/seo/';
75
  if (has_action('alm_seo_installed')){
76
- echo '<a class="btn installed" href="'. $seo_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
77
  }else{
78
- echo '<a class="btn" href="'. $seo_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
79
  }
80
  ?>
81
  </div>
1
  <div class="admin ajax-load-more" id="alm-add-ons">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
+ <h2><?php echo ALM_TITLE; ?>: <strong><?php _e('Add-ons', ALM_NAME); ?></strong></h2>
5
  <p><?php _e('Add-ons are available to extend and enhance the core functionality of Ajax Load More.', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main">
8
+
9
+ <!-- Custom Repeaters -->
10
+ <div class="group">
11
+ <div class="row no-brd">
12
+ <div class="expand-wrap">
13
+ <div class="section-title">
14
+ <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/cache-add-ons.jpg">
15
+ </div>
16
+ <div class="wrap">
17
+ <h2 class="addon-title"><?php _e('Cache', ALM_NAME); ?></h2>
18
+ <p class="addon-intro"><?php _e('Improve your website performance with the Ajax Load More caching engine.', ALM_NAME); ?></p>
19
+ <p><?php _e('The Cache add-on creates static HTML files of Ajax Load More requests then delivers those static files to your visitors.', ALM_NAME); ?></p>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <?php
24
+ $cache_url = 'http://connekthq.com/plugins/ajax-load-more/cache/';
25
+ if (has_action('alm_cache_installed')){
26
+ echo '<a class="cnkt-button installed" href="'. $cache_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
27
+ }else{
28
+ echo '<a class="cnkt-button" href="'. $cache_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
29
+ }
30
+ ?>
31
+ </div>
32
+ <!-- End Custom Repeaters -->
33
 
34
  <!-- Custom Repeaters -->
35
  <div class="group">
48
  <?php
49
  $cr_url = 'http://connekthq.com/plugins/ajax-load-more/custom-repeaters/';
50
  if (has_action('alm_unlimited_installed')){
51
+ echo '<a class="cnkt-button installed" href="'. $cr_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
52
  }else{
53
+ echo '<a class="cnkt-button" href="'. $cr_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
54
  }
55
  ?>
56
  </div>
73
  <?php
74
  $cr_url = 'http://connekthq.com/plugins/ajax-load-more/preloaded/';
75
  if (has_action('alm_preload_installed')){
76
+ echo '<a class="cnkt-button installed" href="'. $cr_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
77
  }else{
78
+ echo '<a class="cnkt-button" href="'. $cr_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
79
  }
80
  ?>
81
  </div>
98
  <?php
99
  $seo_url = 'http://connekthq.com/plugins/ajax-load-more/seo/';
100
  if (has_action('alm_seo_installed')){
101
+ echo '<a class="cnkt-button installed" href="'. $seo_url .'" target="_blank"><i class="fa fa-check-square"></i> Installed</a> ';
102
  }else{
103
+ echo '<a class="cnkt-button" href="'. $seo_url .'" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
104
  }
105
  ?>
106
  </div>
admin/views/examples.php CHANGED
@@ -1,7 +1,7 @@
1
  <div class="admin ajax-load-more" id="alm-examples">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
- <h2><?php _e('Ajax Load More: Examples', ALM_NAME); ?></h2>
5
  <p><?php _e('A collection of everyday shortcode usages and implementation examples', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main forceColors">
1
  <div class="admin ajax-load-more" id="alm-examples">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
+ <h2><?php echo ALM_TITLE; ?>: <strong><?php _e('Examples', ALM_NAME); ?></strong></h2>
5
  <p><?php _e('A collection of everyday shortcode usages and implementation examples', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main forceColors">
admin/views/repeater-templates.php CHANGED
@@ -1,7 +1,7 @@
1
  <div class="admin ajax-load-more" id="alm-repeaters">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
- <h2><?php _e('Ajax Load More: Repeater Templates', ALM_NAME); ?></h2>
5
  <p><?php _e('The library of available templates to use within your theme', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main form-table repeaters">
1
  <div class="admin ajax-load-more" id="alm-repeaters">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
+ <h2><?php echo ALM_TITLE; ?>: <strong><?php _e('Repeater Templates', ALM_NAME); ?></strong></h2>
5
  <p><?php _e('The library of available templates to use within your theme', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main form-table repeaters">
admin/views/shortcode-builder.php CHANGED
@@ -1,7 +1,7 @@
1
  <div class="admin ajax-load-more shortcode-builder" id="alm-builder">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
- <h2><?php _e('Ajax Load More: Shortcode Builder', ALM_NAME); ?></h2>
5
  <p><?php _e('Create your own Ajax Load More <a href="http://en.support.wordpress.com/shortcodes/" target="_blank">shortcode</a> by adjusting the values below', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main">
1
  <div class="admin ajax-load-more shortcode-builder" id="alm-builder">
2
  <div class="wrap">
3
  <div class="header-wrap">
4
+ <h2><?php echo ALM_TITLE; ?>: <strong><?php _e('Shortcode Builder', ALM_NAME); ?></strong></h2>
5
  <p><?php _e('Create your own Ajax Load More <a href="http://en.support.wordpress.com/shortcodes/" target="_blank">shortcode</a> by adjusting the values below', ALM_NAME); ?></p>
6
  </div>
7
  <div class="cnkt-main">
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.5.1
10
  License: GPL
11
  Copyright: Darren Cooney & Connekt Media
12
  */
13
 
14
- define('ALM_VERSION', '2.5.1');
15
- define('ALM_RELEASE', 'February 12, 2015');
16
 
17
  /*
18
  * alm_install
@@ -101,8 +101,8 @@ if( !class_exists('AjaxLoadMore') ):
101
  */
102
 
103
  function alm_action_links( $links ) {
104
- $links[] = '<a href="'. get_admin_url(null, 'admin.php?page=ajax-load-more') .'">Settings</a>';
105
- $links[] = '<a href="'. get_admin_url(null, 'admin.php?page=ajax-load-more-shortcode-builder') .'">Shortcode Builder</a>';
106
  return $links;
107
  }
108
 
@@ -146,6 +146,8 @@ if( !class_exists('AjaxLoadMore') ):
146
  $options = get_option( 'alm_settings' ); //Get plugin options
147
 
148
  extract(shortcode_atts(array(
 
 
149
  'preloaded' => 'false',
150
  'preloaded_amount' => '5',
151
  'seo' => 'false',
@@ -174,11 +176,12 @@ if( !class_exists('AjaxLoadMore') ):
174
  'offset' => '0',
175
  'posts_per_page' => '5',
176
  'scroll' => 'true',
 
177
  'max_pages' => '5',
178
  'pause' => 'false',
179
  'destroy_after' => '',
180
  'transition' => 'slide',
181
- 'button_label' => 'Older Posts',
182
  ), $atts));
183
 
184
  // Get container elements (ul | div)
@@ -207,8 +210,15 @@ if( !class_exists('AjaxLoadMore') ):
207
  if (function_exists('pll_current_language')) // Polylang - https://wordpress.org/plugins/polylang/
208
  $lang = pll_current_language();
209
  if (function_exists('qtrans_getLanguage')) // qTranslate - https://wordpress.org/plugins/qtranslate/
210
- $lang = qtrans_getLanguage();
211
-
 
 
 
 
 
 
 
212
 
213
  // Start ALM object
214
  $ajaxloadmore = '<div id="ajax-load-more" class="ajax-load-more-wrap '. $btn_color .'">';
@@ -218,7 +228,7 @@ if( !class_exists('AjaxLoadMore') ):
218
 
219
  // If SEO then set $preloaded_amount to $posts_per_page
220
  if(has_action('alm_seo_installed') && $seo === 'true'){
221
- $preloaded_amount = $posts_per_page; //
222
  }
223
 
224
  $preloaded_arr = array( // Create preload data array
@@ -270,16 +280,34 @@ if( !class_exists('AjaxLoadMore') ):
270
  endif;
271
  $preloaded_output = '<'.$container_element.' class="alm-listing alm-preloaded'. $classname .'" data-total-posts="'. $alm_total_posts .'">';
272
  $preloaded_output .= $output;
273
- $preloaded_output .= '</'.$container_element.'>';
274
 
275
- // Add $preloadeded data to $ajaxloadmore
276
- $ajaxloadmore .= $preloaded_output;
277
  }
278
  // End Preload Posts
279
 
280
 
281
- // Build ALM container
282
- $ajaxloadmore .= '<'.$container_element.' class="alm-listing alm-ajax'. $classname . '"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  $ajaxloadmore .= ' data-repeater="'.$repeater.'"';
284
  $ajaxloadmore .= ' data-post-type="'.$post_type.'"';
285
  $ajaxloadmore .= ' data-post-format="'.$post_format.'"';
@@ -302,47 +330,33 @@ if( !class_exists('AjaxLoadMore') ):
302
  $ajaxloadmore .= ' data-order="'.$order.'"';
303
  $ajaxloadmore .= ' data-orderby="'.$orderby.'"';
304
  $ajaxloadmore .= ' data-exclude="'.$exclude.'"';
305
- $ajaxloadmore .= ' data-offset="'.$offset.'"';
306
- $ajaxloadmore .= ' data-preloaded="'.$preloaded.'"';
307
- $ajaxloadmore .= ' data-preloaded_amount="'.$preloaded_amount.'"';
308
-
309
- // Posts per page
310
- $wp_posts_per_page = get_option( 'posts_per_page' );
311
- /* If posts per page on settings -> reading is greater than shortcode value set $posts_per_page to be new value
312
- */
313
- if(has_action('alm_seo_installed') && $wp_posts_per_page > $posts_per_page && $seo === 'true')
314
- $posts_per_page = $wp_posts_per_page;
315
-
316
- $ajaxloadmore .= ' data-posts-per-page="'.$posts_per_page.'"';
317
-
318
  $ajaxloadmore .= ' data-lang="'.$lang.'"';
319
  $ajaxloadmore .= ' data-scroll="'.$scroll.'"';
 
320
  $ajaxloadmore .= ' data-max-pages="'.$max_pages.'"';
321
  $ajaxloadmore .= ' data-pause="'.$pause.'"';
322
  $ajaxloadmore .= ' data-button-label="'.$button_label.'"';
323
  $ajaxloadmore .= ' data-button-class="'.$button_classname.'"';
324
- $ajaxloadmore .= ' data-destroy_after="'.$destroy_after.'"';
325
- $ajaxloadmore .= ' data-transition="'.$transition.'"';
326
-
327
-
328
- // Disables SEO if $preload
329
- // To be removed in future versions
330
- if($seo === 'true' && $preloaded === 'true')
331
- $seo = 'false';
332
-
333
-
334
  if(has_action('alm_seo_installed') && $seo === 'true'){
335
 
336
- // Get scroll speed
337
  $seo_scroll_speed = '1000';
338
- if(isset($options['_alm_seo_speed'])){
 
339
  $seo_scroll_speed = ''.$options['_alm_seo_speed'];
340
- }
 
 
341
 
342
- // Enabled Scrolling
343
- $ajaxloadmore .= ' data-test-seo-scroll="'.$options['_alm_seo_scroll'].'"';
344
  $seo_enable_scroll = $options['_alm_seo_scroll'];
345
- if(!isset($seo_enable_scroll) || empty($seo_enable_scroll)){
346
  $seo_enable_scroll = 'true';
347
  }else{
348
  if($seo_enable_scroll == '1'){
@@ -366,10 +380,17 @@ if( !class_exists('AjaxLoadMore') ):
366
  } else {
367
  $current_page = 1;
368
  }
 
 
 
 
 
 
369
  $ajaxloadmore .= ' data-seo="'.$seo.'"';
370
  $ajaxloadmore .= ' data-seo-start-page="'.$current_page.'"';
371
  $ajaxloadmore .= ' data-seo-scroll="'.$seo_enable_scroll.'"';
372
  $ajaxloadmore .= ' data-seo-scroll-speed="'.$seo_scroll_speed.'"';
 
373
  $ajaxloadmore .= ' data-seo-permalink="'.$seo_permalink.'"';
374
 
375
  }
@@ -398,6 +419,8 @@ if( !class_exists('AjaxLoadMore') ):
398
  if (! wp_verify_nonce( $nonce, 'ajax_load_more_nonce' )) die('Error, could not verify WP nonce.');
399
  }
400
 
 
 
401
  $repeater = (isset($_GET['repeater'])) ? $_GET['repeater'] : 'default';
402
  $type = preg_split('/(?=\d)/', $repeater, 2); // split $repeater value at number to determine type
403
  $type = $type[0]; // default | repeater | template_
@@ -566,6 +589,13 @@ if( !class_exists('AjaxLoadMore') ):
566
  }
567
 
568
 
 
 
 
 
 
 
 
569
  // Run the loop
570
  if ($alm_query->have_posts()) :
571
  $alm_found_posts = $alm_total_posts;
@@ -573,9 +603,20 @@ if( !class_exists('AjaxLoadMore') ):
573
  $alm_loop_count++;
574
  $alm_page = $alm_page_count; // Get page number
575
  $alm_item = ($alm_page_count * $numPosts) - $numPosts + $alm_loop_count; // Get current item
576
- include( alm_get_current_repeater($repeater, $type) );//Include repeater template
577
- endwhile;
578
- wp_reset_query();
 
 
 
 
 
 
 
 
 
 
 
579
  endif; exit;
580
  }
581
 
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
101
  */
102
 
103
  function alm_action_links( $links ) {
104
+ $links[] = '<a href="'. get_admin_url(null, 'admin.php?page=ajax-load-more') .'">'.__('Settings', ALM_NAME).'</a>';
105
+ $links[] = '<a href="'. get_admin_url(null, 'admin.php?page=ajax-load-more-shortcode-builder') .'">'.__('Shortcode Builder', ALM_NAME).'</a>';
106
  return $links;
107
  }
108
 
146
  $options = get_option( 'alm_settings' ); //Get plugin options
147
 
148
  extract(shortcode_atts(array(
149
+ 'cache' => 'false',
150
+ 'cache_id' => '',
151
  'preloaded' => 'false',
152
  'preloaded_amount' => '5',
153
  'seo' => 'false',
176
  'offset' => '0',
177
  'posts_per_page' => '5',
178
  'scroll' => 'true',
179
+ 'scroll_distance' => '150',
180
  'max_pages' => '5',
181
  'pause' => 'false',
182
  'destroy_after' => '',
183
  'transition' => 'slide',
184
+ 'button_label' => 'Older Posts',
185
  ), $atts));
186
 
187
  // Get container elements (ul | div)
210
  if (function_exists('pll_current_language')) // Polylang - https://wordpress.org/plugins/polylang/
211
  $lang = pll_current_language();
212
  if (function_exists('qtrans_getLanguage')) // qTranslate - https://wordpress.org/plugins/qtranslate/
213
+ $lang = qtrans_getLanguage();
214
+
215
+
216
+ $wp_posts_per_page = get_option( 'posts_per_page' ); // Posts per page - settings -> reading
217
+
218
+ /* If $wp_posts_per_page > than shortcode value then $posts_per_page to $wp_posts_per_page */
219
+ if(has_action('alm_seo_installed') && $wp_posts_per_page > $posts_per_page && $seo === 'true')
220
+ $posts_per_page = $wp_posts_per_page;
221
+
222
 
223
  // Start ALM object
224
  $ajaxloadmore = '<div id="ajax-load-more" class="ajax-load-more-wrap '. $btn_color .'">';
228
 
229
  // If SEO then set $preloaded_amount to $posts_per_page
230
  if(has_action('alm_seo_installed') && $seo === 'true'){
231
+ $preloaded_amount = $posts_per_page;
232
  }
233
 
234
  $preloaded_arr = array( // Create preload data array
280
  endif;
281
  $preloaded_output = '<'.$container_element.' class="alm-listing alm-preloaded'. $classname .'" data-total-posts="'. $alm_total_posts .'">';
282
  $preloaded_output .= $output;
283
+ $preloaded_output .= '</'.$container_element.'>';
284
 
285
+ $ajaxloadmore .= $preloaded_output; // Add $preloadeded data to $ajaxloadmore
 
286
  }
287
  // End Preload Posts
288
 
289
 
290
+
291
+ $ajaxloadmore .= '<'.$container_element.' class="alm-listing alm-ajax'. $classname . '"'; // Build ALM container
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
305
+ if(has_action('alm_preload_installed') && $preloaded === 'true'){
306
+ $ajaxloadmore .= ' data-preloaded="'.$preloaded.'"';
307
+ $ajaxloadmore .= ' data-preloaded-amount="'.$preloaded_amount.'"';
308
+ }
309
+
310
+
311
  $ajaxloadmore .= ' data-repeater="'.$repeater.'"';
312
  $ajaxloadmore .= ' data-post-type="'.$post_type.'"';
313
  $ajaxloadmore .= ' data-post-format="'.$post_format.'"';
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.'"';
336
  $ajaxloadmore .= ' data-scroll="'.$scroll.'"';
337
+ $ajaxloadmore .= ' data-scroll-distance="'.$scroll_distance.'"';
338
  $ajaxloadmore .= ' data-max-pages="'.$max_pages.'"';
339
  $ajaxloadmore .= ' data-pause="'.$pause.'"';
340
  $ajaxloadmore .= ' data-button-label="'.$button_label.'"';
341
  $ajaxloadmore .= ' data-button-class="'.$button_classname.'"';
342
+ $ajaxloadmore .= ' data-destroy-after="'.$destroy_after.'"';
343
+ $ajaxloadmore .= ' data-transition="'.$transition.'"';
344
+
345
+ // SEO Installed
 
 
 
 
 
 
346
  if(has_action('alm_seo_installed') && $seo === 'true'){
347
 
348
+ // Get scroll speed and scrolltop
349
  $seo_scroll_speed = '1000';
350
+ $seo_scrolltop = '30';
351
+ if(isset($options['_alm_seo_speed']))
352
  $seo_scroll_speed = ''.$options['_alm_seo_speed'];
353
+
354
+ if(isset($options['_alm_seo_scrolltop']))
355
+ $seo_scrolltop = ''.$options['_alm_seo_scrolltop'];
356
 
357
+ // Enabled Scrolling
 
358
  $seo_enable_scroll = $options['_alm_seo_scroll'];
359
+ if(!isset($seo_enable_scroll)){
360
  $seo_enable_scroll = 'true';
361
  }else{
362
  if($seo_enable_scroll == '1'){
380
  } else {
381
  $current_page = 1;
382
  }
383
+
384
+ // If preloaded then minus 1 page from SEO
385
+ if($preloaded === 'true'){
386
+ $current_page = $current_page - 1;
387
+ }
388
+
389
  $ajaxloadmore .= ' data-seo="'.$seo.'"';
390
  $ajaxloadmore .= ' data-seo-start-page="'.$current_page.'"';
391
  $ajaxloadmore .= ' data-seo-scroll="'.$seo_enable_scroll.'"';
392
  $ajaxloadmore .= ' data-seo-scroll-speed="'.$seo_scroll_speed.'"';
393
+ $ajaxloadmore .= ' data-seo-scrolltop="'.$seo_scrolltop.'"';
394
  $ajaxloadmore .= ' data-seo-permalink="'.$seo_permalink.'"';
395
 
396
  }
419
  if (! wp_verify_nonce( $nonce, 'ajax_load_more_nonce' )) die('Error, could not verify WP nonce.');
420
  }
421
 
422
+ $cache_id = (isset($_GET['cache_id'])) ? $_GET['cache_id'] : '';
423
+
424
  $repeater = (isset($_GET['repeater'])) ? $_GET['repeater'] : 'default';
425
  $type = preg_split('/(?=\d)/', $repeater, 2); // split $repeater value at number to determine type
426
  $type = $type[0]; // default | repeater | template_
589
  }
590
 
591
 
592
+ // CREATE CACHE FOLDER
593
+ if(!empty($cache_id) && has_action('alm_cache_create_dir')){
594
+ $url = $_SERVER['HTTP_REFERER'];
595
+ apply_filters('alm_cache_create_dir', $cache_id, $url);
596
+ $page_cache = '';
597
+ }
598
+
599
  // Run the loop
600
  if ($alm_query->have_posts()) :
601
  $alm_found_posts = $alm_total_posts;
603
  $alm_loop_count++;
604
  $alm_page = $alm_page_count; // Get page number
605
  $alm_item = ($alm_page_count * $numPosts) - $numPosts + $alm_loop_count; // Get current item
606
+ include( alm_get_current_repeater($repeater, $type) );//Include repeater template
607
+
608
+ // If cache is enabled
609
+ if(!empty($cache_id) && has_action('alm_cache_inc')){
610
+ $page_cache .= apply_filters('alm_cache_inc', $repeater, $type, $alm_page, $alm_found_posts, $alm_item);
611
+ }
612
+
613
+ endwhile; wp_reset_query();
614
+
615
+ // If cache is enabled
616
+ if(!empty($cache_id) && has_action('alm_cache_file')){
617
+ apply_filters('alm_cache_file', $cache_id, $page, $page_cache);
618
+ }
619
+
620
  endif; exit;
621
  }
622
 
core/js/ajax-load-more.js CHANGED
@@ -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,27 +34,42 @@
34
  alm.el = el;
35
  alm.content = $('.alm-listing.alm-ajax', alm.el);
36
  alm.prefix = 'alm-';
 
 
 
 
37
  alm.repeater = alm.content.data('repeater');
 
38
  alm.max_pages = alm.content.data('max-pages');
39
  alm.pause = alm.content.data('pause'); // true | false
40
  alm.transition = alm.content.data('transition');
41
- alm.destroy_after = alm.content.data('destroy_after');
42
  alm.lang = alm.content.data('lang');
43
  alm.posts_per_page = alm.content.data('posts-per-page');
44
  alm.seo = alm.content.data('seo'); // true | false
45
  alm.preloaded = alm.content.data('preloaded'); // true | false
46
- alm.preloaded_amount = alm.content.data('preloaded_amount'); // 0 - ?
47
 
48
- // Define offset
49
- if (alm.content.data('offset') === undefined) {
 
50
  alm.offset = 0;
51
- } else {
52
  alm.offset = alm.content.data('offset');
53
- }
54
 
55
- /* Preloaded */
56
- // Check preloaded posts to ensure posts_per_page > alm.total_posts
57
- // - if posts_per_page <= total_posts disable ajax load more
 
 
 
 
 
 
 
 
 
 
58
  if(alm.preloaded){
59
  alm.preload_wrap = alm.content.prev('.alm-preloaded');
60
  alm.total_posts = alm.preload_wrap.data('total-posts');
@@ -63,13 +78,9 @@
63
  if(alm.total_posts <= alm.preloaded_amount)
64
  alm.disable_ajax = true;
65
  }
66
- /* END Preload */
67
 
68
 
69
- /* SEO ADD-ON */
70
- // - get SEO values from shortcode
71
- // - Added v2.3
72
-
73
  if (alm.seo === undefined)
74
  alm.seo = false;
75
 
@@ -80,6 +91,7 @@
80
 
81
  alm.seo_scroll = alm.content.data('seo-scroll');
82
  alm.seo_scroll_speed = alm.content.data('seo-scroll-speed');
 
83
 
84
  alm.isPaged = false;
85
 
@@ -89,219 +101,286 @@
89
  }
90
 
91
  }
92
- /* END SEO Add-on */
93
 
94
 
95
 
96
- // Check for pause on init
97
- // Pause could be used to hold the loading of posts for a button click.
98
- if (alm.pause === undefined || (alm.seo && alm.start_page > 1)) {
 
 
 
99
  alm.pause = false;
100
- }
101
 
102
- // Select the repeater template
103
- if (alm.repeater === undefined) {
104
  alm.repeater = 'default';
105
- }
106
 
107
- // Max number of pages to load while scrolling
108
- if (alm.max_pages === undefined) {
109
  alm.max_pages = 5;
110
- }
111
- if (alm.max_pages === 0) {
112
  alm.max_pages = 1000;
113
- }
 
 
 
114
 
115
- // select the transition
116
- if (alm.transition === undefined) {
117
  alm.transition = 'slide';
118
- } else if (alm.transition === "fade") {
119
  alm.transition = 'fade';
120
- } else if (alm.transition === "none") {
121
  alm.transition = 'none';
122
- } else {
123
  alm.transition = 'slide';
124
- }
125
 
126
- // Destroy After
127
  if (alm.destroy_after !== undefined) {}
128
 
129
- // Button Label & classes
130
- if (alm.content.data('button-label') === undefined) {
131
  alm.button_label = 'Older Posts';
132
- } else {
133
  alm.button_label = alm.content.data('button-label');
134
- }
135
- if (alm.content.data('button-class') === undefined) {
 
136
  alm.button_class = '';
137
- } else {
138
  alm.button_class = ' ' + alm.content.data('button-class');
139
- }
140
 
141
- // Define on Scroll event
142
- if (alm.content.data('scroll') === undefined) {
143
  alm.scroll = true;
144
- } else if (alm.content.data('scroll') === false) {
145
  alm.scroll = false;
146
- } else {
147
  alm.scroll = true;
148
- }
149
 
150
- // Parse multiple Post Types
151
  alm.post_type = alm.content.data('post-type');
152
  alm.post_type = alm.post_type.split(",");
153
 
154
- // Append 'load More' button to .ajax-load-more-wrap
155
  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>');
156
  alm.button = $('.alm-load-more-btn', alm.el);
157
 
158
 
159
- /* loadPosts()
 
160
  *
161
  * The function to get posts via Ajax
162
  * @since 2.0.0
163
  */
 
164
  alm.AjaxLoadMore.loadPosts = function () {
 
165
  if(!alm.disable_ajax){ // Check for ajax blocker
166
  alm.button.addClass('loading');
167
  alm.loading = true;
168
- $.ajax({
169
- type: "GET",
170
- url: alm_localize.ajaxurl,
171
- data: {
172
- action: 'ajax_load_more_init',
173
- nonce: alm_localize.alm_nonce,
174
- repeater: alm.repeater,
175
- postType: alm.post_type,
176
- post_format: alm.content.data('post-format'),
177
- category: alm.content.data('category'),
178
- category__not_in: alm.content.data('category__not_in'),
179
- tag: alm.content.data('tag'),
180
- tag__not_in: alm.content.data('tag__not_in'),
181
- taxonomy: alm.content.data('taxonomy'),
182
- taxonomy_terms: alm.content.data('taxonomy-terms'),
183
- taxonomy_operator: alm.content.data('taxonomy-operator'),
184
- meta_key: alm.content.data('meta-key'),
185
- meta_value: alm.content.data('meta-value'),
186
- meta_compare: alm.content.data('meta-compare'),
187
- author: alm.content.data('author'),
188
- year: alm.content.data('year'),
189
- month: alm.content.data('month'),
190
- day: alm.content.data('day'),
191
- post_status: alm.content.data('post-status'),
192
- order: alm.content.data('order'),
193
- orderby: alm.content.data('orderby'),
194
- search: alm.content.data('search'),
195
- exclude: alm.content.data('exclude'),
196
- posts_per_page: alm.posts_per_page,
197
- pageNumber: alm.page,
198
- offset: alm.offset,
199
- preloaded: alm.preloaded,
200
- preloaded_amount: alm.preloaded_amount,
201
- lang: alm.lang
202
- },
203
- dataType: "html",
204
- // parse the data as html
205
- beforeSend: function () {
206
- if (alm.page != 1) {
207
- alm.button.addClass('loading');
208
- }
209
- },
210
- success: function (data) {
211
- alm.data = $(data); // Convert data to an object
212
- //console.log(alm.data.length);
213
-
214
- if (alm.init) {
215
- alm.button.text(alm.button_label);
216
- alm.init = false;
217
-
218
- if(alm.isPaged){
219
- alm.posts_per_page = alm.content.data('posts-per-page'); // Reset our posts per page variable
220
- alm.page = alm.start_page - 1; // Set our new page #
221
- }
222
- }
223
 
224
- if (alm.data.length > 0) {
225
- alm.el = $('<div class="' + alm.prefix + 'reveal"/>');
226
- alm.el.append(alm.data);
227
- alm.el.hide();
228
- alm.content.append(alm.el);
229
- if (alm.transition === 'fade') { // Fade transition
230
- alm.el.fadeIn(alm.speed, 'alm_easeInOutQuad', function () {
231
- alm.loading = false;
232
- alm.button.delay(alm.speed).removeClass('loading');
233
- if (alm.data.length < alm.posts_per_page) {
234
- alm.finished = true;
235
- alm.button.addClass('done');
236
- }
237
- });
238
- }else if(alm.transition === 'none') { // Fade transition
239
- alm.el.show();
240
- alm.loading = false;
241
- alm.button.delay(alm.speed).removeClass('loading');
242
- if (alm.data.length < alm.posts_per_page) {
243
- alm.finished = true;
244
- alm.button.addClass('done');
245
- }
246
- }else { // Slide transition
247
- alm.el.slideDown(alm.speed, 'alm_easeInOutQuad', function () {
248
- alm.loading = false;
249
- alm.button.delay(alm.speed).removeClass('loading');
250
- if (alm.data.length < alm.posts_per_page) {
251
- alm.finished = true;
252
- alm.button.addClass('done');
253
- }
254
- });
255
- }
256
-
257
- // ALM Complete
258
- if ($.isFunction($.fn.almComplete)) {
259
- $.fn.almComplete(alm);
260
- }
261
-
262
- // ALM SEO
263
- // - Only run if a single instance is on the page.
264
- if($(".ajax-load-more-wrap").length === 1){
265
- if ($.isFunction($.fn.almSEO) && alm.seo) {
266
- $.fn.almSEO(alm);
267
- }
268
- }
269
-
270
- } else {
271
- alm.button.delay(alm.speed).removeClass('loading').addClass('done');
272
- alm.loading = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  alm.finished = true;
 
274
  }
275
-
276
- // Destroy After param
277
- if (alm.destroy_after !== undefined && alm.destroy_after !== '') {
278
- //console.log(alm.destroy_after);
279
- //console.log(alm.page);
280
- var currentPage = alm.page + 1; // Add 1 because alm.page starts at 0
281
- if(alm.preload) currentPage++;
282
-
283
- if(currentPage === alm.destroy_after){ // - Disable ALM is page = alm.destroy_after value
284
- alm.disable_ajax = true;
285
- alm.button.delay(alm.speed).fadeOut(alm.speed);
286
- }
287
- }
288
-
289
-
290
- },
291
- error: function (jqXHR, textStatus, errorThrown) {
292
  alm.loading = false;
293
- alm.button.removeClass('loading');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  }
295
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
  };
298
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
 
300
  /* Button onClick()
301
  *
302
  * Load more button click event
303
  * @since 1.0.0
304
  */
 
305
  alm.button.on('click', function () {
306
  if (alm.pause === true) {
307
  alm.pause = false;
@@ -315,11 +394,13 @@
315
  });
316
 
317
 
318
- /* AjaxLoadMore.isVisible()
 
319
  *
320
  * Check to see if element is visible before loading posts
321
  * @since 2.1.2
322
  */
 
323
  alm.AjaxLoadMore.isVisible = function () {
324
  alm.visible = false;
325
  if (alm.el.is(":visible")) {
@@ -327,6 +408,7 @@
327
  }
328
  return alm.visible;
329
  };
 
330
 
331
 
332
  /* Window scroll and touchmove events
@@ -337,14 +419,16 @@
337
  if (alm.scroll) {
338
  alm.window.bind("scroll touchstart", function () {
339
  if (alm.AjaxLoadMore.isVisible()) {
340
- var content_offset = alm.button.offset();
341
- if (!alm.loading && !alm.finished && (alm.window.scrollTop() >= Math.round(content_offset.top - (alm.window.height() - 150))) && alm.page < (alm.max_pages - 1) && alm.proceed && !alm.pause) {
342
  alm.page++;
343
  alm.AjaxLoadMore.loadPosts();
344
  }
345
  }
346
  });
347
  }
 
 
348
 
349
  /* Init Ajax load More
350
  *
@@ -378,6 +462,8 @@
378
  };
379
 
380
  // End $.ajaxloadmore
 
 
381
 
382
  /* $.fn.ajaxloadmore()
383
  *
@@ -394,6 +480,9 @@
394
  * Initiate Ajax load More if div is present on screen
395
  * @since 2.1.2
396
  */
397
- if ($(".ajax-load-more-wrap").length) $(".ajax-load-more-wrap").ajaxloadmore();
 
 
 
398
 
399
  })(jQuery);
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.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
+
68
+
69
+ /* Preloaded
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');
78
  if(alm.total_posts <= alm.preloaded_amount)
79
  alm.disable_ajax = true;
80
  }
 
81
 
82
 
83
+ /* SEO */
 
 
 
84
  if (alm.seo === undefined)
85
  alm.seo = false;
86
 
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
 
101
  }
102
 
103
  }
 
104
 
105
 
106
 
107
+ /* Check for pause on init
108
+ * Pause could be used to hold the loading of posts for a button click.
109
+ */
110
+ if (alm.pause === undefined || (alm.seo && alm.start_page > 1)) // SEO only
111
+ alm.pause = false;
112
+ if (alm.preloaded && alm.start_page >= 1) // SEO + Preloaded
113
  alm.pause = false;
114
+
115
 
116
+ /* Select the repeater template */
117
+ if (alm.repeater === undefined)
118
  alm.repeater = 'default';
119
+
120
 
121
+ /* Max number of pages to load while scrolling */
122
+ if (alm.max_pages === undefined)
123
  alm.max_pages = 5;
124
+
125
+ if (alm.max_pages === 0)
126
  alm.max_pages = 1000;
127
+
128
+ if (alm.scroll_distance === undefined)
129
+ alm.scroll_distance = 150;
130
+
131
 
132
+ /* select the transition */
133
+ if (alm.transition === undefined)
134
  alm.transition = 'slide';
135
+ else if (alm.transition === "fade")
136
  alm.transition = 'fade';
137
+ else if (alm.transition === "none")
138
  alm.transition = 'none';
139
+ else
140
  alm.transition = 'slide';
141
+
142
 
143
+ /* Destroy After */
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 */
173
  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>');
174
  alm.button = $('.alm-load-more-btn', alm.el);
175
 
176
 
177
+
178
+ /* alm.AjaxLoadMore.loadPosts()
179
  *
180
  * The function to get posts via Ajax
181
  * @since 2.0.0
182
  */
183
+
184
  alm.AjaxLoadMore.loadPosts = function () {
185
+
186
  if(!alm.disable_ajax){ // Check for ajax blocker
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 ) {
194
+ // data contains whatever that request returned
195
+ alm.AjaxLoadMore.success(data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
+ }).fail(function() {
198
+ alm.AjaxLoadMore.ajax();
199
+ });
200
+
201
+ }else{ // Standard ALM query
202
+
203
+ alm.AjaxLoadMore.ajax();
204
+
205
+ }
206
+ }
207
+
208
+ };
209
+
210
+
211
+
212
+ /* alm.AjaxLoadMore.ajax()
213
+ *
214
+ * Ajax Load Moe Ajax function
215
+ * @since 2.6.0
216
+ */
217
+
218
+ alm.AjaxLoadMore.ajax = function () {
219
+ $.ajax({
220
+ type: "GET",
221
+ url: alm_localize.ajaxurl,
222
+ data: {
223
+ action: 'ajax_load_more_init',
224
+ nonce: alm_localize.alm_nonce,
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,
251
+ preloaded: alm.preloaded,
252
+ preloaded_amount: alm.preloaded_amount,
253
+ lang: alm.lang
254
+ },
255
+ dataType: "html",
256
+ // parse the data as html
257
+ beforeSend: function () {
258
+ if (alm.page != 1) {
259
+ alm.button.addClass('loading');
260
+ }
261
+ },
262
+ success: function (data) {
263
+ alm.AjaxLoadMore.success(data);
264
+ },
265
+ error: function (jqXHR, textStatus, errorThrown) {
266
+ alm.AjaxLoadMore.error(jqXHR, textStatus, errorThrown);
267
+ }
268
+ });
269
+ };
270
+
271
+
272
+
273
+ /* alm.AjaxLoadMore.success()
274
+ *
275
+ * Success function after loading data
276
+ * @since 2.6.0
277
+ */
278
+
279
+ alm.AjaxLoadMore.success = function (data) {
280
+ alm.data = $(data); // Convert data to an object
281
+ if (alm.init) {
282
+ alm.button.text(alm.button_label);
283
+ alm.init = false;
284
+
285
+ // ALM Empty - triggers if zero results were returned
286
+ if(!alm.data.length > 0){
287
+ if ($.isFunction($.fn.almEmpty)) {
288
+ $.fn.almEmpty(alm);
289
+ }
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
+ }
297
+
298
+ if (alm.data.length > 0) {
299
+ alm.el = $('<div class="' + alm.prefix + 'reveal"/>');
300
+ alm.el.append(alm.data);
301
+ alm.el.hide();
302
+ alm.content.append(alm.el);
303
+ if (alm.transition === 'fade') { // Fade transition
304
+ alm.el.fadeIn(alm.speed, 'alm_easeInOutQuad', function () {
305
+ alm.loading = false;
306
+ alm.button.delay(alm.speed).removeClass('loading');
307
+ if (alm.data.length < alm.posts_per_page) {
308
  alm.finished = true;
309
+ alm.button.addClass('done');
310
  }
311
+ });
312
+ }else if(alm.transition === 'none') { // Fade transition
313
+ alm.el.show();
314
+ alm.loading = false;
315
+ alm.button.delay(alm.speed).removeClass('loading');
316
+ if (alm.data.length < alm.posts_per_page) {
317
+ alm.finished = true;
318
+ alm.button.addClass('done');
319
+ }
320
+ }else { // Slide transition
321
+ alm.el.slideDown(alm.speed, 'alm_easeInOutQuad', function () {
 
 
 
 
 
 
322
  alm.loading = false;
323
+ alm.button.delay(alm.speed).removeClass('loading');
324
+ if (alm.data.length < alm.posts_per_page) {
325
+ alm.finished = true;
326
+ alm.button.addClass('done');
327
+ }
328
+ });
329
+ }
330
+
331
+ // ALM Complete
332
+ if ($.isFunction($.fn.almComplete)) {
333
+ $.fn.almComplete(alm);
334
+ }
335
+
336
+ // ALM SEO
337
+ // - Only run if a single instance is on the page.
338
+ if($(".ajax-load-more-wrap").length === 1){
339
+ if ($.isFunction($.fn.almSEO) && alm.seo) {
340
+ $.fn.almSEO(alm);
341
  }
342
+ }
343
+
344
+ } else {
345
+ alm.button.delay(alm.speed).removeClass('loading').addClass('done');
346
+ alm.loading = false;
347
+ alm.finished = true;
348
+ }
349
+
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
+ }
359
  }
360
  };
361
+
362
+
363
+
364
+ /* alm.AjaxLoadMore.error()
365
+ *
366
+ * Error function after failed data
367
+ * @since 2.6.0
368
+ */
369
+
370
+ alm.AjaxLoadMore.error = function (jqXHR, textStatus, errorThrown) {
371
+ alm.loading = false;
372
+ alm.button.removeClass('loading');
373
+ console.log(errorThrown);
374
+ };
375
+
376
+
377
 
378
  /* Button onClick()
379
  *
380
  * Load more button click event
381
  * @since 1.0.0
382
  */
383
+
384
  alm.button.on('click', function () {
385
  if (alm.pause === true) {
386
  alm.pause = false;
394
  });
395
 
396
 
397
+
398
+ /* alm.AjaxLoadMore.isVisible()
399
  *
400
  * Check to see if element is visible before loading posts
401
  * @since 2.1.2
402
  */
403
+
404
  alm.AjaxLoadMore.isVisible = function () {
405
  alm.visible = false;
406
  if (alm.el.is(":visible")) {
408
  }
409
  return alm.visible;
410
  };
411
+
412
 
413
 
414
  /* Window scroll and touchmove events
419
  if (alm.scroll) {
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
  }
427
  }
428
  });
429
  }
430
+
431
+
432
 
433
  /* Init Ajax load More
434
  *
462
  };
463
 
464
  // End $.ajaxloadmore
465
+
466
+
467
 
468
  /* $.fn.ajaxloadmore()
469
  *
480
  * Initiate Ajax load More if div is present on screen
481
  * @since 2.1.2
482
  */
483
+ if ($(".ajax-load-more-wrap").length)
484
+ $(".ajax-load-more-wrap").ajaxloadmore();
485
+
486
+
487
 
488
  })(jQuery);
core/js/ajax-load-more.min.js CHANGED
@@ -11,28 +11,42 @@
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.repeater=alm.content.data('repeater');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){alm.offset=0;}else{alm.offset=alm.content.data('offset');}
15
- 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)
 
 
 
16
  alm.preloaded_amount=false;if(alm.total_posts<=alm.preloaded_amount)
17
  alm.disable_ajax=true;}
18
  if(alm.seo===undefined)
19
- 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.isPaged=false;if(alm.start_page>1){alm.isPaged=true;alm.posts_per_page=alm.start_page*alm.posts_per_page;}}
20
- if(alm.pause===undefined||(alm.seo&&alm.start_page>1)){alm.pause=false;}
21
- if(alm.repeater===undefined){alm.repeater='default';}
22
- if(alm.max_pages===undefined){alm.max_pages=5;}
23
- if(alm.max_pages===0){alm.max_pages=1000;}
24
- if(alm.transition===undefined){alm.transition='slide';}else if(alm.transition==="fade"){alm.transition='fade';}else if(alm.transition==="none"){alm.transition='none';}else{alm.transition='slide';}
25
- if(alm.destroy_after!==undefined){}
26
- if(alm.content.data('button-label')===undefined){alm.button_label='Older Posts';}else{alm.button_label=alm.content.data('button-label');}
27
- if(alm.content.data('button-class')===undefined){alm.button_class='';}else{alm.button_class=' '+alm.content.data('button-class');}
28
- if(alm.content.data('scroll')===undefined){alm.scroll=true;}else if(alm.content.data('scroll')===false){alm.scroll=false;}else{alm.scroll=true;}
29
- 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;$.ajax({type:"GET",url:alm_localize.ajaxurl,data:{action:'ajax_load_more_init',nonce:alm_localize.alm_nonce,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.data=$(data);if(alm.init){alm.button.text(alm.button_label);alm.init=false;if(alm.isPaged){alm.posts_per_page=alm.content.data('posts-per-page');alm.page=alm.start_page-1;}}
 
 
 
 
 
 
 
 
 
 
30
  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');}});}
31
  if($.isFunction($.fn.almComplete)){$.fn.almComplete(alm);}
32
  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;}
33
- 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);}}},error:function(jqXHR,textStatus,errorThrown){alm.loading=false;alm.button.removeClass('loading');}});}};alm.button.on('click',function(){if(alm.pause===true){alm.pause=false;alm.AjaxLoadMore.loadPosts();}
34
  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;}
35
- 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()-150)))&&alm.page<(alm.max_pages-1)&&alm.proceed&&!alm.pause){alm.page++;alm.AjaxLoadMore.loadPosts();}}});}
36
  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();}}
37
  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)));});}
38
- if($(".ajax-load-more-wrap").length)$(".ajax-load-more-wrap").ajaxloadmore();})(jQuery);
 
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)
26
+ alm.repeater='default';if(alm.max_pages===undefined)
27
+ alm.max_pages=5;if(alm.max_pages===0)
28
+ alm.max_pages=1000;if(alm.scroll_distance===undefined)
29
+ alm.scroll_distance=150;if(alm.transition===undefined)
30
+ 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);