Post Grid - Version 2.1.6

Version Description

  • 2021-06-19 add - column number added for grid
Download this release

Release Info

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

Code changes from version 2.1.5 to 2.1.6

includes/metabox-post-grid-hook.php CHANGED
@@ -1411,9 +1411,9 @@ function post_grid_metabox_tabs_content_grid_settings($tab, $post_id){
1411
 
1412
  $post_grid_meta_options = get_post_meta($post_id, 'post_grid_meta_options', true);
1413
 
1414
- $items_width_desktop = !empty($post_grid_meta_options['width']['desktop']) ? $post_grid_meta_options['width']['desktop'] : '280px';
1415
- $items_width_tablet = !empty($post_grid_meta_options['width']['tablet']) ? $post_grid_meta_options['width']['tablet'] : '280px';
1416
- $items_width_mobile = !empty($post_grid_meta_options['width']['mobile']) ? $post_grid_meta_options['width']['mobile'] : '90%';
1417
 
1418
 
1419
 
@@ -1465,17 +1465,17 @@ function post_grid_metabox_tabs_content_grid_settings($tab, $post_id){
1465
  ?>
1466
  <div class="">
1467
  Desktop:(min-width:1024px)<br>
1468
- <input placeholder="250px or 30%" type="text" name="post_grid_meta_options[width][desktop]" value="<?php echo $items_width_desktop; ?>" />
1469
  </div>
1470
  <br>
1471
  <div class="">
1472
- Tablet:( min-width:768px )<br>
1473
- <input placeholder="250px or 30%" type="text" name="post_grid_meta_options[width][tablet]" value="<?php echo $items_width_tablet; ?>" />
1474
  </div>
1475
  <br>
1476
  <div class="">
1477
- Mobile:( min-width : 320px, )<br>
1478
- <input placeholder="250px or 30%" type="text" name="post_grid_meta_options[width][mobile]" value="<?php echo $items_width_mobile; ?>" />
1479
  </div>
1480
  <?php
1481
 
@@ -1483,8 +1483,8 @@ function post_grid_metabox_tabs_content_grid_settings($tab, $post_id){
1483
 
1484
  $args = array(
1485
  'id' => 'skins',
1486
- 'title' => __('Grid item width','post-grid'),
1487
- 'details' => __('Grid item width for different device, you can use % or px, em and etc, example: 80% or 250px','post-grid'),
1488
  'type' => 'custom_html',
1489
  'html' => $html,
1490
 
1411
 
1412
  $post_grid_meta_options = get_post_meta($post_id, 'post_grid_meta_options', true);
1413
 
1414
+ $items_width_desktop = !empty($post_grid_meta_options['width']['desktop']) ? $post_grid_meta_options['width']['desktop'] : 3;
1415
+ $items_width_tablet = !empty($post_grid_meta_options['width']['tablet']) ? $post_grid_meta_options['width']['tablet'] : 2;
1416
+ $items_width_mobile = !empty($post_grid_meta_options['width']['mobile']) ? $post_grid_meta_options['width']['mobile'] : 1;
1417
 
1418
 
1419
 
1465
  ?>
1466
  <div class="">
1467
  Desktop:(min-width:1024px)<br>
1468
+ <input placeholder="250px or 30% or column number(3)" type="text" name="post_grid_meta_options[width][desktop]" value="<?php echo $items_width_desktop; ?>" />
1469
  </div>
1470
  <br>
1471
  <div class="">
1472
+ Tablet:( min-width: 768px and max-width: 1023px )<br>
1473
+ <input placeholder="250px or 30% or column number(3)" type="text" name="post_grid_meta_options[width][tablet]" value="<?php echo $items_width_tablet; ?>" />
1474
  </div>
1475
  <br>
1476
  <div class="">
1477
+ Mobile:( max-width : 767px, )<br>
1478
+ <input placeholder="250px or 30% or column number(3)" type="text" name="post_grid_meta_options[width][mobile]" value="<?php echo $items_width_mobile; ?>" />
1479
  </div>
1480
  <?php
1481
 
1483
 
1484
  $args = array(
1485
  'id' => 'skins',
1486
+ 'title' => __('Grid item width or column number','post-grid'),
1487
+ 'details' => __('Grid item width for different device, you can use % or px, em and etc, example: 80% or 250px or column number(ex: 3)','post-grid'),
1488
  'type' => 'custom_html',
1489
  'html' => $html,
1490
 
post-grid.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Post Grid by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/
5
  Description: Awesome post grid for query post from any post type and display on grid.
6
- Version: 2.1.5
7
  Author: PickPlugins
8
  Author URI: https://www.pickplugins.com/
9
  License: GPLv2 or later
@@ -21,7 +21,7 @@ if( !class_exists( 'PostGrid' )){
21
  define('post_grid_plugin_dir', plugin_dir_path(__FILE__));
22
  define('post_grid_plugin_basename', plugin_basename(__FILE__));
23
  define('post_grid_plugin_name', 'Post Grid');
24
- define('post_grid_version', '2.1.5');
25
  define('post_grid_server_url', 'https://www.pickplugins.com/demo/post-grid/');
26
 
27
 
3
  Plugin Name: Post Grid by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/
5
  Description: Awesome post grid for query post from any post type and display on grid.
6
+ Version: 2.1.6
7
  Author: PickPlugins
8
  Author URI: https://www.pickplugins.com/
9
  License: GPLv2 or later
21
  define('post_grid_plugin_dir', plugin_dir_path(__FILE__));
22
  define('post_grid_plugin_basename', plugin_basename(__FILE__));
23
  define('post_grid_plugin_name', 'Post Grid');
24
+ define('post_grid_version', '2.1.6');
25
  define('post_grid_server_url', 'https://www.pickplugins.com/demo/post-grid/');
26
 
27
 
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: 5.7
7
- Stable tag: 2.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -222,6 +222,10 @@ then paste this shortcode anywhere in your page to display grid<br />
222
 
223
  == Changelog ==
224
 
 
 
 
 
225
  = 2.1.5 =
226
  * 2021-05-05 fix - php error issue fixed for old layouts users.
227
 
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: 5.7
7
+ Stable tag: 2.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
222
 
223
  == Changelog ==
224
 
225
+ = 2.1.6 =
226
+ * 2021-06-19 add - column number added for grid
227
+
228
+
229
  = 2.1.5 =
230
  * 2021-05-05 fix - php error issue fixed for old layouts users.
231
 
templates/post-grid-hook.php CHANGED
@@ -794,9 +794,15 @@ function post_grid_view_type_css_grid($args){
794
  $post_grid_options = $args['options'];
795
  $grid_id = $args['grid_id'];
796
 
797
- $items_width_desktop = isset($post_grid_options['width']['desktop']) ? $post_grid_options['width']['desktop'] : '';
798
- $items_width_tablet = isset($post_grid_options['width']['tablet']) ? $post_grid_options['width']['tablet'] : '';
799
- $items_width_mobile = isset($post_grid_options['width']['mobile']) ? $post_grid_options['width']['mobile'] : '';
 
 
 
 
 
 
800
 
801
  $items_height_style = !empty($post_grid_options['item_height']['style']) ? $post_grid_options['item_height']['style'] : 'auto_height';
802
  $items_height_style_tablet = !empty($post_grid_options['item_height']['style_tablet']) ? $post_grid_options['item_height']['style_tablet'] : 'auto_height';
@@ -889,8 +895,16 @@ function post_grid_view_type_css_grid($args){
889
  ?>
890
  }
891
  @media only screen and ( min-width: 0px ) and ( max-width: 767px ) {
 
 
 
 
 
 
 
 
892
  #post-grid-<?php echo $grid_id; ?> .item{
893
- <?php if(!empty($items_width_mobile)): ?>
894
  width:<?php echo $items_width_mobile; ?>;
895
  <?php endif; ?>
896
  <?php
@@ -907,8 +921,14 @@ function post_grid_view_type_css_grid($args){
907
  }
908
  }
909
  @media only screen and ( min-width: 768px ) and ( max-width: 1023px ) {
 
 
 
 
 
 
910
  #post-grid-<?php echo $grid_id; ?> .item{
911
- <?php if(!empty($items_width_tablet)): ?>
912
  width:<?php echo $items_width_tablet; ?>;
913
  <?php endif; ?>
914
  <?php
@@ -925,8 +945,16 @@ function post_grid_view_type_css_grid($args){
925
  }
926
  }
927
  @media only screen and (min-width: 1024px ){
 
 
 
 
 
 
 
 
928
  #post-grid-<?php echo $grid_id; ?> .item{
929
- <?php if(!empty($items_width_desktop)): ?>
930
  width:<?php echo $items_width_desktop; ?>;
931
  <?php endif; ?>
932
  <?php
794
  $post_grid_options = $args['options'];
795
  $grid_id = $args['grid_id'];
796
 
797
+ $items_width_desktop = isset($post_grid_options['width']['desktop']) ? $post_grid_options['width']['desktop'] : 3;
798
+ $items_width_tablet = isset($post_grid_options['width']['tablet']) ? $post_grid_options['width']['tablet'] : 2;
799
+ $items_width_mobile = isset($post_grid_options['width']['mobile']) ? $post_grid_options['width']['mobile'] : 1;
800
+
801
+ $items_width_desktop = (strpos($items_width_desktop, 'px') === false) ? (int)$items_width_desktop : $items_width_desktop;
802
+ $items_width_tablet = (strpos($items_width_tablet, 'px') === false) ? (int)$items_width_tablet : $items_width_tablet;
803
+ $items_width_mobile = (strpos($items_width_mobile, 'px') === false) ? (int)$items_width_mobile : $items_width_mobile;
804
+
805
+
806
 
807
  $items_height_style = !empty($post_grid_options['item_height']['style']) ? $post_grid_options['item_height']['style'] : 'auto_height';
808
  $items_height_style_tablet = !empty($post_grid_options['item_height']['style_tablet']) ? $post_grid_options['item_height']['style_tablet'] : 'auto_height';
895
  ?>
896
  }
897
  @media only screen and ( min-width: 0px ) and ( max-width: 767px ) {
898
+
899
+ #post-grid-<?php echo $grid_id; ?> .grid-items{
900
+ <?php if(is_integer($items_width_mobile)): ?>
901
+ columns: <?php echo $items_width_mobile; ?>;
902
+ <?php endif; ?>
903
+ }
904
+
905
+
906
  #post-grid-<?php echo $grid_id; ?> .item{
907
+ <?php if(!empty($items_width_mobile) && !is_integer($items_width_desktop)): ?>
908
  width:<?php echo $items_width_mobile; ?>;
909
  <?php endif; ?>
910
  <?php
921
  }
922
  }
923
  @media only screen and ( min-width: 768px ) and ( max-width: 1023px ) {
924
+ #post-grid-<?php echo $grid_id; ?> .grid-items{
925
+ <?php if(is_integer($items_width_tablet)): ?>
926
+ columns: <?php echo $items_width_tablet; ?>;
927
+ <?php endif; ?>
928
+ }
929
+
930
  #post-grid-<?php echo $grid_id; ?> .item{
931
+ <?php if(!empty($items_width_tablet) && !is_integer($items_width_desktop)): ?>
932
  width:<?php echo $items_width_tablet; ?>;
933
  <?php endif; ?>
934
  <?php
945
  }
946
  }
947
  @media only screen and (min-width: 1024px ){
948
+
949
+ #post-grid-<?php echo $grid_id; ?> .grid-items{
950
+ <?php if(is_integer($items_width_desktop)): ?>
951
+ columns: <?php echo $items_width_desktop; ?>;
952
+ <?php endif; ?>
953
+ }
954
+
955
+
956
  #post-grid-<?php echo $grid_id; ?> .item{
957
+ <?php if(!empty($items_width_desktop) && !is_integer($items_width_desktop)): ?>
958
  width:<?php echo $items_width_desktop; ?>;
959
  <?php endif; ?>
960
  <?php