WordPress Infinite Scroll – Ajax Load More - Version 2.4.0

Version Description

  • Adding date query parameters - users can now query by day, month and year.
  • Admin UX improvements including sticky navigation in shortcode builder.
  • Updated ALM examples page with date query and improved archive.php.
  • Fixed PHP warning related to hiding Ajax Load More button in editor and Custom Repeaters v1.
  • Added language support for Polylang and qTranslate plugins.
Download this release

Release Info

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

Code changes from version 2.3.1 to 2.4.0

README.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Ajax Load More ===
2
  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
5
  Requires at least: 3.6
6
  Tested up to: 4.1
7
- Stable tag: 2.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -21,7 +21,7 @@ Build complex WordPress queries using our shortcode builder then add the shortco
21
 
22
  * **Multiple Instances** - One, two, three or ten - you can now include multiple instances of Ajax Load More on a single page.
23
  * **Shortcode Builder** - Easily create your own Ajax Load More shortcode by adjusting the various WordPress query parameters in our easy-to-use shortcode builder.(see Shortcode Parameters).
24
- * **Query Parameters** - Ajax Load More allows you to query WordPress by many different content types. Query by Post Type, Post Format, Category, Tags, Custom Taxonomies, Search Term, Authors and more!!
25
  * **Customizable Repeater Templates** - Edit and extend the functionality of Ajax Load More by creating your own repeater template to match the look and feel of your website (see screenshots).
26
  * **Setting Panel** - Customize your version of Ajax Load More by updating various plugin settings (see screenshots).
27
 
@@ -41,6 +41,10 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
41
  * **taxonomy** - Query by custom taxonomy name. Default = null
42
  * **taxonomy_terms** - Comma separated list of custom taxonomy terms(slug). Default = null
43
  * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
 
 
 
 
44
  * **meta_key** - Custom field key(name). Default = null
45
  * **meta_value** - Custom field value. Default = null
46
  * **meta_compare** - Operator to compare meta_key and meta_value against (=/!=/>/>=/</<= etc.). Default = ‘=’
@@ -63,7 +67,19 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
63
  = Example Shortcode =
64
 
65
  [ajax_load_more post_type="post, portfolio" repeater="default" posts_per_page="5" transition="fade" button_label="Older Posts"]
 
 
 
 
 
 
 
 
 
 
66
 
 
 
67
  = Demos =
68
  * **[Default](http://connekthq.com/plugins/ajax-load-more/)** - Out of the box functionality and styling
69
  * **[Fade Transition](http://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded
@@ -205,6 +221,14 @@ How to install Ajax Load More.
205
  == Changelog ==
206
 
207
 
 
 
 
 
 
 
 
 
208
  = 2.3.1 =
209
  * Urgent fix for array_push error
210
 
1
  === Ajax Load More ===
2
  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.4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
21
 
22
  * **Multiple Instances** - One, two, three or ten - you can now include multiple instances of Ajax Load More on a single page.
23
  * **Shortcode Builder** - Easily create your own Ajax Load More shortcode by adjusting the various WordPress query parameters in our easy-to-use shortcode builder.(see Shortcode Parameters).
24
+ * **Query Parameters** - Ajax Load More allows you to query WordPress by many different content types. Query by Post Type, Post Format, Date, Category, Tags, Custom Taxonomies, Search Term, Authors and more!!
25
  * **Customizable Repeater Templates** - Edit and extend the functionality of Ajax Load More by creating your own repeater template to match the look and feel of your website (see screenshots).
26
  * **Setting Panel** - Customize your version of Ajax Load More by updating various plugin settings (see screenshots).
27
 
41
  * **taxonomy** - Query by custom taxonomy name. Default = null
42
  * **taxonomy_terms** - Comma separated list of custom taxonomy terms(slug). Default = null
43
  * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
44
+ * **day** - Day of the week. Default = null
45
+ * **month** - Month of the year. Default = null
46
+ * **year** - Year of post. Default = null
47
+ * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
48
  * **meta_key** - Custom field key(name). Default = null
49
  * **meta_value** - Custom field value. Default = null
50
  * **meta_compare** - Operator to compare meta_key and meta_value against (=/!=/>/>=/</<= etc.). Default = ‘=’
67
  = Example Shortcode =
68
 
69
  [ajax_load_more post_type="post, portfolio" repeater="default" posts_per_page="5" transition="fade" button_label="Older Posts"]
70
+
71
+ ***
72
+
73
+ = Variables =
74
+
75
+ Ajax Load More passes the following PHP variables to each repeater template - these template variables can help you style and transform your repeater templates.
76
+
77
+ * **$alm_page** - Returns the current page number. 'echo $alm_page;'
78
+ * **$alm_item** - Returns the current item number within your loop. 'echo $alm_item;'
79
+ * **$alm_found_posts** - Returns the total number of posts found within the entire WordPress query. 'echo $alm_found_posts;'
80
 
81
+ ***
82
+
83
  = Demos =
84
  * **[Default](http://connekthq.com/plugins/ajax-load-more/)** - Out of the box functionality and styling
85
  * **[Fade Transition](http://connekthq.com/plugins/ajax-load-more/examples/fade-transition/)** - Elements fade in as posts are loaded
221
  == Changelog ==
222
 
223
 
224
+ = 2.4.0 =
225
+ * Adding date query parameters - users can now query by day, month and year.
226
+ * Admin UX improvements including sticky navigation in shortcode builder.
227
+ * Updated ALM examples page with date query and improved archive.php.
228
+ * Fixed PHP warning related to hiding Ajax Load More button in editor and Custom Repeaters v1.
229
+ * Added language support for Polylang and qTranslate plugins.
230
+
231
+
232
  = 2.3.1 =
233
  * Urgent fix for array_push error
234
 
admin/admin.php CHANGED
@@ -5,6 +5,8 @@
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_get_tax_terms', 'alm_get_tax_terms' ); // Ajax Get Taxonomy Terms
9
  add_action( 'wp_ajax_nopriv_alm_get_tax_terms', 'alm_get_tax_terms' ); // Ajax Get Taxonomy Terms
10
 
@@ -259,7 +261,7 @@ function alm_repeater_page(){ ?>
259
  <div class="wrap">
260
  <div class="header-wrap">
261
  <h2><?php _e('Ajax Load More: Repeater Templates', ALM_NAME); ?></h2>
262
- <p><?php _e('The library of available templates to use throughout your theme', ALM_NAME); ?></p>
263
  </div>
264
  <div class="cnkt-main form-table repeaters">
265
 
@@ -284,7 +286,8 @@ function alm_repeater_page(){ ?>
284
  <h3 class="heading"><?php _e('Default Template', ALM_NAME); ?></h3>
285
  <div class="expand-wrap">
286
  <div class="wrap repeater-wrap" data-name="default" data-type="default">
287
- <label class="template-title" for="template-default"><?php _e('Enter the HTML and PHP code for the default template', ALM_NAME); ?></label>
 
288
  <textarea rows="10" id="template-default" class="_alm_repeater"><?php echo $contents; ?></textarea>
289
  <script>
290
  var editorDefault = CodeMirror.fromTextArea(document.getElementById("template-default"), {
@@ -307,11 +310,7 @@ function alm_repeater_page(){ ?>
307
 
308
  // Custom Repeaters - /cta/extend.php
309
  // Removed in 2.2.8
310
- if (!has_action('alm_get_custom_repeaters')) {
311
- // echo '<div class="row no-brd">';
312
- // include( ALM_PATH . 'admin/includes/cta/extend.php');
313
- // echo '</div>';
314
- }
315
 
316
  // Custom Repeaters v2 - /cta/extend.php
317
  if (!has_action('alm_get_unlimited_repeaters')) {
@@ -355,7 +354,10 @@ function alm_repeater_page(){ ?>
355
  type = container.data('type'), // Get template type (default/repeater/unlimited)
356
  alias = ($('input._alm_repeater_alias', container).length) ? $('input._alm_repeater_alias', container).val() : '',
357
  responseText = $(".saved-response", container);
358
-
 
 
 
359
  //Get value from CodeMirror textarea
360
  var id = editorId.replace('template-', ''); // Editor ID
361
 
@@ -391,8 +393,8 @@ function alm_repeater_page(){ ?>
391
  success: function(response) {
392
 
393
  setTimeout(function() {
394
- responseText.delay(500).html(response).removeClass('loading');
395
- }, 250);
396
 
397
  setTimeout(function() {
398
  responseText.animate({'opacity': 0}, function(){
@@ -400,7 +402,8 @@ function alm_repeater_page(){ ?>
400
  btn.removeClass('saving');
401
  });
402
 
403
- }, 6000);
 
404
  },
405
  error: function(xhr, status, error) {
406
  responseText.html('<?php _e('Something went wrong and the data could not be saved.', ALM_NAME) ?>').removeClass('loading');
@@ -416,6 +419,75 @@ function alm_repeater_page(){ ?>
416
  editorId = btn.data('editor-id');
417
  _alm_admin.saveRepeater(btn, editorId);
418
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
 
420
  });
421
  </script>
@@ -423,7 +495,8 @@ function alm_repeater_page(){ ?>
423
  <!-- End Repeaters -->
424
  </div>
425
  <div class="cnkt-sidebar">
426
- <div class="cta">
 
427
  <h3><?php _e('Templating Help', ALM_NAME); ?></h3>
428
  <div class="item">
429
  <p><strong><?php _e('What is a repeater template?', ALM_NAME); ?></strong></p>
@@ -438,9 +511,8 @@ function alm_repeater_page(){ ?>
438
  <ul>
439
  <li><?php _e('Always open and close your templates with an HTML element. In some rare cases data may not be displayed if not wrapped in HTML.<br/>e.g. <code>&lt;li> &lt;/li></code> or <code>&lt;div> &lt;/div></code>', ALM_NAME); ?><br/> </li>
440
  </ul>
441
- </div>
442
- </div>
443
- <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/writeable.php'); ?>
444
  </div>
445
  </div>
446
  </div>
@@ -462,7 +534,7 @@ function alm_save_repeater(){
462
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
463
  die('Get Bounced!');
464
 
465
- // Get variables
466
  $c = Trim(stripslashes($_POST["value"])); // Repeater Value
467
  $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
468
  $t = Trim(stripslashes($_POST["type"])); // Repeater name
@@ -527,6 +599,46 @@ function alm_save_repeater(){
527
  }
528
 
529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  /*
531
  * alm_shortcode_builder_page
532
  * Shortcode Builder
@@ -535,7 +647,7 @@ function alm_save_repeater(){
535
  */
536
 
537
  function alm_shortcode_builder_page(){ ?>
538
- <div class="admin ajax-load-more" id="alm-builder">
539
  <div class="wrap">
540
  <div class="header-wrap">
541
  <h2><?php _e('Ajax Load More: Shortcode Builder', ALM_NAME); ?></h2>
@@ -550,19 +662,19 @@ function alm_shortcode_builder_page(){ ?>
550
  </div>
551
  </div>
552
  <div class="cnkt-sidebar">
553
- <div class="cta">
554
- <h3><?php _e('Shortcode Output', ALM_NAME); ?></h3>
555
- <p><?php _e('Copy and paste the following shortcode into the content editor or widget area of your theme.', ALM_NAME); ?></p>
556
- <div class="output-wrap">
557
- <div id="shortcode_output"></div>
558
- <span class="copy"><?php _e('Copy', ALM_NAME); ?></span>
559
- </div>
560
- </div>
561
- <div class="cta">
562
- <h3><?php _e('Did you know?', ALM_NAME); ?></h3>
563
- <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/shortcode-editor.jpg"><br/>
564
- <?php _e('<p class="addon-intro">You can generate shortcodes while editing pages!</p><p>Click the Ajax Load More icon in the content editor toolbar and the <a href="?page=ajax-load-more-shortcode-builder">shortcode builder</a> will open in an overlay window.', ALM_NAME); ?></p>
565
- </div>
566
  </div>
567
  </div>
568
  </div>
@@ -623,8 +735,9 @@ function alm_example_page(){ ?>
623
  </div>
624
  <div class="cnkt-main forceColors">
625
  <div class="group">
 
626
 
627
- <div class="row gist">
628
  <h3 class="heading"><?php _e('Archive.php', ALM_NAME); ?></h3>
629
  <div class="expand-wrap">
630
  <p><?php _e('Shortcode for use on generic archive page.', ALM_NAME); ?></p>
@@ -634,7 +747,7 @@ function alm_example_page(){ ?>
634
  </div>
635
  </div>
636
 
637
- <div class="row gist">
638
  <h3 class="heading"><?php _e('Author.php', ALM_NAME); ?></h3>
639
  <div class="expand-wrap">
640
  <p><?php _e('Shortcode for use on author archive pages.', ALM_NAME); ?></p>
@@ -643,7 +756,7 @@ function alm_example_page(){ ?>
643
  </div>
644
  </div>
645
  </div>
646
- <div class="row gist">
647
  <h3 class="heading"><?php _e('Category.php', ALM_NAME); ?></h3>
648
  <div class="expand-wrap">
649
  <p><?php _e('Shortcode for use on category archive pages.', ALM_NAME); ?></p>
@@ -652,7 +765,16 @@ function alm_example_page(){ ?>
652
  </div>
653
  </div>
654
  </div>
655
- <div class="row gist">
 
 
 
 
 
 
 
 
 
656
  <h3 class="heading"><?php _e('Excluding Posts', ALM_NAME); ?></h3>
657
  <div class="expand-wrap">
658
  <p><?php _e('Shortcode for excluding an array of posts.', ALM_NAME); ?></p>
@@ -660,7 +782,7 @@ function alm_example_page(){ ?>
660
  </div>
661
  </div>
662
 
663
- <div class="row gist">
664
  <h3 class="heading"><?php _e('Tag.php', ALM_NAME); ?></h3>
665
  <div class="expand-wrap">
666
  <p><?php _e('Shortcode for use on tag archive pages.', ALM_NAME); ?></p>
@@ -677,11 +799,15 @@ function alm_example_page(){ ?>
677
 
678
  </div>
679
  <div class="cnkt-sidebar">
680
- <div class="cta">
681
- <h3><?php _e('Request Examples', ALM_NAME); ?></h3>
682
- <p><?php _e('If you\'re having issue\'s with functionality, please submit example requests through the <a href="https://github.com/dcooney/wordpress-ajax-load-more" target="_blank">GitHub repository</a>. ', ALM_NAME); ?></p>
683
- </div>
684
- <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/about.php'); ?>
 
 
 
 
685
  </div>
686
 
687
 
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
 
261
  <div class="wrap">
262
  <div class="header-wrap">
263
  <h2><?php _e('Ajax Load More: Repeater Templates', ALM_NAME); ?></h2>
264
+ <p><?php _e('The library of available templates to use within your theme', ALM_NAME); ?></p>
265
  </div>
266
  <div class="cnkt-main form-table repeaters">
267
 
286
  <h3 class="heading"><?php _e('Default Template', ALM_NAME); ?></h3>
287
  <div class="expand-wrap">
288
  <div class="wrap repeater-wrap" data-name="default" data-type="default">
289
+ <label class="template-title" for="template-default"><?php _e('Enter the HTML and PHP code for the default template', ALM_NAME); ?></label>
290
+ <!-- <span class="option-update" data-editor-id="template-default">Update from database</span> -->
291
  <textarea rows="10" id="template-default" class="_alm_repeater"><?php echo $contents; ?></textarea>
292
  <script>
293
  var editorDefault = CodeMirror.fromTextArea(document.getElementById("template-default"), {
310
 
311
  // Custom Repeaters - /cta/extend.php
312
  // Removed in 2.2.8
313
+ if (!has_action('alm_get_custom_repeaters')) {}
 
 
 
 
314
 
315
  // Custom Repeaters v2 - /cta/extend.php
316
  if (!has_action('alm_get_unlimited_repeaters')) {
354
  type = container.data('type'), // Get template type (default/repeater/unlimited)
355
  alias = ($('input._alm_repeater_alias', container).length) ? $('input._alm_repeater_alias', container).val() : '',
356
  responseText = $(".saved-response", container);
357
+
358
+ if(type === undefined) // Fix for custom repeaters v1
359
+ type = 'undefined';
360
+
361
  //Get value from CodeMirror textarea
362
  var id = editorId.replace('template-', ''); // Editor ID
363
 
393
  success: function(response) {
394
 
395
  setTimeout(function() {
396
+ responseText.delay(500).html(response).removeClass('loading');
397
+ }, 250);
398
 
399
  setTimeout(function() {
400
  responseText.animate({'opacity': 0}, function(){
402
  btn.removeClass('saving');
403
  });
404
 
405
+ }, 6000);
406
+
407
  },
408
  error: function(xhr, status, error) {
409
  responseText.html('<?php _e('Something went wrong and the data could not be saved.', ALM_NAME) ?>').removeClass('loading');
419
  editorId = btn.data('editor-id');
420
  _alm_admin.saveRepeater(btn, editorId);
421
  });
422
+
423
+
424
+
425
+ /*
426
+ * _alm_admin.updateRepeater
427
+ * Update Repeater Value
428
+ *
429
+ * COMING SOON
430
+ * @since 2.4
431
+ */
432
+
433
+ _alm_admin.updateRepeater = function(btn, editorId) {
434
+ var container = btn.parent('.repeater-wrap'),
435
+ el = $('textarea._alm_repeater', container),
436
+ btn = btn,
437
+ repeater = container.data('name'), // Get templete name
438
+ type = container.data('type'), // Get template type (default/repeater/unlimited)
439
+ responseText = $(".saved-response", container);
440
+
441
+ //Get value from CodeMirror textarea
442
+ var id = editorId.replace('template-', ''); // Editor ID
443
+
444
+ //If template is not already saving, then proceed
445
+ if (!btn.hasClass('updating')) {
446
+ btn.addClass('updating');
447
+ responseText.addClass('loading').html('<?php _e('Updating template...', ALM_NAME) ?>');
448
+ responseText.animate({'opacity' : 1});
449
+
450
+ $.ajax({
451
+ type: 'POST',
452
+ url: alm_admin_localize.ajax_admin_url,
453
+ data: {
454
+ action: 'alm_update_repeater',
455
+ repeater: repeater,
456
+ type: type,
457
+ nonce: alm_admin_localize.alm_admin_nonce,
458
+ },
459
+ success: function(response) {
460
+ if(id === 'default'){ // Default Template
461
+ editorDefault.setValue(response);
462
+ }else{ // Repeater Templates
463
+ var eid = window['editor_'+id]; // Set editor ID
464
+ eid.setValue(response);
465
+ }
466
+
467
+ setTimeout(function() {
468
+ responseText.animate({'opacity': 0}, function(){
469
+ responseText.html('&nbsp;').removeClass('loading');
470
+ btn.removeClass('updating');
471
+ });
472
+
473
+ }, 100);
474
+ },
475
+ error: function(xhr, status, error) {
476
+ responseText.html('<?php _e('Something went wrong and the data could not be updated.', ALM_NAME) ?>').removeClass('loading');
477
+ btn.removeClass('updating');
478
+ }
479
+ });
480
+
481
+ }
482
+ }
483
+
484
+
485
+
486
+ $(document).on('click', '.option-update' ,function(){
487
+ var btn = $(this),
488
+ editorId = btn.data('editor-id');
489
+ _alm_admin.updateRepeater(btn, editorId);
490
+ });
491
 
492
  });
493
  </script>
495
  <!-- End Repeaters -->
496
  </div>
497
  <div class="cnkt-sidebar">
498
+ <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/writeable.php'); ?>
499
+ <div class="cta">
500
  <h3><?php _e('Templating Help', ALM_NAME); ?></h3>
501
  <div class="item">
502
  <p><strong><?php _e('What is a repeater template?', ALM_NAME); ?></strong></p>
511
  <ul>
512
  <li><?php _e('Always open and close your templates with an HTML element. In some rare cases data may not be displayed if not wrapped in HTML.<br/>e.g. <code>&lt;li> &lt;/li></code> or <code>&lt;div> &lt;/div></code>', ALM_NAME); ?><br/> </li>
513
  </ul>
514
+ </div>
515
+ </div>
 
516
  </div>
517
  </div>
518
  </div>
534
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
535
  die('Get Bounced!');
536
 
537
+ // Get _POST Vars
538
  $c = Trim(stripslashes($_POST["value"])); // Repeater Value
539
  $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
540
  $t = Trim(stripslashes($_POST["type"])); // Repeater name
599
  }
600
 
601
 
602
+
603
+ /*
604
+ * alm_update_repeater
605
+ * Update repeater from database function
606
+ *
607
+ * - User story: User deletes plugin, the installs again and the version has not change - their default repeater will be in the default state and unable to be updated.
608
+ *
609
+ * COMING SOON
610
+ * @since 2.4
611
+ */
612
+
613
+ function alm_update_repeater(){
614
+ $nonce = $_POST["nonce"];
615
+ // Check our nonce, if they don't match then bounce!
616
+ if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
617
+ die('Get Bounced!');
618
+
619
+ // Get _POST Vars
620
+ $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
621
+ $t = Trim(stripslashes($_POST["type"])); // Repeater name
622
+
623
+ // Get value from database
624
+ //Save to database
625
+ global $wpdb;
626
+ $table_name = $wpdb->prefix . "alm";
627
+
628
+ if($t === 'default') $n = 'default';
629
+ if($t === 'unlimited') $table_name = $wpdb->prefix . "alm_unlimited";
630
+
631
+ $the_repeater = $wpdb->get_var("SELECT repeaterDefault FROM " . $table_name . " WHERE name = '$n'");
632
+
633
+
634
+
635
+ echo $the_repeater;
636
+
637
+ die();
638
+ }
639
+
640
+
641
+
642
  /*
643
  * alm_shortcode_builder_page
644
  * Shortcode Builder
647
  */
648
 
649
  function alm_shortcode_builder_page(){ ?>
650
+ <div class="admin ajax-load-more shortcode-builder" id="alm-builder">
651
  <div class="wrap">
652
  <div class="header-wrap">
653
  <h2><?php _e('Ajax Load More: Shortcode Builder', ALM_NAME); ?></h2>
662
  </div>
663
  </div>
664
  <div class="cnkt-sidebar">
665
+ <div class="table-of-contents">
666
+ <div class="cta">
667
+ <select class="toc"></select>
668
+ </div>
669
+ <div class="cta">
670
+ <h3><?php _e('Shortcode Output', ALM_NAME); ?></h3>
671
+ <p><?php _e('Place the following shortcode into the content editor or widget area of your theme.', ALM_NAME); ?></p>
672
+ <div class="output-wrap">
673
+ <div id="shortcode_output"></div>
674
+ <span class="copy"><?php _e('Copy', ALM_NAME); ?></span>
675
+ </div>
676
+ </div>
677
+ </div>
678
  </div>
679
  </div>
680
  </div>
735
  </div>
736
  <div class="cnkt-main forceColors">
737
  <div class="group">
738
+ <span class="toggle-all"><span class="inner-wrap"><em class="collapse"><?php _e('Collapse All', ALM_NAME); ?></em><em class="expand"><?php _e('Expand All', ALM_NAME); ?></em></span></span>
739
 
740
+ <div class="row gist" id="example-archive">
741
  <h3 class="heading"><?php _e('Archive.php', ALM_NAME); ?></h3>
742
  <div class="expand-wrap">
743
  <p><?php _e('Shortcode for use on generic archive page.', ALM_NAME); ?></p>
747
  </div>
748
  </div>
749
 
750
+ <div class="row gist" id="example-author">
751
  <h3 class="heading"><?php _e('Author.php', ALM_NAME); ?></h3>
752
  <div class="expand-wrap">
753
  <p><?php _e('Shortcode for use on author archive pages.', ALM_NAME); ?></p>
756
  </div>
757
  </div>
758
  </div>
759
+ <div class="row gist" id="example-category">
760
  <h3 class="heading"><?php _e('Category.php', ALM_NAME); ?></h3>
761
  <div class="expand-wrap">
762
  <p><?php _e('Shortcode for use on category archive pages.', ALM_NAME); ?></p>
765
  </div>
766
  </div>
767
  </div>
768
+ <div class="row gist" id="example-date">
769
+ <h3 class="heading"><?php _e('Date Archives', ALM_NAME); ?></h3>
770
+ <div class="expand-wrap">
771
+ <p><?php _e('Shortcode for use for archiving by date.', ALM_NAME); ?></p>
772
+ <div class="inner">
773
+ <script src="https://gist.github.com/dcooney/6f74bebdd40cad9e3ee7.js"></script>
774
+ </div>
775
+ </div>
776
+ </div>
777
+ <div class="row gist" id="example-exclude">
778
  <h3 class="heading"><?php _e('Excluding Posts', ALM_NAME); ?></h3>
779
  <div class="expand-wrap">
780
  <p><?php _e('Shortcode for excluding an array of posts.', ALM_NAME); ?></p>
782
  </div>
783
  </div>
784
 
785
+ <div class="row gist" id="example-tag">
786
  <h3 class="heading"><?php _e('Tag.php', ALM_NAME); ?></h3>
787
  <div class="expand-wrap">
788
  <p><?php _e('Shortcode for use on tag archive pages.', ALM_NAME); ?></p>
799
 
800
  </div>
801
  <div class="cnkt-sidebar">
802
+
803
+ <div class="cta">
804
+ <h3><?php _e('Did you know?', ALM_NAME); ?></h3>
805
+ <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/shortcode-editor.jpg"><br/>
806
+ <?php _e('<p class="addon-intro">You can generate shortcodes while editing pages!</p><p>Click the Ajax Load More icon in the content editor toolbar and the <a href="?page=ajax-load-more-shortcode-builder">shortcode builder</a> will open in an overlay window.', ALM_NAME); ?></p>
807
+ </div>
808
+
809
+ <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/resources.php'); ?>
810
+
811
  </div>
812
 
813
 
admin/css/admin.css CHANGED
@@ -92,6 +92,8 @@
92
  width: 100%;
93
  position: relative;
94
  font-size: 17px;
 
 
95
  }
96
  .ajax-load-more h3.heading:hover:after{
97
  color: #f05452;
@@ -103,7 +105,7 @@
103
  .ajax-load-more h3.heading:after{
104
  font-family: 'FontAwesome';
105
  content: '\f056';
106
- color:#e1e1e1;
107
  font-size: 18px;
108
  position: absolute;
109
  left: 10px;
@@ -114,6 +116,9 @@
114
  .ajax-load-more h3.heading.open:after{
115
  content:'\f055';
116
  }
 
 
 
117
 
118
  /* Expand/Collapse all rows */
119
  .ajax-load-more .toggle-all{
@@ -185,9 +190,10 @@
185
  .forceColors li{
186
  padding: 0 5% 0 0;
187
  margin: 0 0 5px;
188
- width: 49.75%;
189
  clear: both;
190
  display: inline-block;
 
191
  overflow: visible;
192
  }
193
 
@@ -284,6 +290,17 @@
284
  width: 60%;
285
  }
286
 
 
 
 
 
 
 
 
 
 
 
 
287
  .ajax-load-more input[type=number].sm{
288
  width: 100px;
289
  }
@@ -379,7 +396,7 @@
379
  overflow: hidden;
380
  }
381
 
382
-
383
  .jump-menu{
384
  position: absolute;
385
  top: 5px;
@@ -389,6 +406,34 @@
389
  .admin.ajax-load-more .jump-menu{
390
  display: none;
391
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
 
393
  .ajax-load-more .expand-wrap{
394
  display: block;
@@ -399,12 +444,12 @@
399
 
400
  .ajax-load-more .section-title{
401
  width: 40%;
402
- padding-top: 5px;
403
  float: left;
404
  }
405
  .ajax-load-more .section-title p{
406
  font-size: 13px !important;
407
- padding-left: 35px !important;
408
  color: #999;
409
  }
410
 
@@ -432,7 +477,7 @@
432
 
433
 
434
  .ajax-load-more .row .wrap{
435
- padding: 5px 0 0 3%;
436
  margin: 0;
437
  border: none;
438
  width: 60%;
@@ -877,7 +922,7 @@ table.highlight{
877
  /* Repeaters */
878
  .repeaters {}
879
  .repeaters .repeater-wrap{
880
- padding: 0 20px 10px 35px !important;
881
  }
882
  .repeater-wrap label{
883
  cursor: default;
@@ -1193,19 +1238,29 @@ table.highlight{
1193
  #unlmited-container{
1194
  margin: 0;
1195
  display: block;
1196
- overflow: hidden;
1197
  }
1198
  .admin.ajax-load-more .row.unlimited:first-of-type{
1199
  margin-top: 15px;
1200
  }
1201
- .repeaters .row.unlimited{
1202
- -webkit-transition: background-color 0.5s ease;
1203
- -moz-transition: background-color 0.5s ease;
1204
- transition: background-color 0.5s ease;
 
 
1205
  }
1206
  .repeaters .row:hover,
1207
- #alm-builder .row:hover{
 
 
1208
  border-color: #ccc;
 
 
 
 
 
 
1209
  }
1210
  .unlimited-wrap{
1211
  display: none;
@@ -1363,6 +1418,45 @@ table.highlight{
1363
  clear:both;
1364
  display:block;
1365
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1366
 
1367
 
1368
 
@@ -1379,7 +1473,20 @@ table.highlight{
1379
  }
1380
  }
1381
 
 
 
 
 
 
 
 
1382
  @media screen and (max-width: 900px){
 
 
 
 
 
 
1383
  .ajax-load-more .cnkt-main,
1384
  .ajax-load-more .cnkt-sidebar,
1385
  .ajax-load-more .cnkt-main.full {
@@ -1579,7 +1686,7 @@ table.highlight{
1579
  list-style: none;
1580
  display: block;
1581
  background-image: none;
1582
- padding: 6px 10px;
1583
  margin: 0;
1584
  border-top: 1px solid #efefef;
1585
  color: #666;
@@ -1594,6 +1701,7 @@ table.highlight{
1594
  margin: 0;
1595
  cursor: pointer;
1596
  min-height: 1em;
 
1597
  -webkit-touch-callout: none;
1598
  -webkit-user-select: none;
1599
  -khtml-user-select: none;
@@ -1604,7 +1712,7 @@ table.highlight{
1604
 
1605
  .select2-results .select2-highlighted {
1606
  background: #efefef;
1607
- color:#ca5252;
1608
  }
1609
 
1610
  .select2-results .select2-highlighted:active {
92
  width: 100%;
93
  position: relative;
94
  font-size: 17px;
95
+ background: #f7f7f7;
96
+ border-bottom: 1px solid #efefef;
97
  }
98
  .ajax-load-more h3.heading:hover:after{
99
  color: #f05452;
105
  .ajax-load-more h3.heading:after{
106
  font-family: 'FontAwesome';
107
  content: '\f056';
108
+ color: #ccc;
109
  font-size: 18px;
110
  position: absolute;
111
  left: 10px;
116
  .ajax-load-more h3.heading.open:after{
117
  content:'\f055';
118
  }
119
+ .ajax-load-more h3.heading.open{
120
+ border-bottom-color: transparent;
121
+ }
122
 
123
  /* Expand/Collapse all rows */
124
  .ajax-load-more .toggle-all{
190
  .forceColors li{
191
  padding: 0 5% 0 0;
192
  margin: 0 0 5px;
193
+ width: 48.666%;
194
  clear: both;
195
  display: inline-block;
196
+ vertical-align: top;
197
  overflow: visible;
198
  }
199
 
290
  width: 60%;
291
  }
292
 
293
+ .ajax-load-more .wrap-30{
294
+ width: 32.333%;
295
+ padding-right: 3%;
296
+ display: inline-block;
297
+ vertical-align: top;
298
+ }
299
+ .ajax-load-more .wrap-30 input[type=text].sm{
300
+ width: 100%;
301
+ margin: 0;
302
+ }
303
+
304
  .ajax-load-more input[type=number].sm{
305
  width: 100px;
306
  }
396
  overflow: hidden;
397
  }
398
 
399
+ /* Jump Menu */
400
  .jump-menu{
401
  position: absolute;
402
  top: 5px;
406
  .admin.ajax-load-more .jump-menu{
407
  display: none;
408
  }
409
+
410
+ /* Table of Contents */
411
+ .table-of-contents{}
412
+
413
+ .table-of-contents.attached{
414
+ position: fixed;
415
+ width: auto;
416
+ top: 70px;
417
+ }
418
+
419
+ .table-of-contents .select2-container{
420
+ width: 100%;
421
+ }
422
+
423
+
424
+
425
+ .table-of-contents ul{
426
+ margin: 0 !important;
427
+ }
428
+ .table-of-contents li{
429
+ width: auto !important;
430
+ display: inline-block;
431
+ vertical-align: top;
432
+ padding: 0;
433
+ margin: 5px 5px 5px 0;
434
+ }
435
+
436
+
437
 
438
  .ajax-load-more .expand-wrap{
439
  display: block;
444
 
445
  .ajax-load-more .section-title{
446
  width: 40%;
447
+ padding-top: 15px;
448
  float: left;
449
  }
450
  .ajax-load-more .section-title p{
451
  font-size: 13px !important;
452
+ padding-left: 10px !important;
453
  color: #999;
454
  }
455
 
477
 
478
 
479
  .ajax-load-more .row .wrap{
480
+ padding: 20px 0 0 3%;
481
  margin: 0;
482
  border: none;
483
  width: 60%;
922
  /* Repeaters */
923
  .repeaters {}
924
  .repeaters .repeater-wrap{
925
+ padding: 12px 15px 8px !important;
926
  }
927
  .repeater-wrap label{
928
  cursor: default;
1238
  #unlmited-container{
1239
  margin: 0;
1240
  display: block;
1241
+ overflow: visible;
1242
  }
1243
  .admin.ajax-load-more .row.unlimited:first-of-type{
1244
  margin-top: 15px;
1245
  }
1246
+
1247
+ .repeaters .row,
1248
+ .shortcode-builder .row{
1249
+ -webkit-transition: background-color 0.3s ease;
1250
+ -moz-transition: background-color 0.3s ease;
1251
+ transition: background-color 0.3s ease;
1252
  }
1253
  .repeaters .row:hover,
1254
+ .shortcode-builder .row:hover{
1255
+ /*
1256
+ box-shadow: 0 0 0 3px #efefef;
1257
  border-color: #ccc;
1258
+ */
1259
+ }
1260
+ .repeaters .row.no-brd:hover,
1261
+ .shortcode-builder .row.no-brd:hover{
1262
+ box-shadow: none;
1263
+ border-color: transparent;
1264
  }
1265
  .unlimited-wrap{
1266
  display: none;
1418
  clear:both;
1419
  display:block;
1420
  }
1421
+
1422
+
1423
+ /*
1424
+ * Form Replacements
1425
+ *
1426
+ * @since 2.4
1427
+ */
1428
+
1429
+ .shortcode-builder input[type=checkbox],
1430
+ .shortcode-builder input[type=radio] {
1431
+ display:none;
1432
+ }
1433
+
1434
+ .shortcode-builder input[type=checkbox] + label,
1435
+ .shortcode-builder input[type=radio] + label{
1436
+ background: #fff url(../img/bkg-chkbox_off.png) no-repeat left top;
1437
+ height: auto;
1438
+ min-height: 20px;
1439
+ width: 100%;
1440
+ display:inline-block;
1441
+ padding: 1px 0 0 26px;
1442
+ margin: 0 0 5px;
1443
+ font-size: 13px;
1444
+ }
1445
+ .shortcode-builder input[type=radio] + label{
1446
+ background: #fff url(../img/bkg-radio_off.png) no-repeat left top;
1447
+ }
1448
+
1449
+ .shortcode-builder input[type=checkbox]:checked + label{
1450
+ background-image: url(../img/bkg-chkbox_on.png);
1451
+ }
1452
+ .shortcode-builder input[type=radio]:checked + label{
1453
+ background-image: url(../img/bkg-radio_on.png);
1454
+ }
1455
+
1456
+ .shortcode-builder input[type=checkbox] + label:hover,
1457
+ .shortcode-builder input[type=radio] + label:hover{
1458
+ color: #000;
1459
+ }
1460
 
1461
 
1462
 
1473
  }
1474
  }
1475
 
1476
+
1477
+ @media screen and (max-width: 960px){
1478
+
1479
+
1480
+
1481
+ }
1482
+
1483
  @media screen and (max-width: 900px){
1484
+
1485
+ .table-of-contents{
1486
+ position: static !important;
1487
+ width: 100% !important;
1488
+ }
1489
+
1490
  .ajax-load-more .cnkt-main,
1491
  .ajax-load-more .cnkt-sidebar,
1492
  .ajax-load-more .cnkt-main.full {
1686
  list-style: none;
1687
  display: block;
1688
  background-image: none;
1689
+ padding: 0;
1690
  margin: 0;
1691
  border-top: 1px solid #efefef;
1692
  color: #666;
1701
  margin: 0;
1702
  cursor: pointer;
1703
  min-height: 1em;
1704
+ padding: 10px;
1705
  -webkit-touch-callout: none;
1706
  -webkit-user-select: none;
1707
  -khtml-user-select: none;
1712
 
1713
  .select2-results .select2-highlighted {
1714
  background: #efefef;
1715
+ color: #ff5a58;
1716
  }
1717
 
1718
  .select2-results .select2-highlighted:active {
admin/editor-build.php CHANGED
@@ -32,7 +32,7 @@ tinyMCEPopup.onInit.add(AjaxLoadMoreModal.init, AjaxLoadMoreModal);
32
  <?php $is_modal = true; ?>
33
  </head>
34
  <body>
35
- <div id="alm-container" class="ajax-load-more">
36
  <select class="jump-menu">
37
  <option value="null" selected="selected">-- <?php _e('Jump to section', ALM_NAME); ?> --</option>
38
  </select>
32
  <?php $is_modal = true; ?>
33
  </head>
34
  <body>
35
+ <div id="alm-container" class="ajax-load-more shortcode-builder">
36
  <select class="jump-menu">
37
  <option value="null" selected="selected">-- <?php _e('Jump to section', ALM_NAME); ?> --</option>
38
  </select>
admin/editor.php CHANGED
@@ -34,6 +34,10 @@ function alm_shortcode_buttons() {
34
 
35
  // Check options for hiding shortcode builder
36
  $options = get_option( 'alm_settings' );
 
 
 
 
37
  if($options['_alm_hide_btn'] != '1'){
38
  // Add only in Rich Editor mode
39
  if ( get_user_option('rich_editing') == 'true') {
34
 
35
  // Check options for hiding shortcode builder
36
  $options = get_option( 'alm_settings' );
37
+
38
+ if(!isset($options['_alm_hide_btn'])) // Check if '_alm_hide_btn isset
39
+ $options['_alm_hide_btn'] = '0';
40
+
41
  if($options['_alm_hide_btn'] != '1'){
42
  // Add only in Rich Editor mode
43
  if ( get_user_option('rich_editing') == 'true') {
admin/img/bkg-chkbox_off.png ADDED
Binary file
admin/img/bkg-chkbox_on.png ADDED
Binary file
admin/img/bkg-radio_off.png ADDED
Binary file
admin/img/bkg-radio_on.png ADDED
Binary file
admin/js/editor-btn.js CHANGED
@@ -8,7 +8,7 @@
8
  if(h > 600) h = 600;
9
  editor.addCommand('mcebutton', function () {
10
  editor.windowManager.open({
11
- title: "Ajax load More: Shortcode Builder",
12
  file: ajaxurl + '?action=fscb', // file that contains HTML for our modal window
13
  width: w, // size of our window
14
  height: h , // size of our window
8
  if(h > 600) h = 600;
9
  editor.addCommand('mcebutton', function () {
10
  editor.windowManager.open({
11
+ title: "Ajax Load More: Shortcode Builder",
12
  file: ajaxurl + '?action=fscb', // file that contains HTML for our modal window
13
  width: w, // size of our window
14
  height: h , // size of our window
admin/shortcode-builder/js/shortcode-builder.js CHANGED
@@ -122,6 +122,24 @@ jQuery(document).ready(function($) {
122
  if(tag !== '' && tag !== undefined)
123
  output += ' tag="'+tag+'"';
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  // ---------------------------
126
  // - Authors
127
  // ---------------------------
@@ -198,7 +216,7 @@ jQuery(document).ready(function($) {
198
  // - Post Offset
199
  // ---------------------------
200
 
201
- var offset = $('.offset select').val();
202
  if(offset > 0)
203
  output += ' offset="'+offset+'"';
204
 
@@ -207,8 +225,8 @@ jQuery(document).ready(function($) {
207
  // - Posts Per Page
208
  // ---------------------------
209
 
210
- var posts_per_page = $('.posts_per_page select').val();
211
- if(posts_per_page > 0 && posts_per_page !== 5 && $('.posts_per_page select').hasClass('changed'))
212
  output += ' posts_per_page="'+posts_per_page+'"';
213
 
214
 
@@ -224,9 +242,9 @@ jQuery(document).ready(function($) {
224
  output += ' scroll="false"';
225
  }else{
226
  $('.row.max_pages').slideDown(100, 'alm_easeInOutQuad');
227
- if($('.max_pages select').hasClass('changed'))
228
- output += ' max_pages="'+$('.max_pages select').val()+'"';
229
-
230
  }
231
 
232
 
@@ -292,28 +310,45 @@ jQuery(document).ready(function($) {
292
  });
293
 
294
 
295
- $('.search-term input, .exclude input, .btn-label input').keyup(function() {
296
- $(this).addClass('changed');
297
- _alm.buildShortcode();
 
 
 
 
 
 
 
 
 
 
298
  });
299
 
300
 
301
 
302
  /*
303
- * Jump to section
304
  *
305
  * @since 2.0.0
 
306
  */
307
 
308
  var jumpOptions = '';
 
309
  $('.row').each(function(){
310
- var id = $(this).attr('id');
311
- var title = $(this).find('h3.heading').text();
312
- jumpOptions += '<option value="'+id+'">'+title+'</option>';
 
 
313
  });
314
 
315
- $('select.jump-menu').append(jumpOptions);
316
 
 
 
 
 
317
  $('select.jump-menu').change(function() {
318
  var pos = $(this).val();
319
  if(pos !== 'null'){
@@ -322,7 +357,41 @@ jQuery(document).ready(function($) {
322
  }, 200, 'alm_easeInOutQuad');
323
  }
324
  });
325
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
 
327
  /*
328
  * Expand/Collapse shortcode headings
@@ -431,6 +500,7 @@ jQuery(document).ready(function($) {
431
 
432
 
433
 
 
434
  /*
435
  * _alm.copyToClipboard
436
  * Copy shortcode to clipboard
@@ -448,6 +518,7 @@ jQuery(document).ready(function($) {
448
  });
449
 
450
 
 
451
 
452
 
453
  });
122
  if(tag !== '' && tag !== undefined)
123
  output += ' tag="'+tag+'"';
124
 
125
+ // ---------------------------
126
+ // - Date
127
+ // ---------------------------
128
+ var currentTime = new Date(),
129
+ currentYear = currentTime.getFullYear();
130
+
131
+ var dateY = $('.date input#input-year').val(); // Year
132
+ if(dateY !== '' && dateY !== undefined && dateY <= currentYear)
133
+ output += ' year="'+dateY+'"';
134
+
135
+ var dateM = $('.date input#input-month').val(); // Month
136
+ if(dateM !== '' && dateM !== undefined && dateM < 13)
137
+ output += ' month="'+dateM+'"';
138
+
139
+ var dateD = $('.date input#input-day').val(); // Day
140
+ if(dateD !== '' && dateD !== undefined && dateD < 32)
141
+ output += ' day="'+dateD+'"';
142
+
143
  // ---------------------------
144
  // - Authors
145
  // ---------------------------
216
  // - Post Offset
217
  // ---------------------------
218
 
219
+ var offset = $('.offset input').val();
220
  if(offset > 0)
221
  output += ' offset="'+offset+'"';
222
 
225
  // - Posts Per Page
226
  // ---------------------------
227
 
228
+ var posts_per_page = $('.posts_per_page input').val();
229
+ if(posts_per_page > 0 && posts_per_page != 5)
230
  output += ' posts_per_page="'+posts_per_page+'"';
231
 
232
 
242
  output += ' scroll="false"';
243
  }else{
244
  $('.row.max_pages').slideDown(100, 'alm_easeInOutQuad');
245
+ var max_pages = $('.max_pages input').val();
246
+ if(max_pages > 0 && max_pages != 5)
247
+ output += ' max_pages="'+$('.max_pages input').val()+'"';
248
  }
249
 
250
 
310
  });
311
 
312
 
313
+ $("input.numbers-only").keydown(function (e) {
314
+ if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
315
+ // Allow: Ctrl+A
316
+ (e.keyCode == 65 && e.ctrlKey === true) ||
317
+ // Allow: home, end, left, right, down, up
318
+ (e.keyCode >= 35 && e.keyCode <= 40)) {
319
+ // let it happen, don't do anything
320
+ return;
321
+ }
322
+ // Ensure that it is a number and stop the keypress
323
+ if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
324
+ e.preventDefault();
325
+ }
326
  });
327
 
328
 
329
 
330
  /*
331
+ * Jump to section, Table of contents
332
  *
333
  * @since 2.0.0
334
+ * Updated v2.4
335
  */
336
 
337
  var jumpOptions = '';
338
+ var toc = '';
339
  $('.row').each(function(){
340
+ if(!$(this).hasClass('no-brd')){ // Special case for back 2 top on shortcode builder landing
341
+ var id = $(this).attr('id');
342
+ var title = $(this).find('h3.heading').text();
343
+ jumpOptions += '<option value="'+id+'">'+title+'</option>';
344
+ }
345
  });
346
 
 
347
 
348
+
349
+ /* Jump Menu */
350
+
351
+ $('select.jump-menu').append(jumpOptions);
352
  $('select.jump-menu').change(function() {
353
  var pos = $(this).val();
354
  if(pos !== 'null'){
357
  }, 200, 'alm_easeInOutQuad');
358
  }
359
  });
360
+
361
+
362
+
363
+ /* Table of Contents */
364
+ $('.table-of-contents .toc').append('<option value="#">-- Jump to Section --</option>');
365
+ $('.table-of-contents .toc').append(jumpOptions).select2();
366
+
367
+ $('.table-of-contents .toc').change(function() {
368
+ var pos = $(this).val();
369
+ if(pos !== 'null'){
370
+ $('html,body').animate({
371
+ scrollTop: $('#'+pos).offset().top - 50
372
+ }, 500, 'alm_easeInOutQuad');
373
+ }
374
+ });
375
+
376
+ function almResizeTOC(){
377
+ var tocW = $('.cnkt-sidebar').width();
378
+ $('.table-of-contents').css('width', tocW + 'px');
379
+ }
380
+ almResizeTOC();
381
+
382
+ $(window).resize(function() {
383
+ almResizeTOC()
384
+ });
385
+
386
+ $(window).scroll(function(){
387
+ var scrollT = $(window).scrollTop(),
388
+ target = 60;
389
+
390
+ if(scrollT > target)
391
+ $('.table-of-contents').addClass('attached');
392
+ else
393
+ $('.table-of-contents').removeClass('attached');
394
+ });
395
 
396
  /*
397
  * Expand/Collapse shortcode headings
500
 
501
 
502
 
503
+
504
  /*
505
  * _alm.copyToClipboard
506
  * Copy shortcode to clipboard
518
  });
519
 
520
 
521
+
522
 
523
 
524
  });
admin/shortcode-builder/shortcode-builder.php CHANGED
@@ -1,7 +1,6 @@
1
  <span class="toggle-all"><span class="inner-wrap"><em class="collapse"><?php _e('Collapse All', ALM_NAME); ?></em><em class="expand"><?php _e('Expand All', ALM_NAME); ?></em></span></span>
2
 
3
 
4
-
5
  <?php if(has_action('alm_seo_installed')){ ?>
6
  <!-- SEO -->
7
  <div class="row input seo" id="alm-seo">
@@ -29,13 +28,13 @@
29
  <?php } ?>
30
 
31
  <?php
32
-
33
  // List available repeaters
34
  echo '<div class="row repeater" id="alm-repeaters">';
35
  echo '<h3 class="heading">'.__('Template', ALM_NAME). '</h3>';
36
  echo '<div class="expand-wrap">';
37
  echo '<div class="section-title">';
38
- echo '<p>'.__('Select your <a href="admin.php?page=ajax-load-more-repeaters" target="_parent">repeater template</a>.', ALM_NAME). '</p>';
39
  echo '</div>';
40
  echo '<div class="wrap"><div class="inner">';
41
  echo '<select name="repeater-select" id="repeater-select" class="alm_element">';
@@ -92,6 +91,7 @@
92
  echo '</div>';
93
  }
94
 
 
95
  // List Post Formats
96
  if ( current_theme_supports( 'post-formats' ) ) {
97
  $post_formats = get_theme_support( 'post-formats' );
@@ -122,7 +122,7 @@
122
  echo '<h3 class="heading">' . __('Category', ALM_NAME) . '</h3>';
123
  echo '<div class="expand-wrap">';
124
  echo '<div class="section-title">';
125
- echo '<p>' . __('Select a Category to query(by slug).', ALM_NAME) . '</p>';
126
  echo '</div>';
127
  echo '<div class="wrap"><div class="inner"><select class="alm_element" name="category-select" id="category-select">';
128
  echo '<option value="" selected="selected">-- ' . __('Select Category', ALM_NAME) . ' --</option>';
@@ -134,14 +134,14 @@
134
  echo '</div>';
135
  }
136
 
137
- // List Categories
138
  $tags = get_tags();
139
  if($tags){
140
  echo '<div class="row checkboxes tags" id="alm-tags">';
141
  echo '<h3 class="heading">' . __('Tag', ALM_NAME) . '</h3>';
142
  echo '<div class="expand-wrap">';
143
  echo '<div class="section-title">';
144
- echo '<p>' . __('Select a Tag to query(by slug).', ALM_NAME) . '</p>';
145
  echo '</div>';
146
  echo '<div class="wrap"><div class="inner"><select class="alm_element" name="tag-select" id="tag-select">';
147
  echo '<option value="" selected="selected">-- ' . __('Select Tag', ALM_NAME) . ' --</option>';
@@ -154,7 +154,7 @@
154
  }
155
 
156
 
157
- // List Taxonomies
158
  $tax_args = array(
159
  'public' => true,
160
  '_builtin' => false
@@ -199,6 +199,35 @@
199
  echo '</div>';
200
  echo '</div>';
201
  }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
  <?php // Custom Fields ?>
204
  <div class="row input meta-key" id="alm-meta-key">
@@ -242,16 +271,16 @@
242
  </div>
243
  </div>
244
  </div>
245
-
246
-
247
  <?php // List Authors
248
  $authors = get_users();
249
  if($authors){
250
- echo '<div class="row checkboxes authors" id="alm-tags">';
251
  echo '<h3 class="heading">' . __('Author', ALM_NAME) . '</h3>';
252
  echo '<div class="expand-wrap">';
253
  echo '<div class="section-title">';
254
- echo '<p>' . __('Select an Author to query(by ID).', ALM_NAME) . '</p>';
255
  echo '</div>';
256
  echo '<div class="wrap"><div class="inner"><select class="alm_element" name="author-select" id="author-select">';
257
  echo '<option value="" selected="selected">-- ' . __('Select Author', ALM_NAME) . ' --</option>';
@@ -262,7 +291,8 @@
262
  echo '</div>';
263
  echo '</div>';
264
  }
265
- ?>
 
266
 
267
  <!-- Search term -->
268
  <div class="row input search-term" id="alm-search">
@@ -301,7 +331,7 @@
301
  <option value="title">Title</option>
302
  <option value="name">Name (slug)</option>
303
  <option value="menu_order">Menu Order</option>
304
- <option value="rand">Random</option>
305
  <option value="author">Author</option>
306
  <option value="ID">ID</option>
307
  <option value="comment_count">Comment Count</option>
@@ -316,7 +346,7 @@
316
  <h3 class="heading"><?php _e('Exclude', ALM_NAME); ?></h3>
317
  <div class="expand-wrap">
318
  <div class="section-title">
319
- <p><?php _e('A comma separated list of post ID\'s to exclude from query.', ALM_NAME); ?></p>
320
  </div>
321
  <div class="wrap">
322
  <div class="inner">
@@ -334,17 +364,8 @@
334
  <p><?php _e('Offset the initial WordPress query by <em>\'n\'</em> number of posts', ALM_NAME); ?></p>
335
  </div>
336
  <div class="wrap">
337
- <div class="inner">
338
- <select class="alm_element" name="offset-select" id="offset-select">
339
- <script>
340
- var length = 21,
341
- value = '';
342
- for(var i = 0; i < length; i++){
343
- value += '<option value="'+i+'">'+i+'</option>';
344
- }
345
- jQuery('#offset-select').append(value);
346
- </script>
347
- </select>
348
  </div>
349
  </div>
350
  </div>
@@ -359,20 +380,7 @@
359
  </div>
360
  <div class="wrap">
361
  <div class="inner">
362
- <select class="alm_element" name="display_posts-select" id="display_posts-select">
363
- <script>
364
- var length = 31,
365
- value = '';
366
- for(var i = 1; i < length; i++){
367
- if(i == 5){
368
- value += '<option value="'+i+'" selected="selected">'+i+'</option>';
369
- }else{
370
- value += '<option value="'+i+'">'+i+'</option>';
371
- }
372
- }
373
- jQuery('#display_posts-select').append(value);
374
- </script>
375
- </select>
376
  </div>
377
  </div>
378
  </div>
@@ -413,21 +421,8 @@
413
  </div>
414
  <div class="wrap">
415
  <div class="inner">
416
- <select class="alm_element" name="max-select" id="max-select">
417
- <script>
418
- var length = 11,
419
- value = '';
420
- for(var i = 1; i < length; i++){
421
- if(i == 5){
422
- value += '<option value="'+i+'" selected="selected">'+i+'</option>';
423
- }else{
424
- value += '<option value="'+i+'">'+i+'</option>';
425
- }
426
- }
427
- value += '<option value="none"><?php _e('Unlimited', ALM_NAME); ?></option>';
428
- jQuery('#max-select').append(value);
429
- </script>
430
- </select>
431
  </div>
432
  </div>
433
  </div>
1
  <span class="toggle-all"><span class="inner-wrap"><em class="collapse"><?php _e('Collapse All', ALM_NAME); ?></em><em class="expand"><?php _e('Expand All', ALM_NAME); ?></em></span></span>
2
 
3
 
 
4
  <?php if(has_action('alm_seo_installed')){ ?>
5
  <!-- SEO -->
6
  <div class="row input seo" id="alm-seo">
28
  <?php } ?>
29
 
30
  <?php
31
+
32
  // List available repeaters
33
  echo '<div class="row repeater" id="alm-repeaters">';
34
  echo '<h3 class="heading">'.__('Template', ALM_NAME). '</h3>';
35
  echo '<div class="expand-wrap">';
36
  echo '<div class="section-title">';
37
+ echo '<p>'.__('Select a <a href="admin.php?page=ajax-load-more-repeaters" target="_parent">repeater template</a>.', ALM_NAME). '</p>';
38
  echo '</div>';
39
  echo '<div class="wrap"><div class="inner">';
40
  echo '<select name="repeater-select" id="repeater-select" class="alm_element">';
91
  echo '</div>';
92
  }
93
 
94
+
95
  // List Post Formats
96
  if ( current_theme_supports( 'post-formats' ) ) {
97
  $post_formats = get_theme_support( 'post-formats' );
122
  echo '<h3 class="heading">' . __('Category', ALM_NAME) . '</h3>';
123
  echo '<div class="expand-wrap">';
124
  echo '<div class="section-title">';
125
+ echo '<p>' . __('Select a Category to query(by slug).', ALM_NAME) . '<br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-catgory">view example</a></p>';
126
  echo '</div>';
127
  echo '<div class="wrap"><div class="inner"><select class="alm_element" name="category-select" id="category-select">';
128
  echo '<option value="" selected="selected">-- ' . __('Select Category', ALM_NAME) . ' --</option>';
134
  echo '</div>';
135
  }
136
 
137
+ // Tags
138
  $tags = get_tags();
139
  if($tags){
140
  echo '<div class="row checkboxes tags" id="alm-tags">';
141
  echo '<h3 class="heading">' . __('Tag', ALM_NAME) . '</h3>';
142
  echo '<div class="expand-wrap">';
143
  echo '<div class="section-title">';
144
+ echo '<p>' . __('Select a Tag to query(by slug).', ALM_NAME) . '<br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-tag">view example</a></p>';
145
  echo '</div>';
146
  echo '<div class="wrap"><div class="inner"><select class="alm_element" name="tag-select" id="tag-select">';
147
  echo '<option value="" selected="selected">-- ' . __('Select Tag', ALM_NAME) . ' --</option>';
154
  }
155
 
156
 
157
+ // Taxonomies
158
  $tax_args = array(
159
  'public' => true,
160
  '_builtin' => false
199
  echo '</div>';
200
  echo '</div>';
201
  }?>
202
+
203
+
204
+ <!-- Date -->
205
+ <div class="row input date" id="alm-date">
206
+ <h3 class="heading"><?php _e('Date', ALM_NAME); ?></h3>
207
+ <div class="expand-wrap">
208
+ <div class="section-title">
209
+ <p><?php _e('Enter a year, month(number) and day to query by date archive.<br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-date">view example</a>', ALM_NAME); ?></p>
210
+ </div>
211
+ <div class="wrap">
212
+ <div class="inner">
213
+ <div class="wrap-30">
214
+ <?php $today = getdate(); ?>
215
+ <label for="input-year" class="full"><?php _e('Year:', ALM_NAME); ?></label>
216
+ <input name="input-year" class="alm_element sm numbers-only" type="text" id="input-year" maxlength="4" placeholder="<?php echo $today['year']; ?>">
217
+ </div>
218
+ <div class="wrap-30">
219
+ <label for="input-month" class="full"><?php _e('Month:', ALM_NAME); ?></label>
220
+ <input name="input-month" class="alm_element sm numbers-only" type="text" id="input-month" maxlength="2" placeholder="<?php echo $today['mon']; ?>">
221
+ </div>
222
+ <div class="wrap-30">
223
+ <label for="input-day" class="full"><?php _e('Day:', ALM_NAME); ?></label>
224
+ <input name="input-day" class="alm_element sm numbers-only" type="text" id="input-day" maxlength="2" placeholder="<?php echo $today['mday']; ?>">
225
+ </div>
226
+ </div>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
 
232
  <?php // Custom Fields ?>
233
  <div class="row input meta-key" id="alm-meta-key">
271
  </div>
272
  </div>
273
  </div>
274
+
275
+
276
  <?php // List Authors
277
  $authors = get_users();
278
  if($authors){
279
+ echo '<div class="row checkboxes authors" id="alm-authors">';
280
  echo '<h3 class="heading">' . __('Author', ALM_NAME) . '</h3>';
281
  echo '<div class="expand-wrap">';
282
  echo '<div class="section-title">';
283
+ echo '<p>' . __('Select an Author to query(by ID).', ALM_NAME) . '<br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-author">view example</a></p>';
284
  echo '</div>';
285
  echo '<div class="wrap"><div class="inner"><select class="alm_element" name="author-select" id="author-select">';
286
  echo '<option value="" selected="selected">-- ' . __('Select Author', ALM_NAME) . ' --</option>';
291
  echo '</div>';
292
  echo '</div>';
293
  }
294
+ ?>
295
+
296
 
297
  <!-- Search term -->
298
  <div class="row input search-term" id="alm-search">
331
  <option value="title">Title</option>
332
  <option value="name">Name (slug)</option>
333
  <option value="menu_order">Menu Order</option>
334
+ <!-- <option value="rand">Random</option> -->
335
  <option value="author">Author</option>
336
  <option value="ID">ID</option>
337
  <option value="comment_count">Comment Count</option>
346
  <h3 class="heading"><?php _e('Exclude', ALM_NAME); ?></h3>
347
  <div class="expand-wrap">
348
  <div class="section-title">
349
+ <p><?php _e('A comma separated list of post ID\'s to exclude from query.', ALM_NAME); ?><br/>&raquo; <a href="admin.php?page=ajax-load-more-examples#example-exclude">view example</a></p>
350
  </div>
351
  <div class="wrap">
352
  <div class="inner">
364
  <p><?php _e('Offset the initial WordPress query by <em>\'n\'</em> number of posts', ALM_NAME); ?></p>
365
  </div>
366
  <div class="wrap">
367
+ <div class="inner">
368
+ <input type="number" class="alm_element numbers-only" name="offset-select" id="offset-select" step="1" min="0">
 
 
 
 
 
 
 
 
 
369
  </div>
370
  </div>
371
  </div>
380
  </div>
381
  <div class="wrap">
382
  <div class="inner">
383
+ <input type="number" class="alm_element numbers-only" name="display_posts-select" id="display_posts-select" step="1" min="0" value="5">
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  </div>
385
  </div>
386
  </div>
421
  </div>
422
  <div class="wrap">
423
  <div class="inner">
424
+
425
+ <input type="number" class="alm_element numbers-only" name="max-select" id="max-select" step="1" min="0" value="5">
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  </div>
427
  </div>
428
  </div>
ajax-load-more.php CHANGED
@@ -6,12 +6,12 @@ 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.3.1
10
  License: GPL
11
  Copyright: Darren Cooney & Connekt Media
12
  */
13
- define('ALM_VERSION', '2.3.1');
14
- define('ALM_RELEASE', 'December 9, 2014');
15
  /*
16
  * alm_install
17
  * Create table for storing repeater
@@ -110,6 +110,7 @@ if( !class_exists('AjaxLoadMore') ):
110
 
111
  function alm_enqueue_scripts(){
112
  $options = get_option( 'alm_settings' );
 
113
  wp_enqueue_script( 'ajax-load-more', plugins_url( '/core/js/ajax-load-more.min.js', __FILE__ ), array('jquery'), '1.1', true );
114
  wp_localize_script(
115
  'ajax-load-more',
@@ -148,6 +149,9 @@ if( !class_exists('AjaxLoadMore') ):
148
  'meta_value' => '',
149
  'meta_compare' => '',
150
  'tag' => '',
 
 
 
151
  'author' => '',
152
  'search' => '',
153
  'order' => '',
@@ -179,7 +183,19 @@ if( !class_exists('AjaxLoadMore') ):
179
  $btn_color = ' '.$options['_alm_btn_color'];
180
  }
181
 
182
- $lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : '';
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  $ajaxloadmore = '<div id="ajax-load-more" class="ajax-load-more-wrap '. $btn_color .'">';
185
  $ajaxloadmore .= '<'.$container_element.' class="alm-listing'. $classname . '"';
@@ -194,6 +210,9 @@ if( !class_exists('AjaxLoadMore') ):
194
  $ajaxloadmore .= ' data-meta-key="'.$meta_key.'"';
195
  $ajaxloadmore .= ' data-meta-value="'.$meta_value.'"';
196
  $ajaxloadmore .= ' data-meta-compare="'.$meta_compare.'"';
 
 
 
197
  $ajaxloadmore .= ' data-author="'.$author.'"';
198
  $ajaxloadmore .= ' data-search="'.$search.'"';
199
  $ajaxloadmore .= ' data-order="'.$order.'"';
@@ -260,10 +279,7 @@ if( !class_exists('AjaxLoadMore') ):
260
  $ajaxloadmore .= ' data-seo-scroll="'.$seo_enable_scroll.'"';
261
  $ajaxloadmore .= ' data-seo-scroll-speed="'.$seo_scroll_speed.'"';
262
  $ajaxloadmore .= ' data-seo-permalink="'.$seo_permalink.'"';
263
-
264
- //Get posts per page option from /wp-admin/options-reading.php
265
- //$ajaxloadmore .= ' data-posts-per-page="'.$posts_per_page.'"';
266
-
267
  }
268
 
269
  $ajaxloadmore .= '></'.$container_element.'>';
@@ -275,19 +291,17 @@ if( !class_exists('AjaxLoadMore') ):
275
 
276
  /*
277
  * alm_query_posts
278
- * Ajax Load More Public Query
279
  *
280
  * @since 2.0.0
281
  */
282
 
283
- function alm_query_posts($bypass = false) {
284
 
285
- if(!$bypass){
286
  $nonce = $_GET['nonce'];
287
  // Check our nonce, if they don't match then bounce!
288
  if (! wp_verify_nonce( $nonce, 'ajax_load_more_nonce' ))
289
- die('Get Bounced!');
290
- }
291
 
292
  $repeater = (isset($_GET['repeater'])) ? $_GET['repeater'] : 'default';
293
  $type = preg_split('/(?=\d)/', $repeater, 2); // split $repeater vale at number to determine type
@@ -313,6 +327,10 @@ if( !class_exists('AjaxLoadMore') ):
313
  $meta_value = (isset($_GET['meta_value'])) ? $_GET['meta_value'] : '';
314
  $meta_compare = (isset($_GET['meta_compare'])) ? $_GET['meta_compare'] : '=';
315
 
 
 
 
 
316
  $order = (isset($_GET['order'])) ? $_GET['order'] : 'DESC';
317
  $orderby = (isset($_GET['orderby'])) ? $_GET['orderby'] : 'date';
318
  $exclude = (isset($_GET['exclude'])) ? $_GET['exclude'] : '';
@@ -369,7 +387,7 @@ if( !class_exists('AjaxLoadMore') ):
369
  // Post Format
370
  if(!empty($postFormat)){
371
  $format = "post-format-$postFormat";
372
- //If query is for standrd we need to filter by NOT IN
373
  if($format == 'post-format-standard'){
374
  if (($post_formats = get_theme_support('post-formats')) && is_array($post_formats[0]) && count($post_formats[0])) {
375
  $terms = array();
@@ -394,7 +412,7 @@ if( !class_exists('AjaxLoadMore') ):
394
  )
395
  );
396
  }
397
- }
398
 
399
  // Taxonomy
400
  if(!empty($taxonomy)){
@@ -408,7 +426,7 @@ if( !class_exists('AjaxLoadMore') ):
408
  'operator' => $taxonomy_operator
409
  ),
410
  );
411
- }
412
 
413
  // Meta Query
414
  if(!empty($meta_key) && !empty($meta_value)){
@@ -424,7 +442,19 @@ if( !class_exists('AjaxLoadMore') ):
424
  // Meta_key, used for ordering by meta value
425
  if(!empty($meta_key)){
426
  $args['meta_key'] = $meta_key;
427
- }
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
 
430
  // Set current page number for determining item number
@@ -479,7 +509,8 @@ if( !class_exists('AjaxLoadMore') ):
479
  $alm_loop_count++;
480
  $alm_page = $alm_page_count;
481
  $alm_total = ($alm_page_count * $numPosts) - $numPosts + $alm_loop_count;
482
- $alm_item = $alm_total;
 
483
 
484
  //Include repeater template
485
  include( $include );
6
  Author: Darren Cooney
7
  Twitter: @KaptonKaos
8
  Author URI: http://connekthq.com
9
+ Version: 2.4.0
10
  License: GPL
11
  Copyright: Darren Cooney & Connekt Media
12
  */
13
+ define('ALM_VERSION', '2.4.0');
14
+ define('ALM_RELEASE', 'January 5, 2015');
15
  /*
16
  * alm_install
17
  * Create table for storing repeater
110
 
111
  function alm_enqueue_scripts(){
112
  $options = get_option( 'alm_settings' );
113
+ //wp_enqueue_script( 'ajax-load-more', plugins_url( '/core/js/ajax-load-more.js', __FILE__ ), array('jquery'), '1.1', true );
114
  wp_enqueue_script( 'ajax-load-more', plugins_url( '/core/js/ajax-load-more.min.js', __FILE__ ), array('jquery'), '1.1', true );
115
  wp_localize_script(
116
  'ajax-load-more',
149
  'meta_value' => '',
150
  'meta_compare' => '',
151
  'tag' => '',
152
+ 'year' => '',
153
+ 'month' => '',
154
+ 'day' => '',
155
  'author' => '',
156
  'search' => '',
157
  'order' => '',
183
  $btn_color = ' '.$options['_alm_btn_color'];
184
  }
185
 
186
+ // Language support
187
+
188
+ // WPML - http://wpml.org
189
+ $lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : ''; // WPML
190
+
191
+ // Polylang - https://wordpress.org/plugins/polylang/
192
+ if (function_exists('pll_current_language'))
193
+ $lang = pll_current_language();
194
+
195
+ // qTranslate - https://wordpress.org/plugins/qtranslate/
196
+ if (function_exists('qtrans_getLanguage'))
197
+ $lang = qtrans_getLanguage();
198
+
199
 
200
  $ajaxloadmore = '<div id="ajax-load-more" class="ajax-load-more-wrap '. $btn_color .'">';
201
  $ajaxloadmore .= '<'.$container_element.' class="alm-listing'. $classname . '"';
210
  $ajaxloadmore .= ' data-meta-key="'.$meta_key.'"';
211
  $ajaxloadmore .= ' data-meta-value="'.$meta_value.'"';
212
  $ajaxloadmore .= ' data-meta-compare="'.$meta_compare.'"';
213
+ $ajaxloadmore .= ' data-year="'.$year.'"';
214
+ $ajaxloadmore .= ' data-month="'.$month.'"';
215
+ $ajaxloadmore .= ' data-day="'.$day.'"';
216
  $ajaxloadmore .= ' data-author="'.$author.'"';
217
  $ajaxloadmore .= ' data-search="'.$search.'"';
218
  $ajaxloadmore .= ' data-order="'.$order.'"';
279
  $ajaxloadmore .= ' data-seo-scroll="'.$seo_enable_scroll.'"';
280
  $ajaxloadmore .= ' data-seo-scroll-speed="'.$seo_scroll_speed.'"';
281
  $ajaxloadmore .= ' data-seo-permalink="'.$seo_permalink.'"';
282
+
 
 
 
283
  }
284
 
285
  $ajaxloadmore .= '></'.$container_element.'>';
291
 
292
  /*
293
  * alm_query_posts
294
+ * Ajax Load More Query
295
  *
296
  * @since 2.0.0
297
  */
298
 
299
+ function alm_query_posts() {
300
 
 
301
  $nonce = $_GET['nonce'];
302
  // Check our nonce, if they don't match then bounce!
303
  if (! wp_verify_nonce( $nonce, 'ajax_load_more_nonce' ))
304
+ die('Error, could not verify WP nonce.');
 
305
 
306
  $repeater = (isset($_GET['repeater'])) ? $_GET['repeater'] : 'default';
307
  $type = preg_split('/(?=\d)/', $repeater, 2); // split $repeater vale at number to determine type
327
  $meta_value = (isset($_GET['meta_value'])) ? $_GET['meta_value'] : '';
328
  $meta_compare = (isset($_GET['meta_compare'])) ? $_GET['meta_compare'] : '=';
329
 
330
+ $year = (isset($_GET['year'])) ? $_GET['year'] : '';
331
+ $month = (isset($_GET['month'])) ? $_GET['month'] : '';
332
+ $day = (isset($_GET['day'])) ? $_GET['day'] : '';
333
+
334
  $order = (isset($_GET['order'])) ? $_GET['order'] : 'DESC';
335
  $orderby = (isset($_GET['orderby'])) ? $_GET['orderby'] : 'date';
336
  $exclude = (isset($_GET['exclude'])) ? $_GET['exclude'] : '';
387
  // Post Format
388
  if(!empty($postFormat)){
389
  $format = "post-format-$postFormat";
390
+ //If query is for standard then we need to filter by NOT IN
391
  if($format == 'post-format-standard'){
392
  if (($post_formats = get_theme_support('post-formats')) && is_array($post_formats[0]) && count($post_formats[0])) {
393
  $terms = array();
412
  )
413
  );
414
  }
415
+ }
416
 
417
  // Taxonomy
418
  if(!empty($taxonomy)){
426
  'operator' => $taxonomy_operator
427
  ),
428
  );
429
+ }
430
 
431
  // Meta Query
432
  if(!empty($meta_key) && !empty($meta_value)){
442
  // Meta_key, used for ordering by meta value
443
  if(!empty($meta_key)){
444
  $args['meta_key'] = $meta_key;
445
+ }
446
+
447
+ // Date Archives
448
+ // Not using date_query for now. Issue with year/month archives
449
+ if(!empty($year)){
450
+ $args['year'] = $year;
451
+ }
452
+ if(!empty($month)){
453
+ $args['monthnum'] = $month;
454
+ }
455
+ if(!empty($day)){
456
+ $args['day'] = $day;
457
+ }
458
 
459
 
460
  // Set current page number for determining item number
509
  $alm_loop_count++;
510
  $alm_page = $alm_page_count;
511
  $alm_total = ($alm_page_count * $numPosts) - $numPosts + $alm_loop_count;
512
+ $alm_item = $alm_total;
513
+ $alm_found_posts = $alm_query->found_posts;
514
 
515
  //Include repeater template
516
  include( $include );
core/js/ajax-load-more.js CHANGED
@@ -157,6 +157,9 @@
157
  meta_key: alm.content.data('meta-key'),
158
  meta_value: alm.content.data('meta-value'),
159
  meta_compare: alm.content.data('meta-compare'),
 
 
 
160
  tag: alm.content.data('tag'),
161
  order: alm.content.data('order'),
162
  orderby: alm.content.data('orderby'),
157
  meta_key: alm.content.data('meta-key'),
158
  meta_value: alm.content.data('meta-value'),
159
  meta_compare: alm.content.data('meta-compare'),
160
+ year: alm.content.data('year'),
161
+ month: alm.content.data('month'),
162
+ day: alm.content.data('day'),
163
  tag: alm.content.data('tag'),
164
  order: alm.content.data('order'),
165
  orderby: alm.content.data('orderby'),
core/js/ajax-load-more.min.js CHANGED
@@ -11,6 +11,7 @@
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.init=true;alm.loading=true;alm.finished=false;alm.window=$(window);alm.button_label='';alm.data;alm.el=el;alm.content=$('.alm-listing',alm.el);alm.scroll=true;alm.prefix='alm-';alm.repeater=alm.content.data('repeater');alm.max_pages=alm.content.data('max-pages');alm.pause=alm.content.data('pause');alm.offset=alm.content.data('offset');alm.transition=alm.content.data('transition');alm.lang=alm.content.data('lang');alm.posts_per_page=alm.content.data('posts-per-page');alm.seo=alm.content.data('seo');if(alm.seo===undefined)
15
  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;}}
16
  $(window).scrollTop(0);if(alm.pause===undefined){alm.pause=false;}
@@ -21,7 +22,7 @@ if(alm.transition===undefined){alm.transition='slide';}else if(alm.transition===
21
  if(alm.content.data('offset')===undefined){alm.offset=0;}else{alm.offset=alm.content.data('offset');}
22
  if(alm.content.data('button-label')===undefined){alm.button_label='Older Posts';}else{alm.button_label=alm.content.data('button-label');}
23
  if(alm.content.data('scroll')===undefined){alm.scroll=true;}else if(alm.content.data('scroll')===false){alm.scroll=false;}else{alm.scroll=true;}
24
- 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_label+'</button></div>');alm.button=$('.alm-load-more-btn',alm.el);alm.AjaxLoadMore.loadPosts=function(){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,postFormat:alm.content.data('post-format'),category:alm.content.data('category'),author:alm.content.data('author'),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'),tag:alm.content.data('tag'),order:alm.content.data('order'),orderby:alm.content.data('orderby'),search:alm.content.data('search'),exclude:alm.content.data('exclude'),numPosts:alm.posts_per_page,pageNumber:alm.page,offset:alm.offset,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;}}
25
  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{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');}});}
26
  if($.isFunction($.fn.almComplete)){$.fn.almComplete(alm);}
27
  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;}},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();}
11
  * Twitter: @KaptonKaos
12
  */
13
 
14
+
15
  (function($){"use strict";$.ajaxloadmore=function(el){var alm=this;alm.AjaxLoadMore={};alm.page=0;alm.speed=300;alm.proceed=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.el);alm.scroll=true;alm.prefix='alm-';alm.repeater=alm.content.data('repeater');alm.max_pages=alm.content.data('max-pages');alm.pause=alm.content.data('pause');alm.offset=alm.content.data('offset');alm.transition=alm.content.data('transition');alm.lang=alm.content.data('lang');alm.posts_per_page=alm.content.data('posts-per-page');alm.seo=alm.content.data('seo');if(alm.seo===undefined)
16
  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;}}
17
  $(window).scrollTop(0);if(alm.pause===undefined){alm.pause=false;}
22
  if(alm.content.data('offset')===undefined){alm.offset=0;}else{alm.offset=alm.content.data('offset');}
23
  if(alm.content.data('button-label')===undefined){alm.button_label='Older Posts';}else{alm.button_label=alm.content.data('button-label');}
24
  if(alm.content.data('scroll')===undefined){alm.scroll=true;}else if(alm.content.data('scroll')===false){alm.scroll=false;}else{alm.scroll=true;}
25
+ 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_label+'</button></div>');alm.button=$('.alm-load-more-btn',alm.el);alm.AjaxLoadMore.loadPosts=function(){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,postFormat:alm.content.data('post-format'),category:alm.content.data('category'),author:alm.content.data('author'),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'),year:alm.content.data('year'),month:alm.content.data('month'),day:alm.content.data('day'),tag:alm.content.data('tag'),order:alm.content.data('order'),orderby:alm.content.data('orderby'),search:alm.content.data('search'),exclude:alm.content.data('exclude'),numPosts:alm.posts_per_page,pageNumber:alm.page,offset:alm.offset,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;}}
26
  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{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');}});}
27
  if($.isFunction($.fn.almComplete)){$.fn.almComplete(alm);}
28
  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;}},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();}