The Post Grid - Version 1.6

Version Description

  • Excerpt limit in word or characters
  • User define excerpt ending(... )
  • Title and button color control
  • Image overlay control
  • Improve coding style
Download this release

Release Info

Developer techlabpro1
Plugin Icon 128x128 The Post Grid
Version 1.6
Comparing to
See all releases

Code changes from version 1.5 to 1.6

README.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: techlabpro1
3
  Donate link:
4
  Tags: post grid, content grid, post display, post format, post view, blog display, news display, post
5
- Requires at least: 3.5
6
  Tested up to: 4.7
7
- Stable tag: 1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,7 +12,7 @@ Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter
12
 
13
  == Description ==
14
 
15
- [Plugin Demo](http://demo.radiustheme.com/wordpress/plugins/the-post-grid/) [Documentation](https://radiustheme.com/how-to-setup-configure-the-post-grid-free-version-for-wordpress/)
16
 
17
  The Post Grid is a fully Responsive & Mobile friendly plugin to display your page/post in Grid, List and Isotope View without any line of coding. It is fast and easy to generate grid from admin end and insert into page/post. You can Display posts by any category(s), tag(s), author(s), keyword(s) also Order posts by Id, Title, Created date, Modified date and Menu order.
18
 
@@ -24,6 +24,10 @@ By using The Post Grid plugin you can dispay your post in Grid List & Isotope vi
24
  * Fully responsive and mobile friendly.
25
  * 4 Different Layouts
26
  * Generate Unlimited grid.
 
 
 
 
27
  * Custom number of post per page.
28
  * Use posts or pages as the source
29
  * Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)
@@ -56,7 +60,7 @@ For any bug or suggestion please mail support@radiustheme.com
56
 
57
  = PRO Features =
58
  * Fully responsive and mobile friendly.
59
- * 48 Different Layouts
60
  * Even and Masonry Grid.
61
  * WooCommerce supported.
62
  * Custom Post Type Supported
@@ -132,6 +136,13 @@ For any bug or suggestion please mail support@radiustheme.com
132
 
133
  == Changelog ==
134
 
 
 
 
 
 
 
 
135
  = 1.5 =
136
  * Layout fix
137
  * Min Height issue fixed for mobile
2
  Contributors: techlabpro1
3
  Donate link:
4
  Tags: post grid, content grid, post display, post format, post view, blog display, news display, post
5
+ Requires at least: 4
6
  Tested up to: 4.7
7
+ Stable tag: 1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ [Plugin Demo](http://demo.radiustheme.com/wordpress/plugins/the-post-grid/) | [Documentation](https://radiustheme.com/how-to-setup-configure-the-post-grid-free-version-for-wordpress/) | [Get Pro](https://www.radiustheme.com/the-post-grid-pro-for-wordpress/)
16
 
17
  The Post Grid is a fully Responsive & Mobile friendly plugin to display your page/post in Grid, List and Isotope View without any line of coding. It is fast and easy to generate grid from admin end and insert into page/post. You can Display posts by any category(s), tag(s), author(s), keyword(s) also Order posts by Id, Title, Created date, Modified date and Menu order.
18
 
24
  * Fully responsive and mobile friendly.
25
  * 4 Different Layouts
26
  * Generate Unlimited grid.
27
+ * Excerpt limit in word or characters
28
+ * User define excerpt ending(... )
29
+ * Title and button color control
30
+ * Image overlay control
31
  * Custom number of post per page.
32
  * Use posts or pages as the source
33
  * Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)
60
 
61
  = PRO Features =
62
  * Fully responsive and mobile friendly.
63
+ * 55 Different Layouts
64
  * Even and Masonry Grid.
65
  * WooCommerce supported.
66
  * Custom Post Type Supported
136
 
137
  == Changelog ==
138
 
139
+ = 1.6 =
140
+ * Excerpt limit in word or characters
141
+ * User define excerpt ending(... )
142
+ * Title and button color control
143
+ * Image overlay control
144
+ * Improve coding style
145
+
146
  = 1.5 =
147
  * Layout fix
148
  * Min Height issue fixed for mobile
assets/css/admin.css CHANGED
@@ -1,4 +1,7 @@
1
  /* tab css */
 
 
 
2
  .rt-loading{
3
  background: url('../images/loading.gif') no-repeat center center;
4
  padding: 11px;
@@ -6,9 +9,19 @@
6
  body.post-type-rttpg div#misc-publishing-actions, body.post-type-rttpg div#minor-publishing-actions {
7
  display: none;
8
  }
9
- .post-type-rttpg div#submitdiv.sticky {
10
- position: fixed;
11
- top: 32px;
 
 
 
 
 
 
 
 
 
 
12
  }
13
  #sc-tabs ul.rt-tab-nav {
14
  clear: both;
1
  /* tab css */
2
+ .tpg-hidden{
3
+ display: none;
4
+ }
5
  .rt-loading{
6
  background: url('../images/loading.gif') no-repeat center center;
7
  padding: 11px;
9
  body.post-type-rttpg div#misc-publishing-actions, body.post-type-rttpg div#minor-publishing-actions {
10
  display: none;
11
  }
12
+ div#rttpg_meta_marketing {
13
+ background: #3E6BFF;
14
+ color: #fff;
15
+ }
16
+ div#rttpg_meta_marketing a.button-link {
17
+ color: red;
18
+ text-decoration: none;
19
+ font-size: 20px;
20
+ display: block;
21
+ text-align: center;
22
+ }
23
+ div#rttpg_meta_marketing h2 {
24
+ color: #fff;
25
  }
26
  #sc-tabs ul.rt-tab-nav {
27
  clear: both;
assets/css/thepostgrid.css CHANGED
@@ -51,58 +51,26 @@
51
  .rt-col-xs-1, .rt-col-xs-2, .rt-col-xs-3, .rt-col-xs-4, .rt-col-xs-5, .rt-col-xs-6, .rt-col-xs-7, .rt-col-xs-8, .rt-col-xs-9, .rt-col-xs-10, .rt-col-xs-11, .rt-col-xs-12 {
52
  float: left;
53
  }
54
- .rt-col-xs-12 {
55
- width: 100%;
56
- }
57
- .rt-col-xs-11 {
58
- width: 91.66666667%;
59
- }
60
- .rt-col-xs-10 {
61
- width: 83.33333333%;
62
- }
63
- .rt-col-xs-9 {
64
- width: 75%;
65
- }
66
- .rt-col-xs-8 {
67
- width: 66.66666667%;
68
- }
69
- .rt-col-xs-7 {
70
- width: 58.33333333%;
71
- }
72
- .rt-col-xs-6 {
73
- width: 50%;
74
- }
75
- .rt-col-xs-5 {
76
- width: 41.66666667%;
77
- }
78
- .rt-col-xs-4 {
79
- width: 33.33333333%;
80
- }
81
- .rt-col-xs-3 {
82
- width: 25%;
83
- }
84
- .rt-col-xs-2 {
85
- width: 16.66666667%;
86
  }
87
- .rt-col-xs-1 {
88
- width: 8.33333333%;
89
- }
90
- .img-responsive {
91
- max-width: 100%;
92
- display: block;
93
  }
94
 
95
  /**********************************************************************/
96
  /********************************* End Grid *************************/
97
  /**********************************************************************/
 
98
  .rt-detail .post-meta:after {
99
  clear: both;
100
  content: "";
101
  display: block;
102
  }
103
-
104
  .post-meta-user {
105
- padding: 5px 0;
106
  font-size: 90%;
107
  }
108
  .post-meta-tags {
@@ -125,6 +93,7 @@
125
  /**********************************************************************/
126
  /********************************* Layout 1 *************************/
127
  /**********************************************************************/
 
128
  .rt-tpg-container .layout1 .rt-holder {
129
  padding-bottom: 15px;
130
  }
@@ -177,9 +146,10 @@
177
  padding: 15px 0;
178
  }
179
  .rt-tpg-container .layout1 .rt-holder .rt-detail h2 {
180
- font-size: 22px;
181
- margin: 0;
182
- font-weight: 400;
 
183
  }
184
  .rt-tpg-container .layout1 .rt-holder .view-details {
185
  width: 36px;
@@ -200,17 +170,23 @@
200
  margin-top: 10px;
201
  }
202
  .rt-tpg-container .layout1 .rt-holder .rt-detail .read-more {
203
- border: 1px solid #8e8e8e;
204
- padding: 5px 8px;
 
 
 
205
  border-radius: 5px;
206
  -moz-border-radius: 5px;
207
  -webkit-border-radius: 5px;
208
  display: inline-block;
 
 
209
  }
210
 
211
  /**********************************************************************/
212
  /********************************* Layout 2 *************************/
213
  /**********************************************************************/
 
214
  .rt-tpg-container .layout2 .rt-holder {
215
  padding-bottom: 15px;
216
  }
@@ -229,13 +205,12 @@
229
  -o-transform: scale(1.1);
230
  transform: scale(1.1);
231
  }
232
- .rt-tpg-container .layout2 .rt-holder .rt-detail p {
233
- line-height: 24px;
234
- }
235
  .rt-tpg-container .layout2 .rt-holder .rt-detail h2 {
236
  font-size: 26px;
237
- margin: 0 0 10px 0;
 
238
  font-weight: 400;
 
239
  }
240
  .rt-tpg-container .layout2 .rt-holder .rt-img-holder {
241
  position: relative;
@@ -283,17 +258,23 @@
283
  opacity: 1;
284
  }
285
  .rt-tpg-container .layout2 .rt-holder .rt-detail .read-more {
286
- border: 1px solid #8e8e8e;
287
- float: right;
288
- padding: 5px 8px;
 
 
 
289
  border-radius: 5px;
290
  -moz-border-radius: 5px;
291
  -webkit-border-radius: 5px;
 
 
292
  }
293
 
294
  /**********************************************************************/
295
  /********************************* Layout 3 *************************/
296
  /**********************************************************************/
 
297
  .rt-tpg-container .layout3 .rt-holder {
298
  padding-bottom: 15px;
299
  }
@@ -302,8 +283,10 @@
302
  }
303
  .rt-tpg-container .layout3 .rt-holder .rt-detail h2 {
304
  font-size: 26px;
305
- margin: 0 0 10px 0;
 
306
  font-weight: 400;
 
307
  }
308
  .rt-tpg-container .layout3 .rt-holder .rt-img-holder {
309
  position: relative;
@@ -351,20 +334,26 @@
351
  opacity: 1;
352
  }
353
  .rt-tpg-container .layout3 .rt-holder .rt-detail .read-more {
354
- border: 1px solid #8e8e8e;
355
- float: right;
356
- padding: 5px 8px;
 
 
357
  border-radius: 5px;
358
  -moz-border-radius: 5px;
359
  -webkit-border-radius: 5px;
 
 
360
  }
361
- .rt-tpg-container .layout3 .rt-holder .rt-img-holder > a img.rounded, .layout3 .rt-holder .rt-img-holder .overlay {
 
362
  border-radius: 50%;
363
  }
364
 
365
  /**********************************************************************/
366
  /********************************* Layout Isotope *************************/
367
  /**********************************************************************/
 
368
  .rt-tpg-container .isotope1 .rt-holder {
369
  padding-bottom: 30px;
370
  }
@@ -418,8 +407,9 @@
418
  }
419
  .rt-tpg-container .isotope1 .rt-holder .rt-detail h2 {
420
  font-size: 26px;
421
- margin: 0;
422
  font-weight: 400;
 
423
  }
424
  .rt-tpg-container .isotope1 .rt-holder .view-details {
425
  width: 36px;
@@ -441,11 +431,14 @@
441
 
442
  /* isotope read more button Buttons */
443
  .rt-tpg-container .isotope1 .rt-holder .rt-detail .read-more {
444
- border: 1px solid #8e8e8e;
445
- padding: 5px 8px;
 
 
446
  border-radius: 5px;
447
  -moz-border-radius: 5px;
448
  -webkit-border-radius: 5px;
 
449
  }
450
 
451
  /* isotope Buttons */
@@ -458,16 +451,18 @@
458
  }
459
  .rt-tpg-container .rt-tpg-isotope-buttons button {
460
  border: none;
461
- margin: 5px;
462
- padding: 10px 10px;
463
  outline: 0;
464
  text-transform: none;
465
  font-weight: 400;
 
466
  }
467
 
468
  /**********************************************************************/
469
  /********************************* pagination *************************/
470
  /**********************************************************************/
 
471
  .rt-pagination {
472
  text-align: center;
473
  margin: 30px;
@@ -586,6 +581,7 @@
586
  /**********************************************************************/
587
  /********************************* Media Query *************************/
588
  /**********************************************************************/
 
589
  @media (min-width: 768px) {
590
  .container {
591
  width: 750px;
@@ -621,124 +617,19 @@
621
  .rt-col-sm-1, .rt-col-sm-2, .rt-col-sm-3, .rt-col-sm-4, .rt-col-sm-5, .rt-col-sm-6, .rt-col-sm-7, .rt-col-sm-8, .rt-col-sm-9, .rt-col-sm-10, .rt-col-sm-11, .rt-col-sm-12 {
622
  float: left;
623
  }
624
- .rt-col-sm-12 {
625
- width: 100%;
626
- }
627
- .rt-col-sm-11 {
628
- width: 91.66666667%;
629
- }
630
- .rt-col-sm-10 {
631
- width: 83.33333333%;
632
- }
633
- .rt-col-sm-9 {
634
- width: 75%;
635
- }
636
- .rt-col-sm-8 {
637
- width: 66.66666667%;
638
- }
639
- .rt-col-sm-7 {
640
- width: 58.33333333%;
641
- }
642
- .rt-col-sm-6 {
643
- width: 50%;
644
- }
645
- .rt-col-sm-5 {
646
- width: 41.66666667%;
647
- }
648
- .rt-col-sm-4 {
649
- width: 33.33333333%;
650
- }
651
- .rt-col-sm-3 {
652
- width: 25%;
653
- }
654
- .rt-col-sm-2 {
655
- width: 16.66666667%;
656
- }
657
- .rt-col-sm-1 {
658
- width: 8.33333333%;
659
- }
660
  }
661
 
662
  @media (min-width: 992px) {
663
  .rt-col-md-1, .rt-col-md-2, .rt-col-md-3, .rt-col-md-4, .rt-col-md-5, .rt-col-md-6, .rt-col-md-7, .rt-col-md-8, .rt-col-md-9, .rt-col-md-10, .rt-col-md-11, .rt-col-md-12 {
664
  float: left;
665
  }
666
- .rt-col-md-12 {
667
- width: 100%;
668
- }
669
- .rt-col-md-11 {
670
- width: 91.66666667%;
671
- }
672
- .rt-col-md-10 {
673
- width: 83.33333333%;
674
- }
675
- .rt-col-md-9 {
676
- width: 75%;
677
- }
678
- .rt-col-md-8 {
679
- width: 66.66666667%;
680
- }
681
- .rt-col-md-7 {
682
- width: 58.33333333%;
683
- }
684
- .rt-col-md-6 {
685
- width: 50%;
686
- }
687
- .rt-col-md-5 {
688
- width: 41.66666667%;
689
- }
690
- .rt-col-md-4 {
691
- width: 33.33333333%;
692
- }
693
- .rt-col-md-3 {
694
- width: 25%;
695
- }
696
- .rt-col-md-2 {
697
- width: 16.66666667%;
698
- }
699
- .rt-col-md-1 {
700
- width: 8.33333333%;
701
- }
702
  }
703
 
704
  @media (min-width: 1200px) {
705
  .rt-col-lg-1, .rt-col-lg-2, .rt-col-lg-3, .rt-col-lg-4, .rt-col-lg-5, .rt-col-lg-6, .rt-col-lg-7, .rt-col-lg-8, .rt-col-lg-9, .rt-col-lg-10, .rt-col-lg-11, .rt-col-lg-12 {
706
  float: left;
707
  }
708
- .rt-col-lg-12 {
709
- width: 100%;
710
- }
711
- .rt-col-lg-11 {
712
- width: 91.66666667%;
713
- }
714
- .rt-col-lg-10 {
715
- width: 83.33333333%;
716
- }
717
- .rt-col-lg-9 {
718
- width: 75%;
719
- }
720
- .rt-col-lg-8 {
721
- width: 66.66666667%;
722
- }
723
- .rt-col-lg-7 {
724
- width: 58.33333333%;
725
- }
726
- .rt-col-lg-6 {
727
- width: 50%;
728
- }
729
- .rt-col-lg-5 {
730
- width: 41.66666667%;
731
- }
732
- .rt-col-lg-4 {
733
- width: 33.33333333%;
734
- }
735
- .rt-col-lg-3 {
736
- width: 25%;
737
- }
738
- .rt-col-lg-2 {
739
- width: 16.66666667%;
740
- }
741
- .rt-col-lg-1 {
742
- width: 8.33333333%;
743
- }
744
  }
51
  .rt-col-xs-1, .rt-col-xs-2, .rt-col-xs-3, .rt-col-xs-4, .rt-col-xs-5, .rt-col-xs-6, .rt-col-xs-7, .rt-col-xs-8, .rt-col-xs-9, .rt-col-xs-10, .rt-col-xs-11, .rt-col-xs-12 {
52
  float: left;
53
  }
54
+ .rt-col-xs-12 { width: 100%; } .rt-col-xs-11 { width: 91.66666667%; } .rt-col-xs-10 { width: 83.33333333%; } .rt-col-xs-9 { width: 75%; } .rt-col-xs-8 { width: 66.66666667%; } .rt-col-xs-7 { width: 58.33333333%; } .rt-col-xs-6 { width: 50%; } .rt-col-xs-5 { width: 41.66666667%; } .rt-col-xs-4 { width: 33.33333333%; } .rt-col-xs-3 { width: 25%; } .rt-col-xs-2 { width: 16.66666667%; } .rt-col-xs-1 { width: 8.33333333%; }
55
+ .img-responsive {
56
+ max-width: 100%;
57
+ display: block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
+ .rt-tpg-container .rt-equal-height {
60
+ margin-bottom: 15px;
 
 
 
 
61
  }
62
 
63
  /**********************************************************************/
64
  /********************************* End Grid *************************/
65
  /**********************************************************************/
66
+
67
  .rt-detail .post-meta:after {
68
  clear: both;
69
  content: "";
70
  display: block;
71
  }
 
72
  .post-meta-user {
73
+ padding: 0px 0px 8px;
74
  font-size: 90%;
75
  }
76
  .post-meta-tags {
93
  /**********************************************************************/
94
  /********************************* Layout 1 *************************/
95
  /**********************************************************************/
96
+
97
  .rt-tpg-container .layout1 .rt-holder {
98
  padding-bottom: 15px;
99
  }
146
  padding: 15px 0;
147
  }
148
  .rt-tpg-container .layout1 .rt-holder .rt-detail h2 {
149
+ margin: 0 0 14px;
150
+ padding: 0px;
151
+ font-size: 24px;
152
+ line-height: 1.25;
153
  }
154
  .rt-tpg-container .layout1 .rt-holder .view-details {
155
  width: 36px;
170
  margin-top: 10px;
171
  }
172
  .rt-tpg-container .layout1 .rt-holder .rt-detail .read-more {
173
+ display: block;
174
+ text-align: right;
175
+ }
176
+ .rt-tpg-container .layout1 .rt-holder .rt-detail .read-more a {
177
+ padding: 6px 12px;
178
  border-radius: 5px;
179
  -moz-border-radius: 5px;
180
  -webkit-border-radius: 5px;
181
  display: inline-block;
182
+ background: #81d742;
183
+ font-size: 15px;
184
  }
185
 
186
  /**********************************************************************/
187
  /********************************* Layout 2 *************************/
188
  /**********************************************************************/
189
+
190
  .rt-tpg-container .layout2 .rt-holder {
191
  padding-bottom: 15px;
192
  }
205
  -o-transform: scale(1.1);
206
  transform: scale(1.1);
207
  }
 
 
 
208
  .rt-tpg-container .layout2 .rt-holder .rt-detail h2 {
209
  font-size: 26px;
210
+ margin: 0 0 14px 0;
211
+ padding: 0px;
212
  font-weight: 400;
213
+ line-height: 1.25;
214
  }
215
  .rt-tpg-container .layout2 .rt-holder .rt-img-holder {
216
  position: relative;
258
  opacity: 1;
259
  }
260
  .rt-tpg-container .layout2 .rt-holder .rt-detail .read-more {
261
+ display: block;
262
+ text-align: right;
263
+ }
264
+ .rt-tpg-container .layout2 .rt-holder .rt-detail .read-more a {
265
+ display: inline-block;
266
+ padding: 6px 12px;
267
  border-radius: 5px;
268
  -moz-border-radius: 5px;
269
  -webkit-border-radius: 5px;
270
+ background: #337ab7;
271
+ font-size: 15px;
272
  }
273
 
274
  /**********************************************************************/
275
  /********************************* Layout 3 *************************/
276
  /**********************************************************************/
277
+
278
  .rt-tpg-container .layout3 .rt-holder {
279
  padding-bottom: 15px;
280
  }
283
  }
284
  .rt-tpg-container .layout3 .rt-holder .rt-detail h2 {
285
  font-size: 26px;
286
+ margin: 0 0 14px 0;
287
+ padding: 0px;
288
  font-weight: 400;
289
+ line-height: 1.25;
290
  }
291
  .rt-tpg-container .layout3 .rt-holder .rt-img-holder {
292
  position: relative;
334
  opacity: 1;
335
  }
336
  .rt-tpg-container .layout3 .rt-holder .rt-detail .read-more {
337
+ display: block;
338
+ text-align: right;
339
+ }
340
+ .rt-tpg-container .layout3 .rt-holder .rt-detail .read-more a {
341
+ padding: 6px 12px;
342
  border-radius: 5px;
343
  -moz-border-radius: 5px;
344
  -webkit-border-radius: 5px;
345
+ background: #337ab7;
346
+ font-size: 15px;
347
  }
348
+ .rt-tpg-container .layout3 .rt-holder .rt-img-holder > a img.rounded,
349
+ .layout3 .rt-holder .rt-img-holder .overlay {
350
  border-radius: 50%;
351
  }
352
 
353
  /**********************************************************************/
354
  /********************************* Layout Isotope *************************/
355
  /**********************************************************************/
356
+
357
  .rt-tpg-container .isotope1 .rt-holder {
358
  padding-bottom: 30px;
359
  }
407
  }
408
  .rt-tpg-container .isotope1 .rt-holder .rt-detail h2 {
409
  font-size: 26px;
410
+ margin: 0 0 14px;
411
  font-weight: 400;
412
+ line-height: 1.25;
413
  }
414
  .rt-tpg-container .isotope1 .rt-holder .view-details {
415
  width: 36px;
431
 
432
  /* isotope read more button Buttons */
433
  .rt-tpg-container .isotope1 .rt-holder .rt-detail .read-more {
434
+
435
+ }
436
+ .rt-tpg-container .isotope1 .rt-holder .rt-detail .read-more a{
437
+ padding: 6px 12px;
438
  border-radius: 5px;
439
  -moz-border-radius: 5px;
440
  -webkit-border-radius: 5px;
441
+ font-size: 15px;
442
  }
443
 
444
  /* isotope Buttons */
451
  }
452
  .rt-tpg-container .rt-tpg-isotope-buttons button {
453
  border: none;
454
+ margin: 4px;
455
+ padding: 6px 14px;
456
  outline: 0;
457
  text-transform: none;
458
  font-weight: 400;
459
+ font-size: 15px;
460
  }
461
 
462
  /**********************************************************************/
463
  /********************************* pagination *************************/
464
  /**********************************************************************/
465
+
466
  .rt-pagination {
467
  text-align: center;
468
  margin: 30px;
581
  /**********************************************************************/
582
  /********************************* Media Query *************************/
583
  /**********************************************************************/
584
+
585
  @media (min-width: 768px) {
586
  .container {
587
  width: 750px;
617
  .rt-col-sm-1, .rt-col-sm-2, .rt-col-sm-3, .rt-col-sm-4, .rt-col-sm-5, .rt-col-sm-6, .rt-col-sm-7, .rt-col-sm-8, .rt-col-sm-9, .rt-col-sm-10, .rt-col-sm-11, .rt-col-sm-12 {
618
  float: left;
619
  }
620
+ .rt-col-sm-12 { width: 100%; } .rt-col-sm-11 { width: 91.66666667%; } .rt-col-sm-10 { width: 83.33333333%; } .rt-col-sm-9 { width: 75%; } .rt-col-sm-8 { width: 66.66666667%; } .rt-col-sm-7 { width: 58.33333333%; } .rt-col-sm-6 { width: 50%; } .rt-col-sm-5 { width: 41.66666667%; } .rt-col-sm-4 { width: 33.33333333%; } .rt-col-sm-3 { width: 25%; } .rt-col-sm-2 { width: 16.66666667%; } .rt-col-sm-1 { width: 8.33333333%; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  }
622
 
623
  @media (min-width: 992px) {
624
  .rt-col-md-1, .rt-col-md-2, .rt-col-md-3, .rt-col-md-4, .rt-col-md-5, .rt-col-md-6, .rt-col-md-7, .rt-col-md-8, .rt-col-md-9, .rt-col-md-10, .rt-col-md-11, .rt-col-md-12 {
625
  float: left;
626
  }
627
+ .rt-col-md-12 { width: 100%; } .rt-col-md-11 { width: 91.66666667%; } .rt-col-md-10 { width: 83.33333333%; } .rt-col-md-9 { width: 75%; } .rt-col-md-8 { width: 66.66666667%; } .rt-col-md-7 { width: 58.33333333%; } .rt-col-md-6 { width: 50%; } .rt-col-md-5 { width: 41.66666667%; } .rt-col-md-4 { width: 33.33333333%; } .rt-col-md-3 { width: 25%; } .rt-col-md-2 { width: 16.66666667%; } .rt-col-md-1 { width: 8.33333333%; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
628
  }
629
 
630
  @media (min-width: 1200px) {
631
  .rt-col-lg-1, .rt-col-lg-2, .rt-col-lg-3, .rt-col-lg-4, .rt-col-lg-5, .rt-col-lg-6, .rt-col-lg-7, .rt-col-lg-8, .rt-col-lg-9, .rt-col-lg-10, .rt-col-lg-11, .rt-col-lg-12 {
632
  float: left;
633
  }
634
+ .rt-col-lg-12 { width: 100%; } .rt-col-lg-11 { width: 91.66666667%; } .rt-col-lg-10 { width: 83.33333333%; } .rt-col-lg-9 { width: 75%; } .rt-col-lg-8 { width: 66.66666667%; } .rt-col-lg-7 { width: 58.33333333%; } .rt-col-lg-6 { width: 50%; } .rt-col-lg-5 { width: 41.66666667%; } .rt-col-lg-4 { width: 33.33333333%; } .rt-col-lg-3 { width: 25%; } .rt-col-lg-2 { width: 16.66666667%; } .rt-col-lg-1 { width: 8.33333333%; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
  }
assets/js/admin.js CHANGED
@@ -12,7 +12,7 @@
12
  var postType = jQuery("#rc-sc-post-type").val();
13
  rtTgpFilter();
14
  thpShowHideScMeta();
15
- $('#post_filter input[type=checkbox]').live('change', function() {
16
  var id = $(this).val();
17
  if(id == 'tpg_taxonomy'){
18
  if(this.checked){
@@ -31,12 +31,12 @@
31
 
32
  });
33
 
34
- $('#post-taxonomy input[type=checkbox]').live('change', function() {
35
  thpShowHideScMeta();
36
  rtTPGTermListByTaxonomy( $(this) );
37
  });
38
 
39
- $("#rt-tpg-pagination").live('change', function() {
40
  if(this.checked){
41
  jQuery(".field-holder.posts-per-page").show();
42
  }else{
@@ -62,23 +62,12 @@
62
  }
63
  });
64
 
65
- $(window).scroll(function() {
66
- var height = $(window).scrollTop();
67
-
68
- if(height > 50) {
69
- $('.post-type-rttpg div#submitdiv').addClass('sticky');
70
- }else{
71
- $('.post-type-rttpg div#submitdiv').removeClass('sticky');
72
- }
73
- });
74
-
75
  })(jQuery);
76
 
77
  function rtTPGTaxonomyListByPostType( postType, $this){
78
 
79
  var arg = "post_type="+postType;
80
- var bindElement = $this;
81
- tpgAjaxCall( bindElement, 'rtTPGTaxonomyListByPostType', arg, function(data){
82
  //console.log(data);
83
  if(data.error){
84
  alert(data.msg);
@@ -223,7 +212,8 @@ function rtTgpFilter(){
223
 
224
  function thpShowHideScMeta(){
225
 
226
- if(jQuery("#rt-tpg-sc-layout").val() == 'isotope1'){
 
227
  jQuery(".field-holder.pagination, .field-holder.posts-per-page").hide();
228
  jQuery(".field-holder.sc-isotope-filter").show();
229
  }else{
@@ -236,7 +226,11 @@ function thpShowHideScMeta(){
236
  jQuery(".field-holder.posts-per-page").hide();
237
  }
238
  }
239
-
 
 
 
 
240
  if(jQuery("#post-taxonomy input[name='tpg_taxonomy[]']").is(":checked")){
241
  jQuery(".rt-tpg-filter-item.term-filter-item").show();
242
  }else{
12
  var postType = jQuery("#rc-sc-post-type").val();
13
  rtTgpFilter();
14
  thpShowHideScMeta();
15
+ $(document).on('change', '#post_filter input[type=checkbox]', function() {
16
  var id = $(this).val();
17
  if(id == 'tpg_taxonomy'){
18
  if(this.checked){
31
 
32
  });
33
 
34
+ $(document).on('change', '#post-taxonomy input[type=checkbox]', function() {
35
  thpShowHideScMeta();
36
  rtTPGTermListByTaxonomy( $(this) );
37
  });
38
 
39
+ $(document).on('change', "#rt-tpg-pagination", function() {
40
  if(this.checked){
41
  jQuery(".field-holder.posts-per-page").show();
42
  }else{
62
  }
63
  });
64
 
 
 
 
 
 
 
 
 
 
 
65
  })(jQuery);
66
 
67
  function rtTPGTaxonomyListByPostType( postType, $this){
68
 
69
  var arg = "post_type="+postType;
70
+ tpgAjaxCall( $this, 'rtTPGTaxonomyListByPostType', arg, function(data){
 
71
  //console.log(data);
72
  if(data.error){
73
  alert(data.msg);
212
 
213
  function thpShowHideScMeta(){
214
 
215
+ var layout = jQuery("#rt-tpg-sc-layout").val();
216
+ if( layout == 'isotope1'){
217
  jQuery(".field-holder.pagination, .field-holder.posts-per-page").hide();
218
  jQuery(".field-holder.sc-isotope-filter").show();
219
  }else{
226
  jQuery(".field-holder.posts-per-page").hide();
227
  }
228
  }
229
+ if(layout == 'layout2' || layout == 'layout3'){
230
+ jQuery('.holder-layout2-image-column').show();
231
+ }else{
232
+ jQuery('.holder-layout2-image-column').hide();
233
+ }
234
  if(jQuery("#post-taxonomy input[name='tpg_taxonomy[]']").is(":checked")){
235
  jQuery(".rt-tpg-filter-item.term-filter-item").show();
236
  }else{
assets/js/rttpg.js CHANGED
@@ -34,32 +34,23 @@
34
  function tgpHeightResize() {
35
  var wWidth = $(window).width();
36
  if(wWidth > 767) {
37
- $(document).imagesLoaded(function () {
38
- $(".rt-tpg-container").each(function () {
39
- var rtMaxH = 0;
40
- $(this).children('.row').children(".equal-height:not(.rt-col-md-12)").height("auto");
41
- $(this).children('.row').children('.equal-height:not(.rt-col-md-12)').each(function () {
 
42
  var $thisH = $(this).actual('outerHeight');
43
  if ($thisH > rtMaxH) {
44
  rtMaxH = $thisH;
45
  }
46
  });
47
- $(this).children('.row').children(".equal-height:not(.rt-col-md-12)").css('height', rtMaxH + "px");
48
- });
49
- $(".rt-tpg-container .rt-tpg-isotope").each(function () {
50
- var rtMaxH = 0;
51
- $(this).children(".equal-height").height("auto");
52
- $(this).children('.equal-height').each(function () {
53
- var $thisH = $(this).actual('outerHeight');
54
- if ($thisH > rtMaxH) {
55
- rtMaxH = $thisH;
56
- }
57
- });
58
- $(this).children(".equal-height").css('height', rtMaxH + "px");
59
  });
60
  });
61
  }else{
62
- $(".rt-tpg-container").find(".equal-height").height('auto');
63
  }
64
  }
65
 
34
  function tgpHeightResize() {
35
  var wWidth = $(window).width();
36
  if(wWidth > 767) {
37
+ $(".rt-tpg-container").each(function () {
38
+ var self = $(this),
39
+ rtMaxH = 0;
40
+ self.imagesLoaded(function () {
41
+ self.children('.row').children(".rt-equal-height:not(.rt-col-md-12)").height("auto");
42
+ self.children('.row').children('.rt-equal-height:not(.rt-col-md-12)').each(function () {
43
  var $thisH = $(this).actual('outerHeight');
44
  if ($thisH > rtMaxH) {
45
  rtMaxH = $thisH;
46
  }
47
  });
48
+ self.children('.row').children(".rt-equal-height:not(.rt-col-md-12)").css('height', rtMaxH + "px");
49
+
 
 
 
 
 
 
 
 
 
 
50
  });
51
  });
52
  }else{
53
+ $(".rt-tpg-container").find(".rt-equal-height").height('auto');
54
  }
55
  }
56
 
lib/classes/rtTPGHelper.php CHANGED
@@ -175,27 +175,35 @@ if(!class_exists('rtTPGHelper')):
175
 
176
  return $imgSrc;
177
  }
178
- function strip_tags_content($text, $limit = 0, $tags = '', $invert = FALSE) {
179
-
180
- /*preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);
181
- $tags = array_unique($tags[1]);
182
-
183
- if(is_array($tags) AND count($tags) > 0) {
184
- if($invert == FALSE) {
185
- $text = preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text);
186
- }
187
- else {
188
- $text = preg_replace('@<('. implode('|', $tags) .')\b.*?>.*?</\1>@si', '', $text);
189
- }
190
- }elseif($invert == FALSE) {
191
- $text = preg_replace('@<(\w+)\b.*?>.*?</\1>@si', '', $text);
192
- }*/
193
- $text = strip_tags($text);
194
- if($limit > 0 && strlen($text) > $limit){
195
- $text = substr($text, 0, $limit);
196
- }
197
- return $text;
198
- }
 
 
 
 
 
 
 
 
199
 
200
 
201
 
@@ -243,6 +251,28 @@ if(!class_exists('rtTPGHelper')):
243
 
244
  }
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
247
 
248
  endif;
175
 
176
  return $imgSrc;
177
  }
178
+ function strip_tags_content( $excerpt, $type = "character", $limit = 0, $more = null ) {
179
+ $type = ( $type == "character" || $type == "word" ? $type : "character" );
180
+ $excerpt = preg_replace( '@<(\w+)\b.*?>.*?</\1>@si', '', $excerpt );
181
+ $excerpt = preg_replace( '`\[[^\]]*\]`', '', $excerpt );
182
+ $excerpt = strip_shortcodes( $excerpt );
183
+ $excerpt = preg_replace( '`[[^]]*]`', '', $excerpt );
184
+ $excerpt = str_replace( '…', '', $excerpt );
185
+ $excerpt = preg_replace( " ([.*?])", '', $excerpt );
186
+ $oldExcerpt = $excerpt;
187
+ if ( $type == "word" ) {
188
+ $limit = $limit + 1;
189
+ $excerpt = explode( ' ', $excerpt, $limit );
190
+ if ( count( $excerpt ) >= $limit ) {
191
+ array_pop( $excerpt );
192
+ $excerpt = implode( " ", $excerpt );
193
+ $excerpt = ( $more ? $excerpt . " " . $more : $excerpt );
194
+ } else {
195
+ $excerpt = $oldExcerpt;
196
+ }
197
+ } else {
198
+ if ( $limit > 0 && strlen( $excerpt ) > $limit ) {
199
+ $excerpt = substr( $excerpt, 0, $limit );
200
+ $excerpt = substr( $excerpt, 0, strripos( $excerpt, " " ) );
201
+ $excerpt = ( $more ? $excerpt . " " . $more : $excerpt );
202
+ }
203
+ }
204
+
205
+ return $excerpt;
206
+ }
207
 
208
 
209
 
251
 
252
  }
253
 
254
+ function get_pro_feature_list(){
255
+ $html = "<ol>
256
+ <li>Fully responsive and mobile friendly.</li>
257
+ <li>55 Different Layouts</li>
258
+ <li>Even and Masonry Grid.</li>
259
+ <li>WooCommerce supported.</li>
260
+ <li>Custom Post Type Supported</li>
261
+ <li>Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)</li>
262
+ <li>Order by Id, Title, Created date, Modified date and Menu order.</li>
263
+ <li>Display image size (thumbnail, medium, large, full)</li>
264
+ <li>Isotope filter for any taxonomy ie. categories, tags...</li>
265
+ <li>Query Post with Relation.</li>
266
+ <li>Fields Selection.</li>
267
+ <li>All Text and Color control.</li>
268
+ <li>Enable/Disable Pagination.</li>
269
+ <li>AJAX Pagination (Load more and Load on Scrolling)</li>
270
+ <li> and many more .......</li>
271
+ </ol>";
272
+
273
+ return $html;
274
+ }
275
+
276
  }
277
 
278
  endif;
lib/classes/rtTPGInit.php CHANGED
@@ -7,6 +7,7 @@ if(!class_exists('rtTPGInit')):
7
  function __construct()
8
  {
9
  add_action('init', array($this, 'init'), 1);
 
10
  add_action( 'plugins_loaded', array($this,'the_post_grid_load_text_domain') );
11
  register_activation_hook(RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, array($this, 'activate'));
12
  register_deactivation_hook(RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, array($this, 'deactivate'));
@@ -125,16 +126,6 @@ if(!class_exists('rtTPGInit')):
125
  {
126
  wp_register_style( $k, $v, false, $rtTPG->options['version'] );
127
  }
128
-
129
-
130
-
131
- // admin only
132
- if( is_admin() )
133
- {
134
- add_action('admin_menu', array($this,'admin_menu'));
135
- // add_action('admin_head', array($this,'admin_head'));
136
- add_filter('post_updated_messages', array($this, 'rt_post_updated_messages'));
137
- }
138
  }
139
 
140
  function admin_menu()
@@ -148,27 +139,6 @@ if(!class_exists('rtTPGInit')):
148
  $rtTPG->render('settings.settings');
149
  }
150
 
151
- function rt_post_updated_messages( $messages )
152
- {
153
- global $rtTPG;
154
- $messages[$rtTPG->post_type] = array(
155
- 0 => '', // Unused. Messages start at index 1.
156
- 1 => __('Field group updated.', 'the-post-grid'),
157
- 2 => __('Custom field updated.', 'the-post-grid'),
158
- 3 => __('Custom field deleted.', 'the-post-grid'),
159
- 4 => __('Field group updated.', 'the-post-grid'),
160
- /* translators: %s: date and time of the revision */
161
- 5 => isset($_GET['revision']) ? sprintf( __('Field group restored to revision from %s', 'the-post-grid'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
162
- 6 => __('Field group published.', 'the-post-grid'),
163
- 7 => __('Field group saved.', 'the-post-grid'),
164
- 8 => __('Field group submitted.', 'the-post-grid'),
165
- 9 => __('Field group scheduled for.', 'the-post-grid'),
166
- 10 => __('Field group draft updated.', 'the-post-grid'),
167
- );
168
-
169
- return $messages;
170
- }
171
-
172
  public function the_post_grid_load_text_domain() {
173
  load_plugin_textdomain( 'the-post-grid', FALSE, RT_THE_POST_GRID_LANGUAGE_PATH);
174
  }
7
  function __construct()
8
  {
9
  add_action('init', array($this, 'init'), 1);
10
+ add_action('admin_menu', array($this,'admin_menu'));
11
  add_action( 'plugins_loaded', array($this,'the_post_grid_load_text_domain') );
12
  register_activation_hook(RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, array($this, 'activate'));
13
  register_deactivation_hook(RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, array($this, 'deactivate'));
126
  {
127
  wp_register_style( $k, $v, false, $rtTPG->options['version'] );
128
  }
 
 
 
 
 
 
 
 
 
 
129
  }
130
 
131
  function admin_menu()
139
  $rtTPG->render('settings.settings');
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  public function the_post_grid_load_text_domain() {
143
  load_plugin_textdomain( 'the-post-grid', FALSE, RT_THE_POST_GRID_LANGUAGE_PATH);
144
  }
lib/classes/rtTPGMeta.php CHANGED
@@ -7,6 +7,7 @@ if(!class_exists('rtTPGMeta')):
7
  function __construct()
8
  {
9
  // actions
 
10
  add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
11
  add_action('save_post', array($this, 'save_post'), 10, 2);
12
  add_filter( 'manage_edit-rttpg_columns', array($this, 'arrange_rttpg_columns'));
@@ -66,7 +67,6 @@ if(!class_exists('rtTPGMeta')):
66
  'ajaxurl' => admin_url( 'admin-ajax.php' )
67
  ) );
68
 
69
- add_action('admin_head', array($this,'admin_head'));
70
  }
71
 
72
  function admin_head(){
@@ -78,6 +78,13 @@ if(!class_exists('rtTPGMeta')):
78
  $rtTPG->post_type,
79
  'normal',
80
  'high');
 
 
 
 
 
 
 
81
  add_action( 'edit_form_after_title', array($this, 'tpg_sc_after_title') );
82
  }
83
 
@@ -132,6 +139,18 @@ if(!class_exists('rtTPGMeta')):
132
  echo $html;
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  function save_post($post_id, $post){
137
 
7
  function __construct()
8
  {
9
  // actions
10
+ add_action('admin_head', array($this,'admin_head'));
11
  add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
12
  add_action('save_post', array($this, 'save_post'), 10, 2);
13
  add_filter( 'manage_edit-rttpg_columns', array($this, 'arrange_rttpg_columns'));
67
  'ajaxurl' => admin_url( 'admin-ajax.php' )
68
  ) );
69
 
 
70
  }
71
 
72
  function admin_head(){
78
  $rtTPG->post_type,
79
  'normal',
80
  'high');
81
+ add_meta_box(
82
+ 'rttpg_meta_marketing',
83
+ __('Pro Features'),
84
+ array($this,'rttpg_meta_marketing_selection'),
85
+ $rtTPG->post_type,
86
+ 'side',
87
+ 'default');
88
  add_action( 'edit_form_after_title', array($this, 'tpg_sc_after_title') );
89
  }
90
 
139
  echo $html;
140
  }
141
 
142
+ function rttpg_meta_marketing_selection(){
143
+ global $rtTPG;
144
+ $html = null;
145
+ $html .= "<div class='rt-meta-wrap'>";
146
+ $html .= $rtTPG->get_pro_feature_list();
147
+ $html .= '<p><a href="https://www.radiustheme.com/the-post-grid-pro-for-wordpress/" class="button-link"
148
+ target="_blank">Get Pro Version</a></p>';
149
+ $html .= "</div>";
150
+
151
+ echo $html;
152
+ }
153
+
154
 
155
  function save_post($post_id, $post){
156
 
lib/classes/rtTPGOptions.php CHANGED
@@ -1,302 +1,360 @@
1
  <?php
2
 
3
- if(!class_exists('rtTPGOptions')):
4
 
5
- class rtTPGOptions
6
- {
7
 
8
- function rtPostTypes(){
9
- $post_types = get_post_types(
10
- array(
11
- '_builtin' => true
12
- )
13
- );
14
- $exclude = array( 'attachment', 'revision', 'nav_menu_item' );
15
- foreach($exclude as $ex){
16
- unset($post_types[$ex]);
17
- }
18
- return $post_types;
19
- }
20
 
21
- function rtPostOrders(){
22
- return array(
23
- "ASC" => "Ascending",
24
- "DESC" => "Descending",
25
- );
26
- }
27
 
28
- function rtTermOperators(){
29
- return array(
30
- 'IN' => "IN — show posts which associate with one or more of selected terms",
31
- 'NOT IN' => "NOT IN — show posts which do not associate with any of selected terms",
32
- 'AND' => "AND — show posts which associate with all of selected terms",
33
- );
34
- }
35
- function rtTermRelations(){
36
- return array(
37
- 'AND' => "AND — show posts which match all settings",
38
- 'OR' => "OR — show posts which match one or more settings",
39
- );
40
- }
41
 
42
- function rtPostOrderBy(){
43
- return array(
44
- "ID" => "ID",
45
- "title" => "Title",
46
- "date" => "Created date",
47
- "modified" => "Modified date",
48
- "menu_order" => "Menu Order"
49
- );
50
- }
51
 
52
- function rtTPGSettingFields(){
53
- global $rtTPG;
54
- $settings = get_option($rtTPG->options['settings']);
55
- return array(
56
- 'custom_css' => array(
57
- 'type' => 'custom_css',
58
- 'name' => 'custom_css',
59
- 'label' => 'Custom Css',
60
- 'id' => 'custom-css',
61
- 'value' => isset($settings['custom_css']) ? trim($settings['custom_css']) : null,
62
- ),
63
- );
64
- }
65
 
66
- function rtTPGCommonFilterFields(){
67
- return array(
68
- 'post__in' => array(
69
- "name" => "post__in",
70
- "label" => "Include only",
71
- "type" => "text",
72
- "class" => "full",
73
- "description" => __('List of post IDs to show (comma-separated values, for example: 1,2,3)', 'the-post-grid')
74
- ),
75
- 'post__not_in' => array(
76
- "name" => "post__not_in",
77
- "label" => "Exclude",
78
- "type" => "text",
79
- "class" => "full",
80
- "description" => __('List of post IDs to hide (comma-separated values, for example: 1,2,3)', 'the-post-grid')
81
- ),
82
- 'limit' => array(
83
- "name" => "limit",
84
- "label" => "Limit",
85
- "type" => "number",
86
- "class" => "full",
87
- "description" => __('The number of posts to show. Set empty to show all found posts.', 'the-post-grid')
88
- )
89
- );
90
- }
91
 
92
- function rtTPGPostType(){
93
- return array(
94
- "name" => "tpg_post_type",
95
- "label" => "Post Type",
96
- "type" => "select",
97
- "id" => "rc-sc-post-type",
98
- "class" => "rt-select2",
99
- "options" => $this->rtPostTypes()
100
- );
101
- }
102
 
103
- function rtTPAdvanceFilters(){
104
- return array(
105
- 'type' => "checkbox",
106
- 'name' => "post_filter",
107
- 'label' => "Advanced filters",
108
- 'id' => "post_filter",
109
- "alignment" => "vertical",
110
- "multiple" => true,
111
- "options" => array(
112
- 'tpg_taxonomy' => "Taxonomy",
113
- 'order' => "Order",
114
- 'author' => "Author",
115
- 'tpg_post_status' => "Status",
116
- 's' => "Search"
117
- ),
118
- );
119
- }
120
 
121
- function rtTPGPostStatus(){
122
- return array(
123
- 'publish' => 'Publish',
124
- 'pending' => 'Pending',
125
- 'draft' => 'Draft',
126
- 'auto-draft' => 'Auto draft',
127
- 'future' => 'Future',
128
- 'private' => 'Private',
129
- 'inherit' => 'Inherit',
130
- 'trash' => 'Trash',
131
- );
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
- function rtTPGLayoutSettingFields(){
135
- global $rtTPG;
136
- return array(
137
- 'layout' => array(
138
- "type" => "select",
139
- "name" => "layout",
140
- "label" => "Layout",
141
- "id" => "rt-tpg-sc-layout",
142
- "class" => "rt-select2",
143
- "options" => $this->rtTPGLayouts()
144
- ),
145
- 'isotope-filtering' => array(
146
- "type" => "select",
147
- "name" => "isotope_filter",
148
- "label" => "Isotope Filter",
149
- 'holderClass' => "sc-isotope-filter hidden",
150
- "id" => "rt-tpg-sc-isotope-filter",
151
- "class" => "rt-select2",
152
- "options" => $rtTPG->rt_get_taxonomy_for_isotope_filter()
153
- ),
154
- 'column' => array(
155
- "type" => "select",
156
- "name" => "column",
157
- "label" => "Column",
158
- "id" => "rt-column",
159
- "class" => "rt-select2",
160
- "default" => 4,
161
- "options" => $this->rtTPGColumns()
162
- ),
163
- 'pagination' => array(
164
- "type" => "checkbox",
165
- "name" => "pagination",
166
- "label" => "Pagination",
167
- 'holderClass' => "pagination",
168
- "id" => "rt-tpg-pagination",
169
- "option" => 'Enable'
170
- ),
171
- 'posts_per_page' => array(
172
- "type" => "number",
173
- "name" => "posts_per_page",
174
- "label" => "Display per page",
175
- 'holderClass' => "posts-per-page hidden",
176
- "id" => "posts-per-page",
177
- "default" => 5,
178
- "description" => __("If value of Limit setting is not blank (empty), this value should be smaller than Limit value.", 'the-post-grid')
179
- ),
180
- 'featured_image_size' => array(
181
- "type" => "select",
182
- "name" => "featured_image_size",
183
- "label" => "Feature Image Size",
184
- "id" => "featured-image-size",
185
- "class" => "rt-select2",
186
- "options" => $rtTPG->get_image_sizes()
187
- ),
188
- 'media_source' => array(
189
- "type" => "radio",
190
- "name" => "media_source",
191
- "label" => "Media Source",
192
- "id" => "media-source",
193
- "default" => 'feature_image',
194
- "alignment" => "vertical",
195
- "options" => $this->rtMediaSource()
196
- ),
197
- 'excerpt_limit' => array(
198
- "type" => "number",
199
- "name" => "excerpt_limit",
200
- "label" => "Excerpt limit",
201
- "id" => "excerpt-limit",
202
- "description" => __("Excerpt limit only integer number is allowed, Leave it blank for full excerpt. Note: This will remove all html tag", 'the-post-grid')
203
- )
204
- );
205
- }
206
 
207
- function rtTPGStyleFields(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
- return array(
210
- 'primary_color' => array(
211
- "type" => "text",
212
- "name" => "primary_color",
213
- "label" => "Primary Color",
214
- "id" => "primary-color",
215
- "class" => "rt-color",
216
- "default" => "#0367bf"
217
- ),
218
- 'button_bg_color' => array(
219
- "type" => "text",
220
- "name" => "button_bg_color",
221
- "label" => "Button background color",
222
- "id" => "button-bg-color",
223
- "class" => "rt-color"
224
- ),
225
- 'button_hover_bg_color' => array(
226
- "type" => "text",
227
- "name" => "button_hover_bg_color",
228
- "label" => "Button hover background color",
229
- "id" => "button-hover-bg-color",
230
- "class" => "rt-color"
231
- ),
232
- 'button_active_bg_color' => array(
233
- "type" => "text",
234
- "name" => "button_active_bg_color",
235
- "label" => "Button active background color",
236
- "id" => "button-active-bg-color",
237
- "class" => "rt-color"
238
- ),
239
- 'button_text_bg_color' => array(
240
- "type" => "text",
241
- "name" => "button_text_color",
242
- "label" => "Button text color",
243
- "id" => "button-text-color",
244
- "class" => "rt-color"
245
- )
246
- );
247
 
248
- }
 
249
 
250
- function itemFields(){
251
- return array(
252
- "type" => "checkbox",
253
- "name" => "item_fields",
254
- "label" => "Field selection",
255
- "id" => "item-fields",
256
- "multiple" => true,
257
- "alignment" => "vertical",
258
- "default" => array_keys($this->rtTPGItemFields()),
259
- "options" => $this->rtTPGItemFields()
260
- );
261
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
- function rtMediaSource(){
264
- return array(
265
- "feature_image" => __("Feature Image", 'the-post-grid'),
266
- "first_image" => __("First Image from content", 'the-post-grid')
267
- );
268
- }
269
 
270
- function rtTPGColumns(){
271
- return array(
272
- 1 => "Column 1",
273
- 2 => "Column 2",
274
- 3 => "Column 3",
275
- 4 => "Column 4"
276
- );
277
- }
278
- function rtTPGLayouts(){
279
- return array(
280
- 'layout1' => "Layout 1",
281
- 'layout2' => "Layout 2",
282
- 'layout3' => "Layout 3",
283
- 'isotope1' => "Isotope Layout"
284
- );
285
- }
286
 
287
- function rtTPGItemFields(){
288
- return array(
289
- 'title' => __( "Title", 'the-post-grid'),
290
- 'excerpt' => __( "Excerpt", 'the-post-grid'),
291
- 'read_more' => __( "Read More", 'the-post-grid'),
292
- 'post_date' => __( "Post Date", 'the-post-grid'),
293
- 'author' => __( "Author", 'the-post-grid'),
294
- 'categories' => __( "Categories", 'the-post-grid'),
295
- 'tags' => __( "Tags", 'the-post-grid'),
296
- 'comment_count' => __( "Comment Count", 'the-post-grid')
297
- );
298
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
 
300
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
 
302
  endif;
1
  <?php
2
 
3
+ if ( ! class_exists( 'rtTPGOptions' ) ):
4
 
5
+ class rtTPGOptions {
 
6
 
7
+ function rtPostTypes() {
8
+ $post_types = get_post_types(
9
+ array(
10
+ '_builtin' => true
11
+ )
12
+ );
13
+ $exclude = array( 'attachment', 'revision', 'nav_menu_item' );
14
+ foreach ( $exclude as $ex ) {
15
+ unset( $post_types[ $ex ] );
16
+ }
 
 
17
 
18
+ return $post_types;
19
+ }
 
 
 
 
20
 
21
+ function rtPostOrders() {
22
+ return array(
23
+ "ASC" => "Ascending",
24
+ "DESC" => "Descending",
25
+ );
26
+ }
 
 
 
 
 
 
 
27
 
28
+ function rtTermOperators() {
29
+ return array(
30
+ 'IN' => "IN show posts which associate with one or more of selected terms",
31
+ 'NOT IN' => "NOT IN — show posts which do not associate with any of selected terms",
32
+ 'AND' => "AND — show posts which associate with all of selected terms",
33
+ );
34
+ }
 
 
35
 
36
+ function rtTermRelations() {
37
+ return array(
38
+ 'AND' => "AND — show posts which match all settings",
39
+ 'OR' => "OR — show posts which match one or more settings",
40
+ );
41
+ }
 
 
 
 
 
 
 
42
 
43
+ function rtPostOrderBy() {
44
+ return array(
45
+ "ID" => "ID",
46
+ "title" => "Title",
47
+ "date" => "Created date",
48
+ "modified" => "Modified date",
49
+ "menu_order" => "Menu Order"
50
+ );
51
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ function rtTPGSettingFields() {
54
+ global $rtTPG;
55
+ $settings = get_option( $rtTPG->options['settings'] );
 
 
 
 
 
 
 
56
 
57
+ return array(
58
+ 'custom_css' => array(
59
+ 'type' => 'custom_css',
60
+ 'name' => 'custom_css',
61
+ 'label' => 'Custom Css',
62
+ 'id' => 'custom-css',
63
+ 'value' => isset( $settings['custom_css'] ) ? trim( $settings['custom_css'] ) : null,
64
+ ),
65
+ );
66
+ }
 
 
 
 
 
 
 
67
 
68
+ function rtTPGCommonFilterFields() {
69
+ return array(
70
+ 'post__in' => array(
71
+ "name" => "post__in",
72
+ "label" => "Include only",
73
+ "type" => "text",
74
+ "class" => "full",
75
+ "description" => __( 'List of post IDs to show (comma-separated values, for example: 1,2,3)',
76
+ 'the-post-grid' )
77
+ ),
78
+ 'post__not_in' => array(
79
+ "name" => "post__not_in",
80
+ "label" => "Exclude",
81
+ "type" => "text",
82
+ "class" => "full",
83
+ "description" => __( 'List of post IDs to hide (comma-separated values, for example: 1,2,3)',
84
+ 'the-post-grid' )
85
+ ),
86
+ 'limit' => array(
87
+ "name" => "limit",
88
+ "label" => "Limit",
89
+ "type" => "number",
90
+ "class" => "full",
91
+ "description" => __( 'The number of posts to show. Set empty to show all found posts.',
92
+ 'the-post-grid' )
93
+ )
94
+ );
95
+ }
96
 
97
+ function rtTPGPostType() {
98
+ return array(
99
+ "name" => "tpg_post_type",
100
+ "label" => "Post Type",
101
+ "type" => "select",
102
+ "id" => "rc-sc-post-type",
103
+ "class" => "rt-select2",
104
+ "options" => $this->rtPostTypes()
105
+ );
106
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
+ function rtTPAdvanceFilters() {
109
+ return array(
110
+ 'type' => "checkbox",
111
+ 'name' => "post_filter",
112
+ 'label' => "Advanced filters",
113
+ 'id' => "post_filter",
114
+ "alignment" => "vertical",
115
+ "multiple" => true,
116
+ "options" => array(
117
+ 'tpg_taxonomy' => "Taxonomy",
118
+ 'order' => "Order",
119
+ 'author' => "Author",
120
+ 'tpg_post_status' => "Status",
121
+ 's' => "Search"
122
+ ),
123
+ );
124
+ }
125
 
126
+ function rtTPGPostStatus() {
127
+ return array(
128
+ 'publish' => 'Publish',
129
+ 'pending' => 'Pending',
130
+ 'draft' => 'Draft',
131
+ 'auto-draft' => 'Auto draft',
132
+ 'future' => 'Future',
133
+ 'private' => 'Private',
134
+ 'inherit' => 'Inherit',
135
+ 'trash' => 'Trash',
136
+ );
137
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
+ function rtTPGLayoutSettingFields() {
140
+ global $rtTPG;
141
 
142
+ return array(
143
+ 'layout' => array(
144
+ "type" => "select",
145
+ "name" => "layout",
146
+ "label" => "Layout",
147
+ "id" => "rt-tpg-sc-layout",
148
+ "class" => "rt-select2",
149
+ "options" => $this->rtTPGLayouts()
150
+ ),
151
+ 'isotope-filtering' => array(
152
+ "type" => "select",
153
+ "name" => "isotope_filter",
154
+ "label" => "Isotope Filter",
155
+ 'holderClass' => "sc-isotope-filter tpg-hidden",
156
+ "id" => "rt-tpg-sc-isotope-filter",
157
+ "class" => "rt-select2",
158
+ "options" => $rtTPG->rt_get_taxonomy_for_isotope_filter()
159
+ ),
160
+ 'tgp_layout2_image_column' => array(
161
+ 'type' => 'select',
162
+ "name" => "tgp_layout2_image_column",
163
+ "id" => "tgp_layout2_image_column",
164
+ 'label' => __( 'Image column', 'the-post-grid-pro' ),
165
+ 'class' => 'rt-select2',
166
+ 'holderClass' => "holder-layout2-image-column tpg-hidden",
167
+ 'default' => 4,
168
+ 'options' => $this->rtTPGColumns(),
169
+ "description" => "Content column will calculate automatically"
170
+ ),
171
+ 'column' => array(
172
+ "type" => "select",
173
+ "name" => "column",
174
+ "label" => "Column",
175
+ "id" => "rt-column",
176
+ "class" => "rt-select2",
177
+ "default" => 4,
178
+ "options" => $this->rtTPGColumns()
179
+ ),
180
+ 'pagination' => array(
181
+ "type" => "checkbox",
182
+ "name" => "pagination",
183
+ "label" => "Pagination",
184
+ 'holderClass' => "pagination",
185
+ "id" => "rt-tpg-pagination",
186
+ "option" => 'Enable'
187
+ ),
188
+ 'posts_per_page' => array(
189
+ "type" => "number",
190
+ "name" => "posts_per_page",
191
+ "label" => "Display per page",
192
+ 'holderClass' => "posts-per-page tpg-hidden",
193
+ "id" => "posts-per-page",
194
+ "default" => 5,
195
+ "description" => __( "If value of Limit setting is not blank (empty), this value should be smaller than Limit value.",
196
+ 'the-post-grid' )
197
+ ),
198
+ 'featured_image_size' => array(
199
+ "type" => "select",
200
+ "name" => "featured_image_size",
201
+ "label" => "Feature Image Size",
202
+ "id" => "featured-image-size",
203
+ "class" => "rt-select2",
204
+ "options" => $rtTPG->get_image_sizes()
205
+ ),
206
+ 'media_source' => array(
207
+ "type" => "radio",
208
+ "name" => "media_source",
209
+ "label" => "Media Source",
210
+ "id" => "media-source",
211
+ "default" => 'feature_image',
212
+ "alignment" => "vertical",
213
+ "options" => $this->rtMediaSource()
214
+ ),
215
+ 'tgp_excerpt_type' => array(
216
+ "type" => "radio",
217
+ "label" => "Excerpt Type",
218
+ "name" => "tgp_excerpt_type",
219
+ "id" => "tgp_excerpt_type",
220
+ "alignment" => "vertical",
221
+ "default" => 'character',
222
+ "options" => $this->get_excerpt_type(),
223
+ ),
224
+ 'excerpt_limit' => array(
225
+ "type" => "number",
226
+ "name" => "excerpt_limit",
227
+ "label" => "Excerpt limit",
228
+ "id" => "excerpt-limit",
229
+ "description" => __( "Excerpt limit only integer number is allowed, Leave it blank for full excerpt. Note: This will remove all html tag",
230
+ 'the-post-grid' )
231
+ ),
232
+ 'tgp_excerpt_more_text' => array(
233
+ "type" => "text",
234
+ "label" => "Excerpt more text",
235
+ "name" => "tgp_excerpt_more_text",
236
+ "id" => "tgp_excerpt_more_text",
237
+ "default" => "..."
238
+ ),
239
+ 'tpg_overlay' => array(
240
+ "type" => "checkbox",
241
+ "name" => "tpg_overlay",
242
+ "label" => "Overlay",
243
+ "id" => "tpg_overlay",
244
+ "option" => 'Enable'
245
+ ),
246
+ );
247
+ }
248
 
249
+ function get_excerpt_type() {
250
+ return array(
251
+ 'character' => "Character",
252
+ 'word' => "Word"
253
+ );
254
+ }
255
 
256
+ function rtTPGStyleFields() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
 
258
+ return array(
259
+ 'primary_color' => array(
260
+ "type" => "text",
261
+ "name" => "primary_color",
262
+ "label" => "Primary Color",
263
+ "id" => "primary-color",
264
+ "class" => "rt-color",
265
+ "default" => "#0367bf"
266
+ ),
267
+ 'button_bg_color' => array(
268
+ "type" => "text",
269
+ "name" => "button_bg_color",
270
+ "label" => "Button background color",
271
+ "id" => "button-bg-color",
272
+ "class" => "rt-color"
273
+ ),
274
+ 'button_hover_bg_color' => array(
275
+ "type" => "text",
276
+ "name" => "button_hover_bg_color",
277
+ "label" => "Button hover background color",
278
+ "id" => "button-hover-bg-color",
279
+ "class" => "rt-color"
280
+ ),
281
+ 'button_active_bg_color' => array(
282
+ "type" => "text",
283
+ "name" => "button_active_bg_color",
284
+ "label" => "Button active background color",
285
+ "id" => "button-active-bg-color",
286
+ "class" => "rt-color"
287
+ ),
288
+ 'button_text_bg_color' => array(
289
+ "type" => "text",
290
+ "name" => "button_text_color",
291
+ "label" => "Button text color",
292
+ "id" => "button-text-color",
293
+ "class" => "rt-color"
294
+ ),
295
+ 'title_color' => array(
296
+ "type" => "text",
297
+ "name" => "title_color",
298
+ "label" => "Title color",
299
+ "id" => "title_color",
300
+ "class" => "rt-color"
301
+ )
302
+ );
303
 
304
+ }
305
+
306
+ function itemFields() {
307
+ return array(
308
+ "type" => "checkbox",
309
+ "name" => "item_fields",
310
+ "label" => "Field selection",
311
+ "id" => "item-fields",
312
+ "multiple" => true,
313
+ "alignment" => "vertical",
314
+ "default" => array_keys( $this->rtTPGItemFields() ),
315
+ "options" => $this->rtTPGItemFields()
316
+ );
317
+ }
318
+
319
+ function rtMediaSource() {
320
+ return array(
321
+ "feature_image" => __( "Feature Image", 'the-post-grid' ),
322
+ "first_image" => __( "First Image from content", 'the-post-grid' )
323
+ );
324
+ }
325
+
326
+ function rtTPGColumns() {
327
+ return array(
328
+ 1 => "Column 1",
329
+ 2 => "Column 2",
330
+ 3 => "Column 3",
331
+ 4 => "Column 4",
332
+ 6 => "Column 6"
333
+ );
334
+ }
335
+
336
+ function rtTPGLayouts() {
337
+ return array(
338
+ 'layout1' => "Layout 1",
339
+ 'layout2' => "Layout 2",
340
+ 'layout3' => "Layout 3",
341
+ 'isotope1' => "Isotope Layout"
342
+ );
343
+ }
344
+
345
+ function rtTPGItemFields() {
346
+ return array(
347
+ 'title' => __( "Title", 'the-post-grid' ),
348
+ 'excerpt' => __( "Excerpt", 'the-post-grid' ),
349
+ 'read_more' => __( "Read More", 'the-post-grid' ),
350
+ 'post_date' => __( "Post Date", 'the-post-grid' ),
351
+ 'author' => __( "Author", 'the-post-grid' ),
352
+ 'categories' => __( "Categories", 'the-post-grid' ),
353
+ 'tags' => __( "Tags", 'the-post-grid' ),
354
+ 'comment_count' => __( "Comment Count", 'the-post-grid' )
355
+ );
356
+ }
357
+
358
+ }
359
 
360
  endif;
lib/classes/rtTPGShortCode.php CHANGED
@@ -1,381 +1,381 @@
1
  <?php
2
 
3
- if(!class_exists('rtTPGShortCode')):
4
-
5
- class rtTPGShortCode
6
- {
7
-
8
- private $scA = array();
9
-
10
- function __construct()
11
- {
12
- add_shortcode( 'the-post-grid', array( $this, 'the_post_grid_short_code' ) );
13
- }
14
- function register_sc_scripts(){
15
- global $rtTPG;
16
- $iso = false;
17
-
18
- foreach($this->scA as $sc){
19
- if(isset($sc) && is_array($sc)) {
20
- if ($sc['isIsotope']) {
21
- $iso = true;
22
- }
23
- }
24
- }
25
- if(count($this->scA)){
26
- if($iso){
27
- wp_enqueue_script('rt-isotope-js');
28
- }
29
- wp_enqueue_style('rt-fontawsome');
30
- wp_enqueue_script('rt-image-load-js');
31
- wp_enqueue_script('rt-actual-height-js');
32
- wp_enqueue_script('rt-tpg-js');
33
- $nonce = wp_create_nonce( $rtTPG->nonceText() );
34
- wp_localize_script( 'rt-tpg-js', 'rttpg',
35
- array(
36
- 'nonceID' => $rtTPG->nonceId(),
37
- 'nonce' => $nonce,
38
- 'ajaxurl' => admin_url( 'admin-ajax.php' )
39
- ) );
40
- }
41
- }
42
-
43
- function the_post_grid_short_code($atts, $content = null){
44
- $rand = mt_rand();
45
- $layoutID = "rt-tpg-container-".$rand;
46
- global $rtTPG;
47
- $html = null;
48
- $arg= array();
49
- $atts = shortcode_atts( array(
50
- 'id' => null
51
- ), $atts, 'the-post-grid' );
52
- $scID = $atts['id'];
53
- if($scID && !is_null(get_post( $scID ))){
54
- $scMeta = get_post_meta($scID);
55
-
56
- $layout = (isset($scMeta['layout'][0]) ? $scMeta['layout'][0] : 'layout1');
57
- if(!in_array($layout, array_keys($rtTPG->rtTPGLayouts())) ){
58
- $layout = 'layout1';
59
- }
60
- $col = (isset($scMeta['column'][0]) ? intval($scMeta['column'][0]) : 4);
61
- if (!in_array($col, array_keys($rtTPG->rtTPGColumns())) ) {
62
- $col = 4;
63
- }
64
- $fImgSize = (isset($scMeta['featured_image_size'][0]) ? $scMeta['featured_image_size'][0] : "medium");
65
- $mediaSource = (isset($scMeta['media_source'][0]) ? $scMeta['media_source'][0] : "feature_image");
66
- $excerpt_limit = (isset($scMeta['excerpt_limit'][0]) ? absint($scMeta['excerpt_limit'][0]) : 0);
67
-
68
-
69
- $isIsotope = preg_match('/isotope/', $layout);
70
-
71
- /* Argument create */
72
- $args = array();
73
- $itemIdsArgs = array();
74
-
75
-
76
- $postType = (isset($scMeta['tpg_post_type'][0]) ? $scMeta['tpg_post_type'][0] : null);
77
- if($postType){
78
- $args['post_type'] = $itemIdsArgs['post_type'] = $postType;
79
- }
80
-
81
- // Common filter
82
- /* post__in */
83
- $post__in = (isset($scMeta['post__in'][0]) ? $scMeta['post__in'][0] : null);
84
- if($post__in){
85
- $post__in = explode(',', $post__in);
86
- $args['post__in'] = $itemIdsArgs['post__in'] = $post__in;
87
- }
88
- /* post__not_in */
89
- $post__not_in = (isset($scMeta['post__not_in'][0]) ? $scMeta['post__not_in'][0] : null);
90
- if($post__not_in){
91
- $post__not_in = explode(',', $post__not_in);
92
- $args['post__not_in'] = $itemIdsArgs['post__not_in'] = $post__not_in;
93
- }
94
-
95
- /* LIMIT */
96
- $limit = (!empty($scMeta['limit'][0]) ? ($scMeta['limit'][0] == -1 ? 10000000 : (int)$scMeta['limit'][0]) : 10000000);
97
- $args['posts_per_page'] = $itemIdsArgs['posts_per_page'] = $limit;
98
- $pagination = false;
99
- if(!$isIsotope){
100
- $pagination = (isset($scMeta['pagination'][0]) ? $scMeta['pagination'][0] : false);
101
- if($pagination) {
102
-
103
- $posts_per_page = (isset($scMeta['posts_per_page'][0]) ? intval($scMeta['posts_per_page'][0]) : $limit);
104
- if ( $posts_per_page > $limit ) {
105
- $posts_per_page = $limit;
106
- }
107
- // Set 'posts_per_page' parameter
108
- $args[ 'posts_per_page' ] = $posts_per_page;
109
-
110
- $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
111
-
112
- $offset = $posts_per_page * ( (int) $paged - 1 );
113
- $args['paged'] = $paged;
114
-
115
- // Update posts_per_page
116
- if ( intval( $args[ 'posts_per_page' ] ) > $limit - $offset ) {
117
- $args[ 'posts_per_page' ] = $limit - $offset;
118
- }
119
-
120
- }
121
- }
122
-
123
-
124
-
125
-
126
-
127
-
128
- // Advance Filter
129
- $adv_filter = (isset($scMeta['post_filter']) ? $scMeta['post_filter'] : array());
130
-
131
- // Taxonomy
132
- $taxQ = array();
133
- if(in_array('tpg_taxonomy', $adv_filter) && isset($scMeta['tpg_taxonomy'])){
134
-
135
- if(is_array($scMeta['tpg_taxonomy']) && !empty($scMeta['tpg_taxonomy'])){
136
- foreach($scMeta['tpg_taxonomy'] as $taxonomy){
137
- $terms = (isset($scMeta['term_'.$taxonomy]) ? $scMeta['term_'.$taxonomy] : array());
138
- if(is_array($terms) && !empty($terms)){
139
- $operator = (isset($scMeta['term_operator_'.$taxonomy][0]) ? $scMeta['term_operator_'.$taxonomy][0] : "IN");
140
- $taxQ[] = array(
141
- 'taxonomy' => $taxonomy,
142
- 'field' => 'term_id',
143
- 'terms' => $terms,
144
- 'operator' => $operator,
145
- );
146
- }
147
- }
148
- }
149
- if(count($taxQ) >= 2){
150
- $relation = (isset($scMeta['taxonomy_relation'][0]) ? $scMeta['taxonomy_relation'][0] : "AND");
151
- $taxQ['relation'] = $relation;
152
- }
153
- }
154
-
155
- if(!empty($taxQ)){
156
- $args['tax_query'] = $itemIdsArgs['tax_query'] = $taxQ;
157
- }
158
-
159
- // Order
160
- if(in_array('order', $adv_filter)){
161
- $order_by = (isset($scMeta['order_by'][0]) ? $scMeta['order_by'][0] : null);
162
- $order = (isset($scMeta['order'][0]) ? $scMeta['order'][0] : null);
163
- if($order){
164
- $args['order'] = $itemIdsArgs['order'] = $order;
165
- }if($order_by){
166
- $args['orderby'] = $itemIdsArgs['orderby'] = $order_by;
167
- }
168
- }
169
- // Status
170
- if(in_array('tpg_post_status', $adv_filter)){
171
- $post_status = (isset($scMeta['tpg_post_status']) ? $scMeta['tpg_post_status'] : array());
172
- if(!empty($post_status)){
173
- $args['post_status'] = $itemIdsArgs['post_status'] = $post_status;
174
- }else {
175
- $args['post_status'] = $itemIdsArgs['post_status'] = 'publish';
176
- }
177
- }
178
- // Author
179
- $author = (isset($scMeta['author']) ? $scMeta['author'] : array());
180
- if(in_array('author', $adv_filter) && !empty($author)){
181
- $args['author__in'] = $itemIdsArgs['author__in'] = $author;
182
- }
183
- // Search
184
- $s = (isset($scMeta['s'][0]) ? $scMeta['s'][0] : array());
185
- if(in_array('s', $adv_filter) && !empty($s)){
186
- $args['s'] = $itemIdsArgs['s'] = $s;
187
- }
188
-
189
- // Validation
190
- if (!in_array($col, array_keys($rtTPG->rtTPGColumns())) ) {
191
- $col = 4;
192
- }
193
-
194
- if(!in_array($layout, array_keys($rtTPG->rtTPGLayouts())) ){
195
- $layout = 'layout1';
196
- }
197
-
198
- if(($layout == 'layout2')|| ($layout=='layout3')){
199
- if($col==2){
200
- $arg['image_area']="rt-col-lg-5 rt-col-md-5 rt-col-sm-6 rt-col-xs-12 ";
201
- $arg['content_area']="rt-col-lg-7 rt-col-md-7 rt-col-sm-6 rt-col-xs-12 ";
202
- }else{
203
- $arg['image_area']="rt-col-lg-4 rt-col-md-4 rt-col-sm-6 rt-col-xs-12 ";
204
- $arg['content_area']="rt-col-lg-8 rt-col-md-8 rt-col-sm-6 rt-col-xs-12 ";
205
- }
206
- }
207
- $col = round(12/$col);
208
- if(($layout == 'layout2')|| ($layout=='layout3')){
209
- $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-12 rt-col-xs-12";
210
- }else{
211
- $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-6 rt-col-xs-12";
212
- }
213
-
214
-
215
- $arg['class'] = 'equal-height';
216
- if($isIsotope){
217
- $arg['class'] .= ' isotope-item';
218
- }
219
- $arg['items'] = isset($scMeta['item_fields']) ? ($scMeta['item_fields'] ? $scMeta['item_fields'] : array()) : array();
220
- $postQuery = new WP_Query( $args );
221
- // Start layout
222
- $html .="<div class='container-fluid rt-tpg-container' id='{$layoutID}'>";
223
- $extClass = null;
224
- if($isIsotope){
225
- $extClass = ' tpg-isotope';
226
- }
227
- $html .="<div class='row {$layout}{$extClass}'>";
228
- if ( $postQuery->have_posts() ) {
229
- $html .= $this->layoutStyle($layoutID, $scMeta);
230
-
231
- if($isIsotope) {
232
- $isotope_filter = isset($scMeta['isotope_filter'][0]) ? $scMeta['isotope_filter'][0] : null;
233
- $selectedTerms = (isset($scMeta['term_'.$isotope_filter]) ? $scMeta['term_'.$isotope_filter] : array());
234
- $terms = get_terms( $isotope_filter, array(
235
- 'orderby' => 'name',
236
- 'order' => 'ASC',
237
- 'hide_empty' => false,
238
- 'include' => $selectedTerms
239
- ));
240
-
241
- $html .= '<div id="iso-button-'.$rand.'" class="rt-tpg-isotope-buttons button-group filter-button-group option-set">
242
- <button data-filter="*" class="selected">'.__('Show all', 'the-post-grid').'</button>';
243
- if(! empty( $terms ) && ! is_wp_error( $terms )){
244
- foreach ( $terms as $term ) {
245
- $html .= "<button data-filter='.iso_{$term->term_id}'>" . $term->name . "</button>";
246
- }
247
- }
248
- $html .='</div>';
249
-
250
- $html .= '<div class="rt-tpg-isotope" id="iso-tpg-'.$rand.'">';
251
- }
252
-
253
-
254
- while ($postQuery->have_posts()) : $postQuery->the_post();
255
- $pID = get_the_ID();
256
- $arg['pID'] = $pID;
257
- $arg['title'] = get_the_title();
258
- $arg['pLink'] = get_permalink();
259
- $arg['author'] = '<a href="'.get_author_posts_url( get_the_author_meta( 'ID' ) ).'">'.get_the_author().'</a>';
260
- $cc = wp_count_comments($pID);
261
- $arg['date'] = get_the_date();
262
- $excerpt = get_the_excerpt();
263
- if($excerpt_limit){
264
- $arg['excerpt'] = $rtTPG->strip_tags_content($excerpt, $excerpt_limit);
265
- }else{
266
- $arg['excerpt'] = $excerpt;
267
- }
268
- $arg['categories'] = get_the_term_list($pID, 'category', null, ', ');
269
- $arg['tags'] = get_the_term_list($pID, 'post_tag', null, ', ');
270
- if($isIsotope){
271
- $isotope_filter = isset($scMeta['isotope_filter'][0]) ? $scMeta['isotope_filter'][0] : null;
272
- $termAs = wp_get_post_terms($pID, $isotope_filter, array("fields" => "all"));
273
- $isoFilter = null;
274
- if(!empty($termAs)){
275
- foreach($termAs as $term){
276
- $isoFilter .= " iso_".$term->term_id;
277
- }
278
- }
279
- $arg['isoFilter'] = $isoFilter;
280
- }
281
- $deptClass = null;
282
- if(!empty($deptAs)){
283
- foreach($deptAs as $dept){
284
- $deptClass .= " ".$dept->slug;
285
- }
286
- }
287
- if(comments_open()){
288
- $arg['comment'] = "<a href='".get_comments_link( $pID )."'>{$cc->total_comments} </a>";
289
- }else{
290
- $arg['comment'] = "{$cc->total_comments}";
291
- }
292
- $imgSrc = null;
293
-
294
- $arg['imgSrc'] = $rtTPG->getFeatureImageSrc($pID,$fImgSize, $mediaSource);
295
-
296
- $html .= $rtTPG->render('layouts/'.$layout, $arg, true);
297
-
298
- endwhile;
299
-
300
- if($isIsotope){
301
- $html .= '</div>'; // End isotope item holder
302
- }
303
-
304
- }else{
305
- $html .= "<p>".__('No post found','the-post-grid')."</p>";
306
- }
307
- $html .="</div>"; // End row
308
- if($pagination && !$isIsotope){
309
- $found = 0;
310
- if($postQuery->found_posts > $limit){
311
- $found = $limit;
312
- }else{
313
- $found = $postQuery->found_posts;
314
- }
315
- $max_num_pages = ceil($found / $posts_per_page);
316
- $html .= $rtTPG->rt_pagination($max_num_pages, $args[ 'posts_per_page' ]);
317
- }
318
- $html .="</div>"; // container rt-tpg
319
-
320
- wp_reset_postdata();
321
-
322
- $scriptGenerator = array();
323
- $scriptGenerator['layout'] = $layoutID;
324
- $scriptGenerator['rand'] = $rand;
325
- $scriptGenerator['scMeta'] = $scMeta;
326
- $scriptGenerator['isIsotope'] = $isIsotope;
327
- $this->scA[] = $scriptGenerator;
328
- add_action( 'wp_footer', array($this, 'register_sc_scripts'));
329
- }else{
330
- $html .="<p>No shortCode found</p>";
331
- }
332
- return $html;
333
- }
334
-
335
- private function layoutStyle($layout, $scMeta)
336
- {
337
- $css = null;
338
- $css .= "<style type='text/css' media='all'>";
339
- // Variable
340
- $primaryColor = (isset($scMeta['primary_color'][0]) ? $scMeta['primary_color'][0] : null);
341
- if($primaryColor){
342
- $css .= "#{$layout} .rt-detail i,#{$layout} .rt-detail .post-meta-user a,#{$layout} .rt-detail .post-meta-category a{";
343
- $css .= "color:" . $primaryColor.";";
344
- $css .="}";
345
- $css .= "body .rt-tpg-container .rt-tpg-isotope-buttons .selected{";
346
- $css .= "background-color:" . $primaryColor.";";
347
- $css .="}";
348
- $css .= "#{$layout} .rt-detail .read-more{";
349
- $css .= "border: 1px solid " . $primaryColor.";";
350
- $css .="}";
351
- }
352
- $button_bg_color = (isset($scMeta['button_bg_color'][0]) ? $scMeta['button_bg_color'][0] : null);
353
- if($button_bg_color){
354
- $css .= "#{$layout} .pagination li a,#{$layout} .rt-tpg-isotope-buttons button,#{$layout} .rt-detail .read-more{";
355
- $css .= "background-color:" . $button_bg_color.";";
356
- $css .="}";
357
- }
358
- $button_hover_bg_color = (isset($scMeta['button_hover_bg_color'][0]) ? $scMeta['button_hover_bg_color'][0] : null);
359
- if($button_hover_bg_color){
360
- $css .= "#{$layout} .pagination li a:hover,#{$layout} .rt-tpg-isotope-buttons button:hover,#{$layout} .rt-detail .read-more:hover{";
361
- $css .= "background-color:" . $button_hover_bg_color.";";
362
- $css .="}";
363
- }
364
- $button_active_bg_color = (isset($scMeta['button_active_bg_color'][0]) ? $scMeta['button_active_bg_color'][0] : null);
365
- if($button_active_bg_color){
366
- $css .= "#{$layout} .pagination li.active span, #{$layout} .rt-tpg-isotope-buttons button.selected{";
367
- $css .= "background-color:" . $button_active_bg_color.";";
368
- $css .="}";
369
- }
370
- $button_text_color = (isset($scMeta['button_text_color'][0]) ? $scMeta['button_text_color'][0] : null);
371
- if($button_text_color){
372
- $css .= "#{$layout} .pagination li a,#{$layout} .rt-tpg-isotope-buttons button,#{$layout} .rt-detail .read-more a{";
373
- $css .= "color:" . $button_text_color.";";
374
- $css .="}";
375
- }
376
-
377
- $css .= "</style>";
378
- return $css;
379
- }
380
- }
381
  endif;
1
  <?php
2
 
3
+ if ( ! class_exists( 'rtTPGShortCode' ) ):
4
+
5
+ class rtTPGShortCode {
6
+
7
+ private $scA = array();
8
+
9
+ function __construct() {
10
+ add_shortcode( 'the-post-grid', array( $this, 'the_post_grid_short_code' ) );
11
+ }
12
+
13
+ function register_sc_scripts() {
14
+ global $rtTPG;
15
+ $iso = false;
16
+
17
+ foreach ( $this->scA as $sc ) {
18
+ if ( isset( $sc ) && is_array( $sc ) ) {
19
+ if ( $sc['isIsotope'] ) {
20
+ $iso = true;
21
+ }
22
+ }
23
+ }
24
+ if ( count( $this->scA ) ) {
25
+ if ( $iso ) {
26
+ wp_enqueue_script( 'rt-isotope-js' );
27
+ }
28
+ wp_enqueue_style( 'rt-fontawsome' );
29
+ wp_enqueue_script( 'rt-image-load-js' );
30
+ wp_enqueue_script( 'rt-actual-height-js' );
31
+ wp_enqueue_script( 'rt-tpg-js' );
32
+ $nonce = wp_create_nonce( $rtTPG->nonceText() );
33
+ wp_localize_script( 'rt-tpg-js', 'rttpg',
34
+ array(
35
+ 'nonceID' => $rtTPG->nonceId(),
36
+ 'nonce' => $nonce,
37
+ 'ajaxurl' => admin_url( 'admin-ajax.php' )
38
+ ) );
39
+ }
40
+ }
41
+
42
+ function the_post_grid_short_code( $atts, $content = null ) {
43
+ $rand = mt_rand();
44
+ $layoutID = "rt-tpg-container-" . $rand;
45
+ global $rtTPG;
46
+ $html = null;
47
+ $arg = array();
48
+ $atts = shortcode_atts( array(
49
+ 'id' => null
50
+ ), $atts, 'the-post-grid' );
51
+ $scID = $atts['id'];
52
+ if ( $scID && ! is_null( get_post( $scID ) ) ) {
53
+ $scMeta = get_post_meta( $scID );
54
+
55
+ $layout = ( isset( $scMeta['layout'][0] ) ? $scMeta['layout'][0] : 'layout1' );
56
+ if ( ! in_array( $layout, array_keys( $rtTPG->rtTPGLayouts() ) ) ) {
57
+ $layout = 'layout1';
58
+ }
59
+ $col = ( isset( $scMeta['column'][0] ) ? intval( $scMeta['column'][0] ) : 4 );
60
+ if ( ! in_array( $col, array_keys( $rtTPG->rtTPGColumns() ) ) ) {
61
+ $col = 4;
62
+ }
63
+ $fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : "medium" );
64
+ $mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : "feature_image" );
65
+ $excerpt_type = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
66
+ $excerpt_limit = ( isset( $scMeta['excerpt_limit'][0] ) ? absint( $scMeta['excerpt_limit'][0] ) : 0 );
67
+ $excerpt_more_text = ( isset( $scMeta['tgp_excerpt_more_text'][0] ) ? $scMeta['tgp_excerpt_more_text'][0] : null );
68
+
69
+
70
+ $isIsotope = preg_match( '/isotope/', $layout );
71
+
72
+ /* Argument create */
73
+ $args = array();
74
+ $itemIdsArgs = array();
75
+
76
+
77
+ $postType = ( isset( $scMeta['tpg_post_type'][0] ) ? $scMeta['tpg_post_type'][0] : null );
78
+ if ( $postType ) {
79
+ $args['post_type'] = $itemIdsArgs['post_type'] = $postType;
80
+ }
81
+
82
+ // Common filter
83
+ /* post__in */
84
+ $post__in = ( isset( $scMeta['post__in'][0] ) ? $scMeta['post__in'][0] : null );
85
+ if ( $post__in ) {
86
+ $post__in = explode( ',', $post__in );
87
+ $args['post__in'] = $itemIdsArgs['post__in'] = $post__in;
88
+ }
89
+ /* post__not_in */
90
+ $post__not_in = ( isset( $scMeta['post__not_in'][0] ) ? $scMeta['post__not_in'][0] : null );
91
+ if ( $post__not_in ) {
92
+ $post__not_in = explode( ',', $post__not_in );
93
+ $args['post__not_in'] = $itemIdsArgs['post__not_in'] = $post__not_in;
94
+ }
95
+
96
+ /* LIMIT */
97
+ $limit = ( ! empty( $scMeta['limit'][0] ) ? ( $scMeta['limit'][0] == - 1 ? 10000000 : (int) $scMeta['limit'][0] ) : 10000000 );
98
+ $args['posts_per_page'] = $itemIdsArgs['posts_per_page'] = $limit;
99
+ $pagination = false;
100
+ if ( ! $isIsotope ) {
101
+ $pagination = ( isset( $scMeta['pagination'][0] ) ? $scMeta['pagination'][0] : false );
102
+ if ( $pagination ) {
103
+
104
+ $posts_per_page = ( isset( $scMeta['posts_per_page'][0] ) ? intval( $scMeta['posts_per_page'][0] ) : $limit );
105
+ if ( $posts_per_page > $limit ) {
106
+ $posts_per_page = $limit;
107
+ }
108
+ // Set 'posts_per_page' parameter
109
+ $args['posts_per_page'] = $posts_per_page;
110
+
111
+ $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
112
+
113
+ $offset = $posts_per_page * ( (int) $paged - 1 );
114
+ $args['paged'] = $paged;
115
+
116
+ // Update posts_per_page
117
+ if ( intval( $args['posts_per_page'] ) > $limit - $offset ) {
118
+ $args['posts_per_page'] = $limit - $offset;
119
+ }
120
+
121
+ }
122
+ }
123
+
124
+
125
+ // Advance Filter
126
+ $adv_filter = ( isset( $scMeta['post_filter'] ) ? $scMeta['post_filter'] : array() );
127
+
128
+ // Taxonomy
129
+ $taxQ = array();
130
+ if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $scMeta['tpg_taxonomy'] ) ) {
131
+
132
+ if ( is_array( $scMeta['tpg_taxonomy'] ) && ! empty( $scMeta['tpg_taxonomy'] ) ) {
133
+ foreach ( $scMeta['tpg_taxonomy'] as $taxonomy ) {
134
+ $terms = ( isset( $scMeta[ 'term_' . $taxonomy ] ) ? $scMeta[ 'term_' . $taxonomy ] : array() );
135
+ if ( is_array( $terms ) && ! empty( $terms ) ) {
136
+ $operator = ( isset( $scMeta[ 'term_operator_' . $taxonomy ][0] ) ? $scMeta[ 'term_operator_' . $taxonomy ][0] : "IN" );
137
+ $taxQ[] = array(
138
+ 'taxonomy' => $taxonomy,
139
+ 'field' => 'term_id',
140
+ 'terms' => $terms,
141
+ 'operator' => $operator,
142
+ );
143
+ }
144
+ }
145
+ }
146
+ if ( count( $taxQ ) >= 2 ) {
147
+ $relation = ( isset( $scMeta['taxonomy_relation'][0] ) ? $scMeta['taxonomy_relation'][0] : "AND" );
148
+ $taxQ['relation'] = $relation;
149
+ }
150
+ }
151
+
152
+ if ( ! empty( $taxQ ) ) {
153
+ $args['tax_query'] = $itemIdsArgs['tax_query'] = $taxQ;
154
+ }
155
+
156
+ // Order
157
+ if ( in_array( 'order', $adv_filter ) ) {
158
+ $order_by = ( isset( $scMeta['order_by'][0] ) ? $scMeta['order_by'][0] : null );
159
+ $order = ( isset( $scMeta['order'][0] ) ? $scMeta['order'][0] : null );
160
+ if ( $order ) {
161
+ $args['order'] = $itemIdsArgs['order'] = $order;
162
+ }
163
+ if ( $order_by ) {
164
+ $args['orderby'] = $itemIdsArgs['orderby'] = $order_by;
165
+ }
166
+ }
167
+ // Status
168
+ if ( in_array( 'tpg_post_status', $adv_filter ) ) {
169
+ $post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : array() );
170
+ if ( ! empty( $post_status ) ) {
171
+ $args['post_status'] = $itemIdsArgs['post_status'] = $post_status;
172
+ } else {
173
+ $args['post_status'] = $itemIdsArgs['post_status'] = 'publish';
174
+ }
175
+ }
176
+ // Author
177
+ $author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : array() );
178
+ if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
179
+ $args['author__in'] = $itemIdsArgs['author__in'] = $author;
180
+ }
181
+ // Search
182
+ $s = ( isset( $scMeta['s'][0] ) ? $scMeta['s'][0] : array() );
183
+ if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
184
+ $args['s'] = $itemIdsArgs['s'] = $s;
185
+ }
186
+
187
+ // Validation
188
+ if ( ! in_array( $col, array_keys( $rtTPG->rtTPGColumns() ) ) ) {
189
+ $col = 4;
190
+ }
191
+
192
+ if ( ! in_array( $layout, array_keys( $rtTPG->rtTPGLayouts() ) ) ) {
193
+ $layout = 'layout1';
194
+ }
195
+ if ( ( $layout == 'layout2' ) || ( $layout == 'layout3' ) ) {
196
+ $iCol = ( isset( $scMeta['tgp_layout2_image_column'][0] ) ? absint( $scMeta['tgp_layout2_image_column'][0] ) : 4 );
197
+ $iCol = $iCol > 12 ? 4 : $iCol;
198
+ $cCol = 12 - $iCol;
199
+ $arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
200
+ $arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
201
+ }
202
+ $col = round( 12 / $col );
203
+ if ( ( $layout == 'layout2' ) || ( $layout == 'layout3' ) ) {
204
+ $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-12 rt-col-xs-12";
205
+ } else {
206
+ $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-6 rt-col-xs-12";
207
+ }
208
+
209
+
210
+ $arg['class'] = 'rt-equal-height';
211
+ if ( $isIsotope ) {
212
+ $arg['class'] .= ' isotope-item';
213
+ }
214
+
215
+ $arg['overlay'] = empty( $scMeta['tpg_overlay'][0] ) ? false : true;
216
+
217
+ $arg['items'] = isset( $scMeta['item_fields'] ) ? ( $scMeta['item_fields'] ? $scMeta['item_fields'] : array() ) : array();
218
+ $postQuery = new WP_Query( $args );
219
+ // Start layout
220
+ $html .= "<div class='container-fluid rt-tpg-container' id='{$layoutID}'>";
221
+ $extClass = null;
222
+ if ( $isIsotope ) {
223
+ $extClass = ' tpg-isotope';
224
+ }
225
+ $html .= "<div class='row {$layout}{$extClass}'>";
226
+ if ( $postQuery->have_posts() ) {
227
+ $html .= $this->layoutStyle( $layoutID, $scMeta );
228
+
229
+ if ( $isIsotope ) {
230
+ $isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
231
+ $selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : array() );
232
+ $terms = get_terms( $isotope_filter, array(
233
+ 'orderby' => 'name',
234
+ 'order' => 'ASC',
235
+ 'hide_empty' => false,
236
+ 'include' => $selectedTerms
237
+ ) );
238
+
239
+ $html .= '<div id="iso-button-' . $rand . '" class="rt-tpg-isotope-buttons button-group filter-button-group option-set">
240
+ <button data-filter="*" class="selected">' . __( 'Show all',
241
+ 'the-post-grid' ) . '</button>';
242
+ if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
243
+ foreach ( $terms as $term ) {
244
+ $html .= "<button data-filter='.iso_{$term->term_id}'>" . $term->name . "</button>";
245
+ }
246
+ }
247
+ $html .= '</div>';
248
+
249
+ $html .= '<div class="rt-tpg-isotope" id="iso-tpg-' . $rand . '">';
250
+ }
251
+
252
+
253
+ while ( $postQuery->have_posts() ) : $postQuery->the_post();
254
+ $pID = get_the_ID();
255
+ $arg['pID'] = $pID;
256
+ $arg['title'] = get_the_title();
257
+ $arg['pLink'] = get_permalink();
258
+ $arg['author'] = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '">' . get_the_author() . '</a>';
259
+ $cc = wp_count_comments( $pID );
260
+ $arg['date'] = get_the_date();
261
+ $excerpt = get_the_excerpt();
262
+ $arg['excerpt'] = $rtTPG->strip_tags_content( $excerpt, $excerpt_type, $excerpt_limit,
263
+ $excerpt_more_text );
264
+ $arg['categories'] = get_the_term_list( $pID, 'category', null, ', ' );
265
+ $arg['tags'] = get_the_term_list( $pID, 'post_tag', null, ', ' );
266
+ if ( $isIsotope ) {
267
+ $isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
268
+ $termAs = wp_get_post_terms( $pID, $isotope_filter, array( "fields" => "all" ) );
269
+ $isoFilter = null;
270
+ if ( ! empty( $termAs ) ) {
271
+ foreach ( $termAs as $term ) {
272
+ $isoFilter .= " iso_" . $term->term_id;
273
+ }
274
+ }
275
+ $arg['isoFilter'] = $isoFilter;
276
+ }
277
+ $deptClass = null;
278
+ if ( ! empty( $deptAs ) ) {
279
+ foreach ( $deptAs as $dept ) {
280
+ $deptClass .= " " . $dept->slug;
281
+ }
282
+ }
283
+ if ( comments_open() ) {
284
+ $arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$cc->total_comments} </a>";
285
+ } else {
286
+ $arg['comment'] = "{$cc->total_comments}";
287
+ }
288
+ $imgSrc = null;
289
+
290
+ $arg['imgSrc'] = $rtTPG->getFeatureImageSrc( $pID, $fImgSize, $mediaSource );
291
+
292
+ $html .= $rtTPG->render( 'layouts/' . $layout, $arg, true );
293
+
294
+ endwhile;
295
+
296
+ if ( $isIsotope ) {
297
+ $html .= '</div>'; // End isotope item holder
298
+ }
299
+
300
+ } else {
301
+ $html .= "<p>" . __( 'No post found', 'the-post-grid' ) . "</p>";
302
+ }
303
+ $html .= "</div>"; // End row
304
+ if ( $pagination && ! $isIsotope ) {
305
+ $found = 0;
306
+ if ( $postQuery->found_posts > $limit ) {
307
+ $found = $limit;
308
+ } else {
309
+ $found = $postQuery->found_posts;
310
+ }
311
+ $max_num_pages = ceil( $found / $posts_per_page );
312
+ $html .= $rtTPG->rt_pagination( $max_num_pages, $args['posts_per_page'] );
313
+ }
314
+ $html .= "</div>"; // container rt-tpg
315
+
316
+ wp_reset_postdata();
317
+
318
+ $scriptGenerator = array();
319
+ $scriptGenerator['layout'] = $layoutID;
320
+ $scriptGenerator['rand'] = $rand;
321
+ $scriptGenerator['scMeta'] = $scMeta;
322
+ $scriptGenerator['isIsotope'] = $isIsotope;
323
+ $this->scA[] = $scriptGenerator;
324
+ add_action( 'wp_footer', array( $this, 'register_sc_scripts' ) );
325
+ } else {
326
+ $html .= "<p>No shortCode found</p>";
327
+ }
328
+
329
+ return $html;
330
+ }
331
+
332
+ private function layoutStyle( $layout, $scMeta ) {
333
+ $css = null;
334
+ $css .= "<style type='text/css' media='all'>";
335
+ // Variable
336
+ $primaryColor = ( !empty( $scMeta['primary_color'][0] ) ? $scMeta['primary_color'][0] : null );
337
+ if ( $primaryColor ) {
338
+ $css .= "#{$layout} .rt-detail i,#{$layout} .rt-detail .post-meta-user a,#{$layout} .rt-detail .post-meta-category a{";
339
+ $css .= "color:" . $primaryColor . ";";
340
+ $css .= "}";
341
+ $css .= "body .rt-tpg-container .rt-tpg-isotope-buttons .selected{";
342
+ $css .= "background-color:" . $primaryColor . ";";
343
+ $css .= "}";
344
+ }
345
+ $button_bg_color = ( !empty( $scMeta['button_bg_color'][0] ) ? $scMeta['button_bg_color'][0] : null );
346
+ if ( $button_bg_color ) {
347
+ $css .= "#{$layout} .pagination li a,#{$layout} .rt-tpg-isotope-buttons button,#{$layout} .rt-detail .read-more a{";
348
+ $css .= "background-color:" . $button_bg_color . ";";
349
+ $css .= "}";
350
+ }
351
+ $button_hover_bg_color = ( !empty( $scMeta['button_hover_bg_color'][0] ) ? $scMeta['button_hover_bg_color'][0] : null );
352
+ if ( $button_hover_bg_color ) {
353
+ $css .= "#{$layout} .pagination li a:hover,#{$layout} .rt-tpg-isotope-buttons button:hover,#{$layout} .rt-detail .read-more a:hover{";
354
+ $css .= "background-color:" . $button_hover_bg_color . ";";
355
+ $css .= "}";
356
+ }
357
+ $button_active_bg_color = ( !empty( $scMeta['button_active_bg_color'][0] ) ? $scMeta['button_active_bg_color'][0] : null );
358
+ if ( $button_active_bg_color ) {
359
+ $css .= "#{$layout} .pagination li.active span, #{$layout} .rt-tpg-isotope-buttons button.selected{";
360
+ $css .= "background-color:" . $button_active_bg_color . ";";
361
+ $css .= "}";
362
+ }
363
+ $button_text_color = ( !empty( $scMeta['button_text_color'][0] ) ? $scMeta['button_text_color'][0] : null );
364
+ if ( $button_text_color ) {
365
+ $css .= "#{$layout} .pagination li a,#{$layout} .rt-tpg-isotope-buttons button,#{$layout} .rt-detail .read-more a{";
366
+ $css .= "color:" . $button_text_color . ";";
367
+ $css .= "}";
368
+ }
369
+ $title_color = ( !empty( $scMeta['title_color'][0] ) ? $scMeta['title_color'][0] : null );
370
+ if ( $title_color ) {
371
+ $css .= "#{$layout} .rt-detail h2.entry-title a{";
372
+ $css .= "color:" . $title_color . ";";
373
+ $css .= "}";
374
+ }
375
+
376
+ $css .= "</style>";
377
+
378
+ return $css;
379
+ }
380
+ }
381
  endif;
lib/init.php CHANGED
@@ -12,7 +12,7 @@ class rtTPG
12
 
13
  $this->options = array(
14
  'settings' => 'rt_the_post_grid_settings',
15
- 'version' => '1.5',
16
  'installed_version' => 'rt_the_post_grid_current_version'
17
  );
18
  $this->defaultSettings = array(
12
 
13
  $this->options = array(
14
  'settings' => 'rt_the_post_grid_settings',
15
+ 'version' => '1.6',
16
  'installed_version' => 'rt_the_post_grid_current_version'
17
  );
18
  $this->defaultSettings = array(
lib/views/layouts/isotope1.php CHANGED
@@ -6,11 +6,13 @@ $html .= "<div class='{$grid} {$class} {$isoFilter}'>";
6
  $html .= '<div class="rt-holder">';
7
  if(!empty($imgSrc)) {
8
  $html .= '<div class="rt-img-holder">';
9
- $html .= '<div class="overlay">';
10
- $html .= "<a class='view-details' href='{$pLink}'>
 
11
  <i class='fa fa-info'></i>
12
  </a>";
13
- $html .= '</div>';
 
14
  $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
15
  $html .= '</div> ';
16
  }
@@ -43,8 +45,6 @@ $html .= "<div class='{$grid} {$class} {$isoFilter}'>";
43
  if(!empty($postMetaMid)){
44
  $html .= "<div class='post-meta-tags'>{$postMetaMid}</div>";
45
  }
46
-
47
-
48
  $html .= '</div>';
49
  $html .= '</div>';
50
  $html .='</div>';
6
  $html .= '<div class="rt-holder">';
7
  if(!empty($imgSrc)) {
8
  $html .= '<div class="rt-img-holder">';
9
+ if($overlay) {
10
+ $html .= '<div class="overlay">';
11
+ $html .= "<a class='view-details' href='{$pLink}'>
12
  <i class='fa fa-info'></i>
13
  </a>";
14
+ $html .= '</div>';
15
+ }
16
  $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
17
  $html .= '</div> ';
18
  }
45
  if(!empty($postMetaMid)){
46
  $html .= "<div class='post-meta-tags'>{$postMetaMid}</div>";
47
  }
 
 
48
  $html .= '</div>';
49
  $html .= '</div>';
50
  $html .='</div>';
lib/views/layouts/layout1.php CHANGED
@@ -5,11 +5,13 @@ $html .= "<div class='{$grid} {$class}'>";
5
  $html .= '<div class="rt-holder">';
6
  if(!empty($imgSrc)) {
7
  $html .= '<div class="rt-img-holder">';
8
- $html .= '<div class="overlay">';
9
- $html .= "<a class='view-details' href='{$pLink}'>
 
10
  <i class='fa fa-info'></i>
11
  </a>";
12
- $html .= '</div>';
 
13
  $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
14
  $html .= '</div> ';
15
  }
@@ -50,7 +52,7 @@ $html .= "<div class='{$grid} {$class}'>";
50
 
51
 
52
  if(in_array('read_more', $items)){
53
- $postMetaBottom .= "<span class='read-more'><a href='{$pLink}'>".__("Read More ..",'the-post-grid')."</a></span>";
54
  }
55
  if(!empty($postMetaBottom)){
56
  $html .= "<div class='post-meta'>$postMetaBottom</div>";
5
  $html .= '<div class="rt-holder">';
6
  if(!empty($imgSrc)) {
7
  $html .= '<div class="rt-img-holder">';
8
+ if($overlay) {
9
+ $html .= '<div class="overlay">';
10
+ $html .= "<a class='view-details' href='{$pLink}'>
11
  <i class='fa fa-info'></i>
12
  </a>";
13
+ $html .= '</div>';
14
+ }
15
  $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
16
  $html .= '</div> ';
17
  }
52
 
53
 
54
  if(in_array('read_more', $items)){
55
+ $postMetaBottom .= "<span class='read-more'><a href='{$pLink}'>".__("Read More",'the-post-grid')."</a></span>";
56
  }
57
  if(!empty($postMetaBottom)){
58
  $html .= "<div class='post-meta'>$postMetaBottom</div>";
lib/views/layouts/layout2.php CHANGED
@@ -6,11 +6,13 @@ $html .= "<div class='{$grid} {$class}'>";
6
  if(!empty($imgSrc)) {
7
  $html .= "<div class='{$image_area}'>";
8
  $html .= '<div class="rt-img-holder">';
9
- $html .= '<div class="overlay">';
10
- $html .= "<div class='link-holder'>
 
11
  <a class='view-details' href='{$pLink}'><i class='fa fa-info'></i></a>
12
  </div>";
13
- $html .= '</div>';
 
14
  $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
15
  $html .= '</div>';
16
  $html .= '</div>';
@@ -47,7 +49,7 @@ $html .= "<div class='{$grid} {$class}'>";
47
  $html .= "<p>{$excerpt}</p>";
48
  }
49
  if(in_array('read_more', $items)){
50
- $html .= "<span class='read-more'><a href='{$pLink}'>".__("Read More ..","the-post-grid")."</a></span>";
51
  }
52
  $html .= '</div>';
53
  $html .= '</div>';
6
  if(!empty($imgSrc)) {
7
  $html .= "<div class='{$image_area}'>";
8
  $html .= '<div class="rt-img-holder">';
9
+ if($overlay) {
10
+ $html .= '<div class="overlay">';
11
+ $html .= "<div class='link-holder'>
12
  <a class='view-details' href='{$pLink}'><i class='fa fa-info'></i></a>
13
  </div>";
14
+ $html .= '</div>';
15
+ }
16
  $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
17
  $html .= '</div>';
18
  $html .= '</div>';
49
  $html .= "<p>{$excerpt}</p>";
50
  }
51
  if(in_array('read_more', $items)){
52
+ $html .= "<span class='read-more'><a href='{$pLink}'>".__("Read More","the-post-grid")."</a></span>";
53
  }
54
  $html .= '</div>';
55
  $html .= '</div>';
lib/views/layouts/layout3.php CHANGED
@@ -8,11 +8,13 @@ $html .= "<div class='{$grid} {$class}'>";
8
  if(!empty($imgSrc)) {
9
  $html .= "<div class='{$image_area}'>";
10
  $html .= '<div class="rt-img-holder">';
11
- $html .= '<div class="overlay">';
12
- $html .= "<div class='link-holder'>
 
13
  <a class='view-details' href='{$pLink}'><i class='fa fa-info'></i></a>
14
  </div>";
15
- $html .= '</div>';
 
16
  $html .= "<a href='{$pLink}'><img class='img-responsive rounded' src='{$imgSrc}' alt='{$title}'></a>";
17
  $html .= '</div>';
18
  $html .= '</div>';
@@ -21,6 +23,9 @@ $html .= "<div class='{$grid} {$class}'>";
21
  }
22
  $html .= "<div class='{$content_area}'>";
23
  $html .= '<div class="rt-detail">';
 
 
 
24
  $metaHtml = null;
25
  if(in_array('post_date', $items) && $date){
26
  $metaHtml .= "<span class='date-meta'><i class='fa fa-calendar'></i> {$date}</span>";
@@ -45,7 +50,7 @@ $html .= "<div class='{$grid} {$class}'>";
45
  $html .= "<div class='post-content'>{$excerpt}</div>";
46
  }
47
  if(in_array('read_more', $items)){
48
- $html .= "<span class='read-more'><a href='{$pLink}'>".__("Read More ..","the-post-grid")."</a></span>";
49
  }
50
  $html .= '</div>';
51
  $html .= '</div>';
8
  if(!empty($imgSrc)) {
9
  $html .= "<div class='{$image_area}'>";
10
  $html .= '<div class="rt-img-holder">';
11
+ if($overlay) {
12
+ $html .= '<div class="overlay">';
13
+ $html .= "<div class='link-holder'>
14
  <a class='view-details' href='{$pLink}'><i class='fa fa-info'></i></a>
15
  </div>";
16
+ $html .= '</div>';
17
+ }
18
  $html .= "<a href='{$pLink}'><img class='img-responsive rounded' src='{$imgSrc}' alt='{$title}'></a>";
19
  $html .= '</div>';
20
  $html .= '</div>';
23
  }
24
  $html .= "<div class='{$content_area}'>";
25
  $html .= '<div class="rt-detail">';
26
+ if(in_array('title', $items)){
27
+ $html .= "<h2 class='entry-title'><a href='{$pLink}'>{$title}</a></h2>";
28
+ }
29
  $metaHtml = null;
30
  if(in_array('post_date', $items) && $date){
31
  $metaHtml .= "<span class='date-meta'><i class='fa fa-calendar'></i> {$date}</span>";
50
  $html .= "<div class='post-content'>{$excerpt}</div>";
51
  }
52
  if(in_array('read_more', $items)){
53
+ $html .= "<span class='read-more'><a href='{$pLink}'>".__("Read More","the-post-grid")."</a></span>";
54
  }
55
  $html .= '</div>';
56
  $html .= '</div>';
lib/views/settings/settings.php CHANGED
@@ -3,58 +3,38 @@ global $rtTPG;
3
  ?>
4
 
5
  <div class="wrap">
6
- <div class="width50">
7
- <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br /></div>
8
- <h2><?php _e('The Post Grid Settings', 'the-post-grid'); ?></h2>
9
- <h3><?php _e('General settings', 'the-post-grid');?>
10
- <a style="margin-left: 15px; font-size: 15px;" href="http://demo.radiustheme.com/wordpress/plugins/the-post-grid/" target="_blank"><?php _e('Documentation', 'the-post-grid') ?></a>
11
- </h3>
 
 
12
 
13
- <div class="rt-setting-wrapper">
14
- <div class="rt-response"></div>
15
- <form id="rt-settings-form" onsubmit="rtTPGSettings(this); return false;">
16
- <div class="rt-setting-holder">
17
- <?php echo $rtTPG->rtFieldGenerator($rtTPG->rtTPGSettingFields(), true); ?>
18
- </div>
19
 
20
- <p class="submit"><input type="submit" name="submit" class="button button-primary rtSaveButton" value="Save Changes"></p>
 
21
 
22
- <?php wp_nonce_field( $rtTPG->nonceText(), $rtTPG->nonceId() ); ?>
23
- </form>
24
-
25
- <div class="rt-response"></div>
26
- </div>
27
- </div>
28
- <div class="width50">
29
- <div class="pro-features">
30
- <h3>PRO Version Features</h3>
31
- <ol>
32
- <li>Fully responsive and mobile friendly.</li>
33
- <li>48 Different Layouts</li>
34
- <li>Even and Masonry Grid.</li>
35
- <li>WooCommerce supported.</li>
36
- <li>Custom Post Type Supported</li>
37
- <li>Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)</li>
38
- <li>Order by Id, Title, Created date, Modified date and Menu order.</li>
39
- <li>Display image size (thumbnail, medium, large, full)</li>
40
- <li>Isotope filter for any taxonomy ie. categories, tags...</li>
41
- <li>Query Post with Relation.</li>
42
- <li>Fields Selection.</li>
43
- <li>All Text and Color control.</li>
44
- <li>Enable/Disable Pagination.</li>
45
- <li>AJAX Pagination (Load more and Load on Scrolling)</li>
46
- <li> and many more .......</li>
47
- </ol>
48
- <p><a href="https://www.radiustheme.com/the-post-grid-pro-for-wordpress/" class="button-link" target="_blank">Get Pro Version</a></p>
49
- </div>
50
- </div>
51
- <div class="rt-help">
52
- <p style="font-weight: bold"><?php _e('Short Code', 'the-post-grid' );?> :</p>
53
- <code>[the-post-grid id="581" title="Home page post List"]</code><br>
54
- <p><?php _e('id = short code id (1,2,3,4)', 'the-post-grid' );?></p>
55
- <p><?php _e('title = Shot code title (Not recommended)', 'the-post-grid' );?></p>
56
- <p class="rt-help-link"><a class="button-primary" href="http://demo.radiustheme.com/wordpress/plugins/the-post-grid/" target="_blank"><?php _e('Demo', 'the-post-grid' );?></a> <a class="button-primary" href="https://radiustheme.com/how-to-setup-configure-the-post-grid-free-version-for-wordpress/" target="_blank"><?php _e('Documentation', 'the-post-grid' );?></a> </p>
57
- </div>
58
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  </div>
3
  ?>
4
 
5
  <div class="wrap">
6
+ <div class="width50">
7
+ <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div>
8
+ <h2><?php _e( 'The Post Grid Settings', 'the-post-grid' ); ?></h2>
9
+ <h3><?php _e( 'General settings', 'the-post-grid' ); ?>
10
+ <a style="margin-left: 15px; font-size: 15px;"
11
+ href="http://demo.radiustheme.com/wordpress/plugins/the-post-grid/"
12
+ target="_blank"><?php _e( 'Documentation', 'the-post-grid' ) ?></a>
13
+ </h3>
14
 
15
+ <div class="rt-setting-wrapper">
16
+ <div class="rt-response"></div>
17
+ <form id="rt-settings-form" onsubmit="rtTPGSettings(this); return false;">
18
+ <div class="rt-setting-holder">
19
+ <?php echo $rtTPG->rtFieldGenerator( $rtTPG->rtTPGSettingFields(), true ); ?>
20
+ </div>
21
 
22
+ <p class="submit"><input type="submit" name="submit" class="button button-primary rtSaveButton"
23
+ value="Save Changes"></p>
24
 
25
+ <?php wp_nonce_field( $rtTPG->nonceText(), $rtTPG->nonceId() ); ?>
26
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ <div class="rt-response"></div>
29
+ </div>
30
+ </div>
31
+ <div class="width50">
32
+ <div class="pro-features">
33
+ <h3>PRO Version Features</h3>
34
+ <?php echo $rtTPG->get_pro_feature_list(); ?>
35
+ <p><a href="https://www.radiustheme.com/the-post-grid-pro-for-wordpress/" class="button-link"
36
+ target="_blank">Get Pro Version</a></p>
37
+ </div>
38
+ </div>
39
 
40
  </div>
the-post-grid.php CHANGED
@@ -1,15 +1,10 @@
1
  <?php
2
- /**
3
- * @package THE_POST_GRID
4
- * @version 1.4
5
- */
6
-
7
  /**
8
  * Plugin Name: The Post Grid
9
  * Plugin URI: http://demo.radiustheme.com/wordpress/plugins/the-post-grid/
10
  * Description: Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter by category, tag, author..) without a single line of coding.
11
  * Author: RadiusTheme
12
- * Version: 1.5
13
  * Text Domain: the-post-grid
14
  * Domain Path: /languages
15
  * Author URI: https://radiustheme.com/
1
  <?php
 
 
 
 
 
2
  /**
3
  * Plugin Name: The Post Grid
4
  * Plugin URI: http://demo.radiustheme.com/wordpress/plugins/the-post-grid/
5
  * Description: Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter by category, tag, author..) without a single line of coding.
6
  * Author: RadiusTheme
7
+ * Version: 1.6
8
  * Text Domain: the-post-grid
9
  * Domain Path: /languages
10
  * Author URI: https://radiustheme.com/