Post Grid - Version 2.0.26

Version Description

  • 21/03/2018 add - Post grid search for individual grid on same page
    • 21/03/2018 add - Press enter to reset search result.
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Post Grid
Version 2.0.26
Comparing to
See all releases

Code changes from version 2.0.25 to 2.0.26

assets/frontend/js/scripts.js CHANGED
@@ -14,36 +14,55 @@ jQuery(document).ready(function($)
14
15
16
17
- $(document).on('keyup', '.post-grid .nav-search .search', function()
18
- {
19
- var keyword = $(this).val();
20
- var grid_id = $(this).attr('grid_id');
21
-
22
- if(keyword.length>3){
23
$(this).addClass('loading');
24
-
25
$('.pagination').fadeOut();
26
-
27
- $.ajax(
28
- {
29
- type: 'POST',
30
- context: this,
31
- url:post_grid_ajax.post_grid_ajaxurl,
32
- data: {"action": "post_grid_ajax_search", "grid_id":grid_id,"keyword":keyword,},
33
- success: function(data)
34
- {
35
-
36
- $('.post-grid .grid-items').html(data);
37
- $(this).removeClass('loading');
38
-
39
- }
40
- });
41
42
-
43
-
44
- }
45
46
- })
47
48
49
14
15
16
17
+ $(document).on('keyup', '.post-grid .nav-search .search', function(e){
18
+ var keyword = $(this).val();
19
+ var grid_id = $(this).attr('grid_id');
20
+
21
+ var key = e.which;
22
+ if(key == 13){
23
+ // the enter key code
24
+ var is_reset = 'yes';
25
+
26
+ $(this).addClass('loading');
27
+
28
+ $('.pagination').fadeOut();
29
+
30
+ $.ajax({
31
+ type: 'POST',
32
+ context: this,
33
+ url:post_grid_ajax.post_grid_ajaxurl,
34
+ data: {"action": "post_grid_ajax_search", "grid_id":grid_id,"keyword":keyword,"is_reset":is_reset,},
35
+ success: function(data){
36
+
37
+ $('#post-grid-'+grid_id+' .grid-items').html(data);
38
+ $(this).removeClass('loading');
39
+ }
40
+ });
41
+
42
+ }
43
+ else{
44
+ var is_reset = 'no';
45
+ if(keyword.length>3){
46
$(this).addClass('loading');
47
+
48
$('.pagination').fadeOut();
49
50
+ $.ajax({
51
+ type: 'POST',
52
+ context: this,
53
+ url:post_grid_ajax.post_grid_ajaxurl,
54
+ data: {"action": "post_grid_ajax_search", "grid_id":grid_id,"keyword":keyword,"is_reset":is_reset,},
55
+ success: function(data){
56
+
57
+ $('#post-grid-'+grid_id+' .grid-items').html(data);
58
+ $(this).removeClass('loading');
59
+ }
60
+ });
61
+ }
62
+
63
+ }
64
65
+ })
66
67
68
grid-items/nav-top-new.php CHANGED
@@ -20,9 +20,8 @@ if ( ! defined('ABSPATH')) exit; // if direct access
20
}
21
22
$html.= '<div class="nav-search">';
23
- $html.= '<input grid_id="'.$post_id.'" class="search" type="text" placeholder="'.__('Start typing...', 'post-grid').'" value="'.$keyword.'">';
24
-
25
- $html.= '</div>';
26
27
}
28
20
}
21
22
$html.= '<div class="nav-search">';
23
+ $html.= '<input grid_id="'.$post_id.'" class="search" title="'.__('Press enter to reset', 'post-grid').'" type="text" placeholder="'.__('Start typing...', 'post-grid').'" value="'.$keyword.'">';
24
+ $html.= '</div>';
25
26
}
27
includes/functions.php CHANGED
@@ -1339,42 +1339,49 @@ add_action('wp_ajax_nopriv_post_grid_ajax_load_more', 'post_grid_ajax_load_more'
1339
1340
function post_grid_ajax_search(){
1341
1342
- $html = '';
1343
- $post_id = sanitize_text_field($_POST['grid_id']);
1344
1345
- include post_grid_plugin_dir.'/grid-items/variables.php';
1346
-
1347
- $keyword = sanitize_text_field($_POST['keyword']);
1348
-
1349
- include post_grid_plugin_dir.'/grid-items/query.php';
1350
-
1351
- if ( $wp_query->have_posts() ) :
1352
- while ( $wp_query->have_posts() ) : $wp_query->the_post();
1353
1354
-
1355
- $html.='<div class="item skin '.$skin.' '.post_grid_term_slug_list(get_the_ID()).'">';
1356
-
1357
- include post_grid_plugin_dir.'/grid-items/layer-media.php';
1358
- include post_grid_plugin_dir.'/grid-items/layer-content.php';
1359
- include post_grid_plugin_dir.'/grid-items/layer-hover.php';
1360
-
1361
- $html.='</div>'; // .item
1362
-
1363
- endwhile;
1364
- wp_reset_query();
1365
- else:
1366
-
1367
- $html.='<div class="item">';
1368
- $html.=__('No Post found','post-grid'); // .item
1369
- $html.='</div>'; // .item
1370
-
1371
- endif;
1372
-
1373
- echo $html;
1374
-
1375
- die();
1376
1377
- }
1378
1379
add_action('wp_ajax_post_grid_ajax_search', 'post_grid_ajax_search');
1380
add_action('wp_ajax_nopriv_post_grid_ajax_search', 'post_grid_ajax_search');
1339
1340
function post_grid_ajax_search(){
1341
1342
+ $html = '';
1343
+ $post_id = sanitize_text_field($_POST['grid_id']);
1344
+ $is_reset = sanitize_text_field($_POST['is_reset']);
1345
1346
+ include post_grid_plugin_dir.'/grid-items/variables.php';
1347
1348
+ $keyword = '';
1349
+
1350
+ if($is_reset=='no'){
1351
+ $keyword = sanitize_text_field($_POST['keyword']);
1352
+ }
1353
+
1354
+
1355
+
1356
+ include post_grid_plugin_dir.'/grid-items/query.php';
1357
+
1358
+ if ( $wp_query->have_posts() ) :
1359
+ while ( $wp_query->have_posts() ) : $wp_query->the_post();
1360
+
1361
+
1362
+ $html.='<div class="item skin '.$skin.' '.post_grid_term_slug_list(get_the_ID()).'">';
1363
+
1364
+ include post_grid_plugin_dir.'/grid-items/layer-media.php';
1365
+ include post_grid_plugin_dir.'/grid-items/layer-content.php';
1366
+ include post_grid_plugin_dir.'/grid-items/layer-hover.php';
1367
+
1368
+ $html.='</div>'; // .item
1369
+
1370
+ endwhile;
1371
+ wp_reset_query();
1372
+ else:
1373
+
1374
+ $html.='<div class="item">';
1375
+ $html.=__('No Post found','post-grid'); // .item
1376
+ $html.='</div>'; // .item
1377
+
1378
+ endif;
1379
+
1380
+ echo $html;
1381
+
1382
+ die();
1383
1384
+ }
1385
1386
add_action('wp_ajax_post_grid_ajax_search', 'post_grid_ajax_search');
1387
add_action('wp_ajax_nopriv_post_grid_ajax_search', 'post_grid_ajax_search');
post-grid.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Post Grid
4
Plugin URI: http://pickplugins.com
5
Description: Awesome post grid for query post from any post type and display on grid.
6
- Version: 2.0.25
7
Author: pickplugins
8
Author URI: http://pickplugins.com
9
Text Domain: post-grid
@@ -28,7 +28,7 @@ class PostGrid{
28
define('post_grid_conatct_url', 'http://pickplugins.com/contact/' );
29
define('post_grid_qa_url', 'http://www.pickplugins.com/questions/' );
30
define('post_grid_plugin_name', 'Post Grid' );
31
- define('post_grid_version', '2.0.25' );
32
define('post_grid_customer_type', 'free' );
33
define('post_grid_share_url', 'https://wordpress.org/plugins/post-grid/' );
34
3
Plugin Name: Post Grid
4
Plugin URI: http://pickplugins.com
5
Description: Awesome post grid for query post from any post type and display on grid.
6
+ Version: 2.0.26
7
Author: pickplugins
8
Author URI: http://pickplugins.com
9
Text Domain: post-grid
28
define('post_grid_conatct_url', 'http://pickplugins.com/contact/' );
29
define('post_grid_qa_url', 'http://www.pickplugins.com/questions/' );
30
define('post_grid_plugin_name', 'Post Grid' );
31
+ define('post_grid_version', '2.0.26' );
32
define('post_grid_customer_type', 'free' );
33
define('post_grid_share_url', 'https://wordpress.org/plugins/post-grid/' );
34
readme.txt CHANGED
@@ -4,7 +4,7 @@
4
Tags: post grid, grid, custom post grid, post type grid, grid display, category filter, custom post, filter, filtering, grid, layout, list, masonry, post, post filter, post layout, taxonomy, taxonomy filter,
5
Requires at least: 3.8
6
Tested up to: 4.9
7
- Stable tag: 2.0.25
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -104,6 +104,10 @@ then paste this shortcode anywhere in your page to display grid<br />
104
== Changelog ==
105
106
107
= 2.0.25 =
108
* 15/02/2018 fix - Offset issue fixed.
109
4
Tags: post grid, grid, custom post grid, post type grid, grid display, category filter, custom post, filter, filtering, grid, layout, list, masonry, post, post filter, post layout, taxonomy, taxonomy filter,
5
Requires at least: 3.8
6
Tested up to: 4.9
7
+ Stable tag: 2.0.26
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
104
== Changelog ==
105
106
107
+ = 2.0.26 =
108
+ * 21/03/2018 add - Post grid search for individual grid on same page
109
+ * 21/03/2018 add - Press enter to reset search result.
110
+
111
= 2.0.25 =
112
* 15/02/2018 fix - Offset issue fixed.
113