The Post Grid - Version 3.0.4

Version Description

  • Fixed file readability issue
  • Added option for script loading
  • Draft post issue in preview
Download this release

Release Info

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

Code changes from version 3.0.3 to 3.0.4

README.txt CHANGED
@@ -3,8 +3,8 @@ 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.5
6
- Tested up to: 5.8
7
- Stable tag: 3.0.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -141,6 +141,11 @@ For any bug or suggestion please mail support@radiustheme.com
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
144
  = 3.0.3 =
145
  * Fixed feature image not existing notice issue
146
 
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.5
6
+ Tested up to: 5.8.1
7
+ Stable tag: 3.0.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
141
 
142
  == Changelog ==
143
 
144
+ = 3.0.4 =
145
+ * Fixed file readability issue
146
+ * Added option for script loading
147
+ * Draft post issue in preview
148
+
149
  = 3.0.3 =
150
  * Fixed feature image not existing notice issue
151
 
assets/css/admin.css CHANGED
@@ -964,4 +964,67 @@ body .rt-admin-btn:hover {
964
  float: none;
965
  width: inherit;
966
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
967
  }
964
  float: none;
965
  width: inherit;
966
  }
967
+ }
968
+
969
+ /*The rttm-switch - the box around the rttm-switch-slider*/
970
+ .rttm-switch {
971
+ position: relative;
972
+ display: inline-block;
973
+ width: 50px;
974
+ height: 24px;
975
+ }
976
+
977
+ /* Hide default HTML checkbox */
978
+ .rttm-switch input {
979
+ opacity: 0;
980
+ width: 0;
981
+ height: 0;
982
+ }
983
+
984
+ /* The rttm-switch-slider */
985
+ .rttm-switch-slider {
986
+ position: absolute;
987
+ cursor: pointer;
988
+ top: 0;
989
+ left: 0;
990
+ right: 0;
991
+ bottom: 0;
992
+ background-color: #ccc;
993
+ -webkit-transition: .4s;
994
+ transition: .4s;
995
+ }
996
+
997
+ .rttm-switch-slider:before {
998
+ position: absolute;
999
+ content: "";
1000
+ height: 16px;
1001
+ width: 16px;
1002
+ left: 4px;
1003
+ bottom: 4px;
1004
+ background-color: white;
1005
+ -webkit-transition: .4s;
1006
+ transition: .4s;
1007
+ }
1008
+
1009
+ input:checked + .rttm-switch-slider {
1010
+ background-color: #5d3dfd;
1011
+ }
1012
+
1013
+ input:focus + .rttm-switch-slider {
1014
+ box-shadow: 0 0 1px #5d3dfd;
1015
+ }
1016
+
1017
+ input:checked + .rttm-switch-slider:before {
1018
+ -webkit-transform: translateX(26px);
1019
+ -ms-transform: translateX(26px);
1020
+ transform: translateX(26px);
1021
+ }
1022
+
1023
+ /* Rounded rttm-switch-sliders */
1024
+ .rttm-switch-slider.round {
1025
+ border-radius: 34px;
1026
+ }
1027
+
1028
+ .rttm-switch-slider.round:before {
1029
+ border-radius: 50%;
1030
  }
assets/css/thepostgrid.css CHANGED
@@ -678,70 +678,6 @@ span.more-loading {
678
  margin-right: 0px;
679
  }
680
 
681
- /* --------------------------
682
- Social share List View
683
- -----------------*/
684
- .rt-tpg-social-share {
685
- display: inline-block;
686
- margin: 0px 0;
687
- float: left;
688
- font-weight: bold;
689
- }
690
-
691
- .rt-tpg-social-share:after {
692
- display: block;
693
- clear: both;
694
- content: '';
695
- }
696
-
697
- .rt-tpg-social-share a {
698
- display: inline-block;
699
- padding: 3px 6px;
700
- margin-right: 0px;
701
- outline: none;
702
- }
703
-
704
- .rt-tpg-social-share a i {
705
- font-size: 16px;
706
- outline: none;
707
- }
708
-
709
- .rt-tpg-social-share a.facebook i {
710
- color: #3b5998 !important;
711
- }
712
-
713
- .rt-tpg-social-share a.facebook:hover i {
714
- color: #456dc2 !important;
715
- }
716
-
717
- .rt-tpg-social-share a.twitter i {
718
- color: #00aced !important;
719
- }
720
-
721
- .rt-tpg-social-share a.twitter:hover i {
722
- color: #1ab8f5 !important;
723
- }
724
-
725
- .rt-tpg-social-share a.linkedin i {
726
- color: #007bb6 !important;
727
- }
728
-
729
- .rt-tpg-social-share a.linkedin:hover i {
730
- color: #289bd3 !important;
731
- }
732
-
733
- .rt-tpg-social-share a.pinterest i {
734
- color: #cb2027 !important;
735
- }
736
-
737
- .rt-tpg-social-share a.reddit i {
738
- color: rgb(255, 69, 0) !important;
739
- }
740
-
741
- .rt-tpg-social-share a.email i {
742
- color: rgb(1, 102, 255) !important;
743
- }
744
-
745
  /* loader */
746
 
747
  .rt-tpg-container .tpg-pre-loader {
@@ -2052,4 +1988,22 @@ body > .rt-tooltip .rt-tooltip-bottom:after {
2052
  -o-transform: rotate(360deg);
2053
  transform: rotate(360deg);
2054
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2055
  }
678
  margin-right: 0px;
679
  }
680
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  /* loader */
682
 
683
  .rt-tpg-container .tpg-pre-loader {
1988
  -o-transform: rotate(360deg);
1989
  transform: rotate(360deg);
1990
  }
1991
+ }
1992
+ .rt-container-fluid {
1993
+ position: relative;
1994
+ }
1995
+ #bottom-script-loader {
1996
+ position: absolute;
1997
+ width: 100%;
1998
+ height: 100%;
1999
+ z-index: 99999;
2000
+ background: rgba(255,255,255,0.8);
2001
+ }
2002
+ #bottom-script-loader .rt-ball-clip-rotate {
2003
+ color: #fb4c35;
2004
+ position: absolute;
2005
+ top: 80px;
2006
+ left: 50%;
2007
+ margin-left: -16px;
2008
+ z-index: 2;
2009
  }
assets/js/admin.js CHANGED
@@ -132,14 +132,14 @@
132
  $(document).ready(function () {
133
  checkCustomFieldSettings();
134
  rtTgpFilter();
 
 
 
135
  tlpShowHideScMeta();
136
  checkCustomField();
137
  if ($('.rt-color').length) {
138
  $('.rt-color').wpColorPicker();
139
  }
140
- if ($(".rt-select2").length) {
141
- tgpLiveReloadScript();
142
- }
143
  if ($(".date-range").length) {
144
  $(".date-range-start").datepicker({
145
  defaultDate: "+1w",
@@ -204,6 +204,7 @@
204
 
205
  detailLinkEffect();
206
  customImageSize();
 
207
  featureImageEffect();
208
  tpgOrderByEffect();
209
  $("#link_to_detail_page_holder").on("click", "input[type='radio']", function () {
@@ -227,6 +228,19 @@
227
  customImageSize();
228
  });
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  function customImageSize() {
231
  /* custom image size jquery */
232
  var fImageSize = $("#featured_image_size").val();
132
  $(document).ready(function () {
133
  checkCustomFieldSettings();
134
  rtTgpFilter();
135
+ if ($(".rt-select2").length) {
136
+ tgpLiveReloadScript();
137
+ }
138
  tlpShowHideScMeta();
139
  checkCustomField();
140
  if ($('.rt-color').length) {
141
  $('.rt-color').wpColorPicker();
142
  }
 
 
 
143
  if ($(".date-range").length) {
144
  $(".date-range-start").datepicker({
145
  defaultDate: "+1w",
204
 
205
  detailLinkEffect();
206
  customImageSize();
207
+ preLoaderEffect();
208
  featureImageEffect();
209
  tpgOrderByEffect();
210
  $("#link_to_detail_page_holder").on("click", "input[type='radio']", function () {
228
  customImageSize();
229
  });
230
 
231
+ $("#tpg_load_script").on('change', function () {
232
+ preLoaderEffect();
233
+ });
234
+
235
+ function preLoaderEffect() {
236
+ var preLoader = $("#tpg_load_script_holder input[name='tpg_load_script']:checked").val();
237
+ if (preLoader) {
238
+ $("#tpg_enable_preloader_holder").show();
239
+ } else {
240
+ $("#tpg_enable_preloader_holder").hide();
241
+ }
242
+ }
243
+
244
  function customImageSize() {
245
  /* custom image size jquery */
246
  var fImageSize = $("#featured_image_size").val();
assets/js/rttpg.js CHANGED
@@ -99,10 +99,18 @@
99
  initTpg();
100
 
101
  $(window).on('load resize', function () {
 
102
  HeightResize();
103
  overlayIconResizeTpg();
104
  });
105
 
 
 
 
 
 
 
 
106
  function windowHashChange(isotope, IsoButton) {
107
  var $hashFilter = decodeHash() || '';
108
  if (!$hashFilter) {
99
  initTpg();
100
 
101
  $(window).on('load resize', function () {
102
+ tpgBottomScriptLoader();
103
  HeightResize();
104
  overlayIconResizeTpg();
105
  });
106
 
107
+ function tpgBottomScriptLoader() {
108
+ $( "#bottom-script-loader" ).fadeOut(500, function() {
109
+ // fadeOut complete. Remove the loading div
110
+ $( "#bottom-script-loader" ).remove(); //makes page more lightweight
111
+ });
112
+ }
113
+
114
  function windowHashChange(isotope, IsoButton) {
115
  var $hashFilter = decodeHash() || '';
116
  if (!$hashFilter) {
languages/the-post-grid.pot CHANGED
@@ -29,7 +29,7 @@ msgstr ""
29
  msgid "Server Error !!"
30
  msgstr ""
31
 
32
- #: ../lib/classes/rtTPGAjaxResponse.php:71, ../lib/classes/rtTPGAjaxResponse.php:98, ../lib/classes/rtTPGPreview.php:940
33
  msgid "Session Error !!"
34
  msgstr ""
35
 
@@ -37,7 +37,7 @@ msgstr ""
37
  msgid "Success"
38
  msgstr ""
39
 
40
- #: ../lib/classes/rtTPGAjaxResponse.php:62, ../lib/classes/rtTPGOptions.php:352
41
  msgid "Show All"
42
  msgstr ""
43
 
@@ -61,51 +61,59 @@ msgstr ""
61
  msgid "Select Short code"
62
  msgstr ""
63
 
64
- #: ../lib/classes/rtTPGAjaxResponse.php:206, ../lib/classes/rtTPGOptions.php:793, ../lib/classes/rtTPGOptions.php:805
65
  msgid "Default"
66
  msgstr ""
67
 
68
- #: ../lib/classes/rtTPGInit.php:59, ../lib/classes/rtTPGInit.php:60, ../lib/vendor/RtElementorWidget.php:10, ../lib/vendor/RtElementorWidget.php:25, ../lib/widgets/RT_TPGWidget.php:14
 
 
 
 
 
 
 
 
69
  msgid "The Post Grid"
70
  msgstr ""
71
 
72
- #: ../lib/classes/rtTPGInit.php:61
73
  msgid "Add New Grid"
74
  msgstr ""
75
 
76
- #: ../lib/classes/rtTPGInit.php:62
77
  msgid "All Grids"
78
  msgstr ""
79
 
80
- #: ../lib/classes/rtTPGInit.php:63
81
  msgid "Add New Post Grid"
82
  msgstr ""
83
 
84
- #: ../lib/classes/rtTPGInit.php:64
85
  msgid "Edit Post Grid"
86
  msgstr ""
87
 
88
- #: ../lib/classes/rtTPGInit.php:65
89
  msgid "New Post Grid"
90
  msgstr ""
91
 
92
- #: ../lib/classes/rtTPGInit.php:66
93
  msgid "View Post Grid"
94
  msgstr ""
95
 
96
- #: ../lib/classes/rtTPGInit.php:67
97
  msgid "Search Post Grids"
98
  msgstr ""
99
 
100
- #: ../lib/classes/rtTPGInit.php:68
101
  msgid "No Post Grids found"
102
  msgstr ""
103
 
104
- #: ../lib/classes/rtTPGInit.php:69
105
  msgid "No Post Grids found in Trash"
106
  msgstr ""
107
 
108
- #: ../lib/classes/rtTPGInit.php:158
109
  msgid "Settings"
110
  msgstr ""
111
 
@@ -181,7 +189,7 @@ msgstr ""
181
  msgid "OR — show posts which match one or more settings"
182
  msgstr ""
183
 
184
- #: ../lib/classes/rtTPGOptions.php:50, ../lib/classes/rtTPGPreview.php:657, ../lib/classes/rtTPGShortCode.php:695
185
  msgid "Meta value"
186
  msgstr ""
187
 
@@ -229,223 +237,243 @@ msgstr ""
229
  msgid "After Loaded script"
230
  msgstr ""
231
 
232
- #: ../lib/classes/rtTPGOptions.php:167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  msgid "Deactivate License"
234
  msgstr ""
235
 
236
- #: ../lib/classes/rtTPGOptions.php:168
237
  msgid "Activate License"
238
  msgstr ""
239
 
240
- #: ../lib/classes/rtTPGOptions.php:176
241
  msgid "Enter your license key"
242
  msgstr ""
243
 
244
- #: ../lib/classes/rtTPGOptions.php:382, ../lib/classes/rtTPGOptions.php:388, ../lib/classes/rtTPGPreview.php:69, ../lib/classes/rtTPGShortCode.php:139
245
  msgid "Show all"
246
  msgstr ""
247
 
248
- #: ../lib/classes/rtTPGOptions.php:387
249
  msgid "Show all text"
250
  msgstr ""
251
 
252
- #: ../lib/classes/rtTPGOptions.php:434
253
  msgid "Speed"
254
  msgstr ""
255
 
256
- #: ../lib/classes/rtTPGOptions.php:438
257
  msgid "Auto play Speed in milliseconds"
258
  msgstr ""
259
 
260
- #: ../lib/classes/rtTPGOptions.php:441
261
  msgid "Autoplay timeout"
262
  msgstr ""
263
 
264
- #: ../lib/classes/rtTPGOptions.php:445
265
  msgid "Autoplay interval timeout"
266
  msgstr ""
267
 
268
- #: ../lib/classes/rtTPGOptions.php:449
269
  msgid "Image column"
270
  msgstr ""
271
 
272
- #: ../lib/classes/rtTPGOptions.php:458
273
  msgid "Desktop"
274
  msgstr ""
275
 
276
- #: ../lib/classes/rtTPGOptions.php:467
277
  msgid "Tab"
278
  msgstr ""
279
 
280
- #: ../lib/classes/rtTPGOptions.php:476
281
  msgid "Mobile"
282
  msgstr ""
283
 
284
- #: ../lib/classes/rtTPGOptions.php:545
285
  msgid "Image Type"
286
  msgstr ""
287
 
288
- #: ../lib/classes/rtTPGOptions.php:553
289
  msgid "Title limit"
290
  msgstr ""
291
 
292
- #: ../lib/classes/rtTPGOptions.php:554
293
  msgid "Title limit only integer number is allowed, Leave it blank for full title."
294
  msgstr ""
295
 
296
- #: ../lib/classes/rtTPGOptions.php:558
297
  msgid "Title limit type"
298
  msgstr ""
299
 
300
- #: ../lib/classes/rtTPGOptions.php:565
301
  msgid "Excerpt limit"
302
  msgstr ""
303
 
304
- #: ../lib/classes/rtTPGOptions.php:566
305
  msgid "Excerpt limit only integer number is allowed, Leave it blank for full excerpt."
306
  msgstr ""
307
 
308
- #: ../lib/classes/rtTPGOptions.php:570
309
  msgid "Excerpt Type"
310
  msgstr ""
311
 
312
- #: ../lib/classes/rtTPGOptions.php:586
313
  msgid "Title tag"
314
  msgstr ""
315
 
316
- #: ../lib/classes/rtTPGOptions.php:786
317
  msgid "Read more button border radius"
318
  msgstr ""
319
 
320
- #: ../lib/classes/rtTPGOptions.php:787
321
  msgid "Leave it blank for default"
322
  msgstr ""
323
 
324
- #: ../lib/classes/rtTPGOptions.php:792
325
  msgid "Read more button alignment"
326
  msgstr ""
327
 
328
- #: ../lib/classes/rtTPGOptions.php:795
329
  msgid "Left"
330
  msgstr ""
331
 
332
- #: ../lib/classes/rtTPGOptions.php:796
333
  msgid "Right"
334
  msgstr ""
335
 
336
- #: ../lib/classes/rtTPGOptions.php:797
337
  msgid "Center"
338
  msgstr ""
339
 
340
- #: ../lib/classes/rtTPGOptions.php:802
341
  msgid "Title Position (Above or Below image)"
342
  msgstr ""
343
 
344
- #: ../lib/classes/rtTPGOptions.php:807
345
  msgid "Above image"
346
  msgstr ""
347
 
348
- #: ../lib/classes/rtTPGOptions.php:808
349
  msgid "Below image"
350
  msgstr ""
351
 
352
- #: ../lib/classes/rtTPGOptions.php:810
353
  msgid "<span style='color:red'>Only Layout 1, Layout 12, Layout 14, Isotope1, Isotope8, Isotope10, Carousel Layout 1, Carousel Layout 8, Carousel Layout 10</span>"
354
  msgstr ""
355
 
356
- #: ../lib/classes/rtTPGOptions.php:893
357
  msgid "Character"
358
  msgstr ""
359
 
360
- #: ../lib/classes/rtTPGOptions.php:894
361
  msgid "Word"
362
  msgstr ""
363
 
364
- #: ../lib/classes/rtTPGOptions.php:897
365
  msgid "Full Content"
366
  msgstr ""
367
 
368
- #: ../lib/classes/rtTPGOptions.php:916
369
  msgid "Taxonomy filter"
370
  msgstr ""
371
 
372
- #: ../lib/classes/rtTPGOptions.php:917
373
  msgid "Author filter"
374
  msgstr ""
375
 
376
- #: ../lib/classes/rtTPGOptions.php:918
377
  msgid "Order - Sort retrieved posts by parameter"
378
  msgstr ""
379
 
380
- #: ../lib/classes/rtTPGOptions.php:919
381
  msgid "Sort Order - Designates the ascending or descending order of the \"orderby\" parameter"
382
  msgstr ""
383
 
384
- #: ../lib/classes/rtTPGOptions.php:920
385
  msgid "Search filter"
386
  msgstr ""
387
 
388
- #: ../lib/classes/rtTPGOptions.php:940
389
  msgid "Layout 1"
390
  msgstr ""
391
 
392
- #: ../lib/classes/rtTPGOptions.php:941
393
  msgid "Layout 2"
394
  msgstr ""
395
 
396
- #: ../lib/classes/rtTPGOptions.php:942
397
  msgid "Layout 3"
398
  msgstr ""
399
 
400
- #: ../lib/classes/rtTPGOptions.php:943
401
  msgid "Isotope Layout"
402
  msgstr ""
403
 
404
- #: ../lib/classes/rtTPGOptions.php:1068
405
  msgid "Get Pro Version"
406
  msgstr ""
407
 
408
- #: ../lib/classes/rtTPGPreview.php:67, ../lib/classes/rtTPGShortCode.php:137
409
  msgid "Read More"
410
  msgstr ""
411
 
412
- #: ../lib/classes/rtTPGPreview.php:421, ../lib/classes/rtTPGShortCode.php:462
413
  msgid "All"
414
  msgstr ""
415
 
416
- #: ../lib/classes/rtTPGPreview.php:655, ../lib/classes/rtTPGPreview.php:662, ../lib/classes/rtTPGShortCode.php:693, ../lib/classes/rtTPGShortCode.php:700
417
  msgid "Sort By None"
418
  msgstr ""
419
 
420
- #: ../lib/classes/rtTPGPreview.php:680, ../lib/classes/rtTPGShortCode.php:718
421
  msgid "Search..."
422
  msgstr ""
423
 
424
- #: ../lib/classes/rtTPGPreview.php:688, ../lib/classes/rtTPGShortCode.php:726
425
  msgid "Loading ..."
426
  msgstr ""
427
 
428
- #: ../lib/classes/rtTPGPreview.php:869, ../lib/classes/rtTPGShortCode.php:898
429
  msgid "No post found"
430
  msgstr ""
431
 
432
- #: ../lib/classes/rtTPGPreview.php:772, ../lib/classes/rtTPGShortCode.php:807
433
  msgid "Search"
434
  msgstr ""
435
 
436
- #: ../lib/classes/rtTPGPreview.php:903, ../lib/classes/rtTPGPreview.php:898, ../lib/classes/rtTPGShortCode.php:924
437
  msgid "Load More"
438
  msgstr ""
439
 
440
- #: ../lib/classes/rtTPGShortCode.php:962
441
  msgid "No shortCode found"
442
  msgstr ""
443
 
444
- #: ../lib/classes/rtTPGShortCode.php:982
445
  msgid "This is a restricted content, you need to logged in to view this content."
446
  msgstr ""
447
 
448
- #: ../lib/classes/rtTPGShortCode.php:976
449
  msgid "You are not permitted to view this content."
450
  msgstr ""
451
 
@@ -453,11 +481,11 @@ msgstr ""
453
  msgid "Premium Option"
454
  msgstr ""
455
 
456
- #: ../lib/models/rtTPGField.php:355
457
  msgid "Start"
458
  msgstr ""
459
 
460
- #: ../lib/models/rtTPGField.php:364
461
  msgid "End"
462
  msgstr ""
463
 
29
  msgid "Server Error !!"
30
  msgstr ""
31
 
32
+ #: ../lib/classes/rtTPGAjaxResponse.php:71, ../lib/classes/rtTPGAjaxResponse.php:98, ../lib/classes/rtTPGPreview.php:939
33
  msgid "Session Error !!"
34
  msgstr ""
35
 
37
  msgid "Success"
38
  msgstr ""
39
 
40
+ #: ../lib/classes/rtTPGAjaxResponse.php:62, ../lib/classes/rtTPGOptions.php:373
41
  msgid "Show All"
42
  msgstr ""
43
 
61
  msgid "Select Short code"
62
  msgstr ""
63
 
64
+ #: ../lib/classes/rtTPGAjaxResponse.php:206, ../lib/classes/rtTPGOptions.php:814, ../lib/classes/rtTPGOptions.php:826
65
  msgid "Default"
66
  msgstr ""
67
 
68
+ #: ../lib/classes/rtTPGHook.php:35
69
+ msgid "Facing issue?"
70
+ msgstr ""
71
+
72
+ #: ../lib/classes/rtTPGHook.php:35
73
+ msgid "Please open a support ticket."
74
+ msgstr ""
75
+
76
+ #: ../lib/classes/rtTPGInit.php:69, ../lib/classes/rtTPGInit.php:70, ../lib/vendor/RtElementorWidget.php:10, ../lib/vendor/RtElementorWidget.php:25, ../lib/widgets/RT_TPGWidget.php:14
77
  msgid "The Post Grid"
78
  msgstr ""
79
 
80
+ #: ../lib/classes/rtTPGInit.php:71
81
  msgid "Add New Grid"
82
  msgstr ""
83
 
84
+ #: ../lib/classes/rtTPGInit.php:72
85
  msgid "All Grids"
86
  msgstr ""
87
 
88
+ #: ../lib/classes/rtTPGInit.php:73
89
  msgid "Add New Post Grid"
90
  msgstr ""
91
 
92
+ #: ../lib/classes/rtTPGInit.php:74
93
  msgid "Edit Post Grid"
94
  msgstr ""
95
 
96
+ #: ../lib/classes/rtTPGInit.php:75
97
  msgid "New Post Grid"
98
  msgstr ""
99
 
100
+ #: ../lib/classes/rtTPGInit.php:76
101
  msgid "View Post Grid"
102
  msgstr ""
103
 
104
+ #: ../lib/classes/rtTPGInit.php:77
105
  msgid "Search Post Grids"
106
  msgstr ""
107
 
108
+ #: ../lib/classes/rtTPGInit.php:78
109
  msgid "No Post Grids found"
110
  msgstr ""
111
 
112
+ #: ../lib/classes/rtTPGInit.php:79
113
  msgid "No Post Grids found in Trash"
114
  msgstr ""
115
 
116
+ #: ../lib/classes/rtTPGInit.php:168
117
  msgid "Settings"
118
  msgstr ""
119
 
189
  msgid "OR — show posts which match one or more settings"
190
  msgstr ""
191
 
192
+ #: ../lib/classes/rtTPGOptions.php:50, ../lib/classes/rtTPGPreview.php:656, ../lib/classes/rtTPGShortCode.php:708
193
  msgid "Meta value"
194
  msgstr ""
195
 
237
  msgid "After Loaded script"
238
  msgstr ""
239
 
240
+ #: ../lib/classes/rtTPGOptions.php:111
241
+ msgid "Load Script only ShortCode page"
242
+ msgstr ""
243
+
244
+ #: ../lib/classes/rtTPGOptions.php:112
245
+ msgid "If you enable this, script will be loaded only ShortCode page."
246
+ msgstr ""
247
+
248
+ #: ../lib/classes/rtTPGOptions.php:118
249
+ msgid "Enable Pre-loader"
250
+ msgstr ""
251
+
252
+ #: ../lib/classes/rtTPGOptions.php:125
253
+ msgid "Disable Font Awesome Script"
254
+ msgstr ""
255
+
256
+ #: ../lib/classes/rtTPGOptions.php:126
257
+ msgid "If Font Awesome 5 exist with theme, don't need to load twice."
258
+ msgstr ""
259
+
260
+ #: ../lib/classes/rtTPGOptions.php:188
261
  msgid "Deactivate License"
262
  msgstr ""
263
 
264
+ #: ../lib/classes/rtTPGOptions.php:189
265
  msgid "Activate License"
266
  msgstr ""
267
 
268
+ #: ../lib/classes/rtTPGOptions.php:197
269
  msgid "Enter your license key"
270
  msgstr ""
271
 
272
+ #: ../lib/classes/rtTPGOptions.php:403, ../lib/classes/rtTPGOptions.php:409, ../lib/classes/rtTPGPreview.php:69, ../lib/classes/rtTPGShortCode.php:150
273
  msgid "Show all"
274
  msgstr ""
275
 
276
+ #: ../lib/classes/rtTPGOptions.php:408
277
  msgid "Show all text"
278
  msgstr ""
279
 
280
+ #: ../lib/classes/rtTPGOptions.php:455
281
  msgid "Speed"
282
  msgstr ""
283
 
284
+ #: ../lib/classes/rtTPGOptions.php:459
285
  msgid "Auto play Speed in milliseconds"
286
  msgstr ""
287
 
288
+ #: ../lib/classes/rtTPGOptions.php:462
289
  msgid "Autoplay timeout"
290
  msgstr ""
291
 
292
+ #: ../lib/classes/rtTPGOptions.php:466
293
  msgid "Autoplay interval timeout"
294
  msgstr ""
295
 
296
+ #: ../lib/classes/rtTPGOptions.php:470
297
  msgid "Image column"
298
  msgstr ""
299
 
300
+ #: ../lib/classes/rtTPGOptions.php:479
301
  msgid "Desktop"
302
  msgstr ""
303
 
304
+ #: ../lib/classes/rtTPGOptions.php:488
305
  msgid "Tab"
306
  msgstr ""
307
 
308
+ #: ../lib/classes/rtTPGOptions.php:497
309
  msgid "Mobile"
310
  msgstr ""
311
 
312
+ #: ../lib/classes/rtTPGOptions.php:566
313
  msgid "Image Type"
314
  msgstr ""
315
 
316
+ #: ../lib/classes/rtTPGOptions.php:574
317
  msgid "Title limit"
318
  msgstr ""
319
 
320
+ #: ../lib/classes/rtTPGOptions.php:575
321
  msgid "Title limit only integer number is allowed, Leave it blank for full title."
322
  msgstr ""
323
 
324
+ #: ../lib/classes/rtTPGOptions.php:579
325
  msgid "Title limit type"
326
  msgstr ""
327
 
328
+ #: ../lib/classes/rtTPGOptions.php:586
329
  msgid "Excerpt limit"
330
  msgstr ""
331
 
332
+ #: ../lib/classes/rtTPGOptions.php:587
333
  msgid "Excerpt limit only integer number is allowed, Leave it blank for full excerpt."
334
  msgstr ""
335
 
336
+ #: ../lib/classes/rtTPGOptions.php:591
337
  msgid "Excerpt Type"
338
  msgstr ""
339
 
340
+ #: ../lib/classes/rtTPGOptions.php:607
341
  msgid "Title tag"
342
  msgstr ""
343
 
344
+ #: ../lib/classes/rtTPGOptions.php:807
345
  msgid "Read more button border radius"
346
  msgstr ""
347
 
348
+ #: ../lib/classes/rtTPGOptions.php:808
349
  msgid "Leave it blank for default"
350
  msgstr ""
351
 
352
+ #: ../lib/classes/rtTPGOptions.php:813
353
  msgid "Read more button alignment"
354
  msgstr ""
355
 
356
+ #: ../lib/classes/rtTPGOptions.php:816
357
  msgid "Left"
358
  msgstr ""
359
 
360
+ #: ../lib/classes/rtTPGOptions.php:817
361
  msgid "Right"
362
  msgstr ""
363
 
364
+ #: ../lib/classes/rtTPGOptions.php:818
365
  msgid "Center"
366
  msgstr ""
367
 
368
+ #: ../lib/classes/rtTPGOptions.php:823
369
  msgid "Title Position (Above or Below image)"
370
  msgstr ""
371
 
372
+ #: ../lib/classes/rtTPGOptions.php:828
373
  msgid "Above image"
374
  msgstr ""
375
 
376
+ #: ../lib/classes/rtTPGOptions.php:829
377
  msgid "Below image"
378
  msgstr ""
379
 
380
+ #: ../lib/classes/rtTPGOptions.php:831
381
  msgid "<span style='color:red'>Only Layout 1, Layout 12, Layout 14, Isotope1, Isotope8, Isotope10, Carousel Layout 1, Carousel Layout 8, Carousel Layout 10</span>"
382
  msgstr ""
383
 
384
+ #: ../lib/classes/rtTPGOptions.php:914
385
  msgid "Character"
386
  msgstr ""
387
 
388
+ #: ../lib/classes/rtTPGOptions.php:915
389
  msgid "Word"
390
  msgstr ""
391
 
392
+ #: ../lib/classes/rtTPGOptions.php:918
393
  msgid "Full Content"
394
  msgstr ""
395
 
396
+ #: ../lib/classes/rtTPGOptions.php:937
397
  msgid "Taxonomy filter"
398
  msgstr ""
399
 
400
+ #: ../lib/classes/rtTPGOptions.php:938
401
  msgid "Author filter"
402
  msgstr ""
403
 
404
+ #: ../lib/classes/rtTPGOptions.php:939
405
  msgid "Order - Sort retrieved posts by parameter"
406
  msgstr ""
407
 
408
+ #: ../lib/classes/rtTPGOptions.php:940
409
  msgid "Sort Order - Designates the ascending or descending order of the \"orderby\" parameter"
410
  msgstr ""
411
 
412
+ #: ../lib/classes/rtTPGOptions.php:941
413
  msgid "Search filter"
414
  msgstr ""
415
 
416
+ #: ../lib/classes/rtTPGOptions.php:961
417
  msgid "Layout 1"
418
  msgstr ""
419
 
420
+ #: ../lib/classes/rtTPGOptions.php:962
421
  msgid "Layout 2"
422
  msgstr ""
423
 
424
+ #: ../lib/classes/rtTPGOptions.php:963
425
  msgid "Layout 3"
426
  msgstr ""
427
 
428
+ #: ../lib/classes/rtTPGOptions.php:964
429
  msgid "Isotope Layout"
430
  msgstr ""
431
 
432
+ #: ../lib/classes/rtTPGOptions.php:1089
433
  msgid "Get Pro Version"
434
  msgstr ""
435
 
436
+ #: ../lib/classes/rtTPGPreview.php:67, ../lib/classes/rtTPGShortCode.php:148
437
  msgid "Read More"
438
  msgstr ""
439
 
440
+ #: ../lib/classes/rtTPGPreview.php:420, ../lib/classes/rtTPGShortCode.php:475
441
  msgid "All"
442
  msgstr ""
443
 
444
+ #: ../lib/classes/rtTPGPreview.php:654, ../lib/classes/rtTPGPreview.php:661, ../lib/classes/rtTPGShortCode.php:706, ../lib/classes/rtTPGShortCode.php:713
445
  msgid "Sort By None"
446
  msgstr ""
447
 
448
+ #: ../lib/classes/rtTPGPreview.php:679, ../lib/classes/rtTPGShortCode.php:731
449
  msgid "Search..."
450
  msgstr ""
451
 
452
+ #: ../lib/classes/rtTPGPreview.php:687, ../lib/classes/rtTPGShortCode.php:739
453
  msgid "Loading ..."
454
  msgstr ""
455
 
456
+ #: ../lib/classes/rtTPGPreview.php:868, ../lib/classes/rtTPGShortCode.php:911
457
  msgid "No post found"
458
  msgstr ""
459
 
460
+ #: ../lib/classes/rtTPGPreview.php:771, ../lib/classes/rtTPGShortCode.php:820
461
  msgid "Search"
462
  msgstr ""
463
 
464
+ #: ../lib/classes/rtTPGPreview.php:902, ../lib/classes/rtTPGPreview.php:897, ../lib/classes/rtTPGShortCode.php:937
465
  msgid "Load More"
466
  msgstr ""
467
 
468
+ #: ../lib/classes/rtTPGShortCode.php:975
469
  msgid "No shortCode found"
470
  msgstr ""
471
 
472
+ #: ../lib/classes/rtTPGShortCode.php:995
473
  msgid "This is a restricted content, you need to logged in to view this content."
474
  msgstr ""
475
 
476
+ #: ../lib/classes/rtTPGShortCode.php:989
477
  msgid "You are not permitted to view this content."
478
  msgstr ""
479
 
481
  msgid "Premium Option"
482
  msgstr ""
483
 
484
+ #: ../lib/models/rtTPGField.php:367
485
  msgid "Start"
486
  msgstr ""
487
 
488
+ #: ../lib/models/rtTPGField.php:376
489
  msgid "End"
490
  msgstr ""
491
 
lib/classes/rtTPGFrontEnd.php CHANGED
@@ -8,11 +8,13 @@ if (!class_exists('rtTPGFrontEnd')):
8
  }
9
 
10
  function rt_tpg_enqueue_styles() {
11
- wp_enqueue_style('rt-tpg');
12
  $settings = get_option(rtTPG()->options['settings']);
13
- $css = isset($settings['custom_css']) ? stripslashes($settings['custom_css']) : null;
14
- if ($css) {
15
- wp_add_inline_style('rt-tpg', $css);
 
 
 
16
  }
17
  $scriptBefore = isset($settings['script_before_item_load']) ? stripslashes($settings['script_before_item_load']) : null;
18
  $scriptAfter = isset($settings['script_after_item_load']) ? stripslashes($settings['script_after_item_load']) : null;
8
  }
9
 
10
  function rt_tpg_enqueue_styles() {
 
11
  $settings = get_option(rtTPG()->options['settings']);
12
+ if (!isset($settings['tpg_load_script'])) {
13
+ wp_enqueue_style('rt-tpg');
14
+ $css = isset($settings['custom_css']) ? stripslashes($settings['custom_css']) : null;
15
+ if ($css) {
16
+ wp_add_inline_style('rt-tpg', $css);
17
+ }
18
  }
19
  $scriptBefore = isset($settings['script_before_item_load']) ? stripslashes($settings['script_before_item_load']) : null;
20
  $scriptAfter = isset($settings['script_after_item_load']) ? stripslashes($settings['script_after_item_load']) : null;
lib/classes/rtTPGHelper.php CHANGED
@@ -508,19 +508,23 @@ if (!class_exists('rtTPGHelper')):
508
  $matches)
509
  ) {
510
  $imgSrc = $matches[1][0];
511
- // Open image as a string
512
- $data = file_get_contents($imgSrc);
513
- // getimagesizefromstring function accepts image data as string
514
- $info = getimagesizefromstring($data);
515
- // Get Image dimension
516
- $size = $info[3];
 
 
517
 
518
  $image = "<img class='{$img_class}' src='{$imgSrc}' {$size} alt='{$alt}'>";
519
  }
520
  }
 
521
  if (!$imgSrc && $defaultImgId) {
522
  $image = wp_get_attachment_image($defaultImgId, $fImgSize);
523
  }
 
524
  if ($imgSrc && $cSize) {
525
  $w = (!empty($customImgSize[0]) ? absint($customImgSize[0]) : null);
526
  $h = (!empty($customImgSize[1]) ? absint($customImgSize[1]) : null);
508
  $matches)
509
  ) {
510
  $imgSrc = $matches[1][0];
511
+ $size = '';
512
+
513
+ $imgAbs = str_replace(trailingslashit(site_url()),ABSPATH, $imgSrc);
514
+
515
+ if (file_exists($imgAbs)) {
516
+ $info = getimagesize($imgAbs);
517
+ $size = isset($info[3]) ? $info[3] : '';
518
+ }
519
 
520
  $image = "<img class='{$img_class}' src='{$imgSrc}' {$size} alt='{$alt}'>";
521
  }
522
  }
523
+
524
  if (!$imgSrc && $defaultImgId) {
525
  $image = wp_get_attachment_image($defaultImgId, $fImgSize);
526
  }
527
+
528
  if ($imgSrc && $cSize) {
529
  $w = (!empty($customImgSize[0]) ? absint($customImgSize[0]) : null);
530
  $h = (!empty($customImgSize[1]) ? absint($customImgSize[1]) : null);
lib/classes/rtTPGHook.php CHANGED
@@ -5,7 +5,7 @@ if (!class_exists('rtTPGHook')):
5
  function __construct() {
6
  add_filter('tpg_author_arg', array(__CLASS__, 'filter_author_args'), 10);
7
  add_action('pre_get_posts', array(__CLASS__, 'category_query'), 10);
8
-
9
  }
10
 
11
  static function category_query($query) {
@@ -23,13 +23,21 @@ if (!class_exists('rtTPGHook')):
23
  }
24
  }
25
 
26
-
27
  static function filter_author_args($args) {
28
  $defaults = array('role__in' => array('administrator', 'editor', 'author'));
29
 
30
  return wp_parse_args($args, $defaults);
31
  }
32
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  endif;
5
  function __construct() {
6
  add_filter('tpg_author_arg', array(__CLASS__, 'filter_author_args'), 10);
7
  add_action('pre_get_posts', array(__CLASS__, 'category_query'), 10);
8
+ add_filter('plugin_row_meta', array(__CLASS__, 'plugin_row_meta'), 10, 2);
9
  }
10
 
11
  static function category_query($query) {
23
  }
24
  }
25
 
 
26
  static function filter_author_args($args) {
27
  $defaults = array('role__in' => array('administrator', 'editor', 'author'));
28
 
29
  return wp_parse_args($args, $defaults);
30
  }
31
 
32
+ static public function plugin_row_meta($links, $file) {
33
+ if ($file == RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME) {
34
+ $report_url = 'https://www.radiustheme.com/contact/';
35
+ $row_meta['issues'] = sprintf('%2$s <a target="_blank" href="%1$s">%3$s</a>', esc_url($report_url), esc_html__('Facing issue?', 'the-post-grid'), '<span style="color: red">' . esc_html__('Please open a support ticket.', 'the-post-grid') . '</span>');
36
+ return array_merge($links, $row_meta);
37
+ }
38
+ return (array)$links;
39
+ }
40
+
41
  }
42
 
43
  endif;
lib/classes/rtTPGInit.php CHANGED
@@ -18,6 +18,16 @@ if (!class_exists('rtTPGInit')):
18
  'rt_post_grid_marketing'
19
  ));
20
  add_action('admin_enqueue_scripts', array($this, 'settings_admin_enqueue_scripts'));
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  function the_post_grid_remove_all_meta_box() {
18
  'rt_post_grid_marketing'
19
  ));
20
  add_action('admin_enqueue_scripts', array($this, 'settings_admin_enqueue_scripts'));
21
+ add_action( 'wp_print_styles', [$this, 'tpg_dequeue_unnecessary_styles'], 99 );
22
+ }
23
+
24
+ function tpg_dequeue_unnecessary_styles() {
25
+ $settings = get_option(rtTPG()->options['settings']);
26
+
27
+ if (isset($settings['tpg_skip_fa'])) {
28
+ wp_dequeue_style( 'rt-fontawsome' );
29
+ wp_deregister_style( 'rt-fontawsome' );
30
+ }
31
  }
32
 
33
  function the_post_grid_remove_all_meta_box() {
lib/classes/rtTPGOptions.php CHANGED
@@ -105,6 +105,27 @@ if (!class_exists('rtTPGOptions')):
105
  $settings = get_option(rtTPG()->options['settings']);
106
 
107
  return array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  'template_author' => array(
109
  'type' => 'select',
110
  'name' => 'template_author',
105
  $settings = get_option(rtTPG()->options['settings']);
106
 
107
  return array(
108
+ 'tpg_load_script' => array(
109
+ 'type' => 'switch',
110
+ 'name' => 'tpg_load_script',
111
+ 'label' => __('Load Script only ShortCode page', 'the-post-grid'),
112
+ 'description' => __('If you enable this, script will be loaded only ShortCode page.', 'the-post-grid'),
113
+ 'value' => isset($settings['tpg_load_script']) ? $settings['tpg_load_script'] : false,
114
+ ),
115
+ 'tpg_enable_preloader' => array(
116
+ 'type' => 'switch',
117
+ 'name' => 'tpg_enable_preloader',
118
+ 'label' => __('Enable Pre-loader', 'the-post-grid'),
119
+ 'holderClass' => 'tpg-hidden',
120
+ 'value' => isset($settings['tpg_enable_preloader']) ? $settings['tpg_enable_preloader'] : false,
121
+ ),
122
+ 'tpg_skip_fa' => array(
123
+ 'type' => 'switch',
124
+ 'name' => 'tpg_skip_fa',
125
+ 'label' => __('Disable Font Awesome Script', 'the-post-grid'),
126
+ 'description' => __("If Font Awesome 5 exist with theme, don't need to load twice." , 'the-post-grid'),
127
+ 'value' => isset($settings['tpg_enable_preloader']) ? $settings['tpg_enable_preloader'] : false,
128
+ ),
129
  'template_author' => array(
130
  'type' => 'select',
131
  'name' => 'template_author',
lib/classes/rtTPGPreview.php CHANGED
@@ -211,10 +211,10 @@ if ( ! class_exists( 'rtTPGPreview' ) ):
211
  $post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : array() );
212
  if ( ! empty( $post_status ) ) {
213
  $args['post_status'] = $post_status;
214
- } else {
215
- $args['post_status'] = 'publish';
216
  }
217
- }
 
 
218
  // Author
219
  $filterAuthors = array();
220
  $author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : array() );
@@ -273,7 +273,6 @@ if ( ! class_exists( 'rtTPGPreview' ) ):
273
  $args['posts_per_archive_page'] = $args['posts_per_page'];
274
  }
275
 
276
-
277
  // Validation
278
  $containerDataAttr = null;
279
  $containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
211
  $post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : array() );
212
  if ( ! empty( $post_status ) ) {
213
  $args['post_status'] = $post_status;
 
 
214
  }
215
+ } else {
216
+ $args['post_status'] = 'publish';
217
+ }
218
  // Author
219
  $filterAuthors = array();
220
  $author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : array() );
273
  $args['posts_per_archive_page'] = $args['posts_per_page'];
274
  }
275
 
 
276
  // Validation
277
  $containerDataAttr = null;
278
  $containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
lib/classes/rtTPGShortCode.php CHANGED
@@ -1,997 +1,1010 @@
1
- <?php
2
-
3
- if ( ! class_exists( 'rtTPGShortCode' ) ):
4
-
5
- class rtTPGShortCode {
6
-
7
- private $scA = array();
8
- private $l4toggle = false;
9
-
10
- function __construct() {
11
- add_shortcode( 'the-post-grid', array( $this, 'the_post_grid_short_code' ) );
12
- add_action( 'pre_get_posts', array( $this, 'make_sticky_work' ) );
13
- }
14
-
15
- function make_sticky_work( $q ) {
16
- if ( true === $q->get( 'wp_tpg_is_home' ) ) {
17
- $q->is_home = true;
18
- }
19
- }
20
-
21
- function register_sc_scripts() {
22
-
23
- $caro = $isSinglePopUp = false;
24
- $script = array();
25
- $style = array();
26
- array_push( $script, 'jquery' );
27
- $ajaxurl = '';
28
- if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
29
- $ajaxurl .= admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
30
- } else {
31
- $ajaxurl .= admin_url( 'admin-ajax.php' );
32
- }
33
- $variables = array(
34
- 'nonceID' => rtTPG()->nonceId(),
35
- 'nonce' => wp_create_nonce( rtTPG()->nonceText() ),
36
- 'ajaxurl' => $ajaxurl
37
- );
38
- foreach ( $this->scA as $sc ) {
39
- if ( isset( $sc ) && is_array( $sc ) ) {
40
- if ( $sc['isSinglePopUp'] ) {
41
- $isSinglePopUp = true;
42
- }
43
- if ( $sc['isWooCom'] ) {
44
- $variables['woocommerce_enable_ajax_add_to_cart'] = get_option( 'woocommerce_enable_ajax_add_to_cart' );
45
- $variables['woocommerce_cart_redirect_after_add'] = get_option( 'woocommerce_cart_redirect_after_add' );
46
- }
47
- }
48
- }
49
- if ( count( $this->scA ) ) {
50
- array_push( $script, 'jquery' );
51
- array_push( $script, 'rt-image-load-js' );
52
- array_push( $script, 'rt-isotope-js' );
53
- array_push( $style, 'rt-fontawsome' );
54
- array_push( $script, 'rt-actual-height-js' );
55
- array_push( $script, 'rt-tpg' );
56
- if ( is_rtl() ) {
57
- array_push( $style, 'rt-tpg-rtl' );
58
- }
59
- wp_enqueue_style( $style );
60
- wp_enqueue_script( $script );
61
- wp_localize_script( 'rt-tpg', 'rttpg', $variables );
62
-
63
- do_action( 'tpg_after_script', $isSinglePopUp );
64
-
65
- }
66
-
67
- if ( $isSinglePopUp && rtTPG()->hasPro() ) {
68
- $html = null;
69
- $html .= '<div class="md-modal rt-md-effect" id="rt-modal">
70
- <div class="md-content">
71
- <div class="rt-md-content-holder">
72
-
73
- </div>
74
- <div class="md-cls-btn">
75
- <button class="md-close"><i class="fa fa-times" aria-hidden="true"></i></button>
76
- </div>
77
- </div>
78
- </div>';
79
- $html .= "<div class='md-overlay'></div>";
80
- echo $html;
81
- }
82
- }
83
-
84
- function the_post_grid_short_code( $atts, $content = null ) {
85
- $rand = mt_rand();
86
-
87
- $layoutID = "rt-tpg-container-" . $rand;
88
-
89
- $html = null;
90
- $arg = array();
91
- $atts = shortcode_atts( array(
92
- 'id' => null
93
- ), $atts, 'the-post-grid' );
94
- $scID = $atts['id'];
95
- if ( $scID && ! is_null( get_post( $scID ) ) ) {
96
- $scMeta = get_post_meta( $scID );
97
-
98
- $layout = ( isset( $scMeta['layout'][0] ) ? $scMeta['layout'][0] : 'layout1' );
99
- if ( ! in_array( $layout, array_keys( rtTPG()->rtTPGLayouts() ) ) ) {
100
- $layout = 'layout1';
101
- }
102
-
103
- $isIsotope = preg_match( '/isotope/', $layout );
104
- $isCarousel = preg_match( '/carousel/', $layout );
105
- $isGrid = preg_match( '/layout/', $layout );
106
- $isWooCom = preg_match( '/wc/', $layout );
107
- $isEdd = preg_match( '/edd/', $layout );
108
- $isOffset = preg_match( '/offset/', $layout );
109
-
110
- $colStore = $dCol = ( isset( $scMeta['column'][0] ) ? absint( $scMeta['column'][0] ) : 3 );
111
- $tCol = ( isset( $scMeta['tpg_tab_column'][0] ) ? absint( $scMeta['tpg_tab_column'][0] ) : 2 );
112
- $mCol = ( isset( $scMeta['tpg_mobile_column'][0] ) ? absint( $scMeta['tpg_mobile_column'][0] ) : 1 );
113
- if ( ! in_array( $dCol, array_keys( rtTPG()->scColumns() ) ) ) {
114
- $dCol = 3;
115
- }
116
- if ( ! in_array( $tCol, array_keys( rtTPG()->scColumns() ) ) ) {
117
- $tCol = 2;
118
- }
119
- if ( ! in_array( $dCol, array_keys( rtTPG()->scColumns() ) ) ) {
120
- $mCol = 1;
121
- }
122
-
123
- if ( $isOffset ) {
124
- $dCol = ( $dCol < 3 ? 2 : $dCol );
125
- $tCol = ( $tCol < 3 ? 2 : $tCol );
126
- $mCol = ( $mCol < 3 ? 1 : $mCol );
127
- }
128
- $arg = array();
129
- $fImg = ( ! empty( $scMeta['feature_image'][0] ) ? true : false );
130
- $fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : "medium" );
131
- $mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : "feature_image" );
132
- $arg['excerpt_type'] = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
133
- $arg['title_limit_type'] = ( isset( $scMeta['tpg_title_limit_type'][0] ) ? $scMeta['tpg_title_limit_type'][0] : 'character' );
134
- $arg['excerpt_limit'] = ( isset( $scMeta['excerpt_limit'][0] ) ? absint( $scMeta['excerpt_limit'][0] ) : 0 );
135
- $arg['title_limit'] = ( isset( $scMeta['tpg_title_limit'][0] ) ? absint( $scMeta['tpg_title_limit'][0] ) : 0 );
136
- $arg['excerpt_more_text'] = ( isset( $scMeta['tgp_excerpt_more_text'][0] ) ? $scMeta['tgp_excerpt_more_text'][0] : null );
137
- $arg['read_more_text'] = ( ! empty( $scMeta['tgp_read_more_text'][0] ) ? $scMeta['tgp_read_more_text'][0] : __( 'Read More',
138
- 'the-post-grid' ) );
139
- $arg['show_all_text'] = ( ! empty( $scMeta['tpg_show_all_text'][0] ) ? $scMeta['tpg_show_all_text'][0] : __( 'Show all',
140
- 'the-post-grid' ) );
141
- $arg['tpg_title_position'] = isset( $scMeta['tpg_title_position'][0] ) && ! empty( $scMeta['tpg_title_position'][0] ) ? $scMeta['tpg_title_position'][0] : null;
142
- $arg['btn_alignment_class'] = isset( $scMeta['tpg_read_more_button_alignment'][0] ) && ! empty( $scMeta['tpg_read_more_button_alignment'][0] ) ? $scMeta['tpg_read_more_button_alignment'][0] : '';
143
-
144
- /* Argument create */
145
- $args = array();
146
- $postType = ( isset( $scMeta['tpg_post_type'][0] ) ? $scMeta['tpg_post_type'][0] : 'post' );
147
- if ( $postType ) {
148
- $args['post_type'] = $postType;
149
- }
150
-
151
- // Common filter
152
- /* post__in */
153
- $post__in = ( isset( $scMeta['post__in'][0] ) ? $scMeta['post__in'][0] : null );
154
- if ( $post__in ) {
155
- $post__in = explode( ',', $post__in );
156
- $args['post__in'] = $post__in;
157
- }
158
- /* post__not_in */
159
- $post__not_in = ( isset( $scMeta['post__not_in'][0] ) ? $scMeta['post__not_in'][0] : null );
160
- if ( $post__not_in ) {
161
- $post__not_in = explode( ',', $post__not_in );
162
- $args['post__not_in'] = $post__not_in;
163
- }
164
-
165
- /* LIMIT */
166
- $limit = ( ( empty( $scMeta['limit'][0] ) || $scMeta['limit'][0] === '-1' ) ? - 1 : absint( $scMeta['limit'][0] ) );
167
- $args['posts_per_page'] = $limit;
168
- $pagination = ! empty( $scMeta['pagination'][0] );
169
- $posts_loading_type = ( ! empty( $scMeta['posts_loading_type'][0] ) ? $scMeta['posts_loading_type'][0] : "pagination" );
170
- if ( $pagination ) {
171
- $posts_per_page = ( isset( $scMeta['posts_per_page'][0] ) ? intval( $scMeta['posts_per_page'][0] ) : $limit );
172
- $args['posts_per_page'] = $posts_per_page;
173
- $args['paged'] = get_query_var( 'page' ) ? get_query_var( 'page' ) : ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 );
174
- }
175
-
176
- // Advance Filter
177
- $adv_filter = get_post_meta( $scID, 'post_filter' );
178
- $taxFilter = get_post_meta( $scID, 'tgp_filter_taxonomy', true );
179
- $taxHierarchical = get_post_meta( $scID, 'tgp_filter_taxonomy_hierarchical', true );
180
- $taxFilterTerms = array();
181
- $taxFilterOperator = "IN";
182
- // Taxonomy
183
- $taxQ = array();
184
- if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $scMeta['tpg_taxonomy'] ) ) {
185
-
186
- if ( is_array( $scMeta['tpg_taxonomy'] ) && ! empty( $scMeta['tpg_taxonomy'] ) ) {
187
- foreach ( $scMeta['tpg_taxonomy'] as $taxonomy ) {
188
- $terms = ( isset( $scMeta[ 'term_' . $taxonomy ] ) ? $scMeta[ 'term_' . $taxonomy ] : array() );
189
- if ( is_array( $terms ) && ! empty( $terms ) ) {
190
- $operator = ( isset( $scMeta[ 'term_operator_' . $taxonomy ][0] ) ? $scMeta[ 'term_operator_' . $taxonomy ][0] : "IN" );
191
- $taxQ[] = array(
192
- 'taxonomy' => $taxonomy,
193
- 'field' => 'term_id',
194
- 'terms' => $terms,
195
- 'operator' => $operator,
196
- );
197
- if ( $taxonomy == $taxFilter ) {
198
- $taxFilterOperator = $operator;
199
- }
200
- }
201
- if ( $taxonomy == $taxFilter ) {
202
- $taxFilterTerms = $terms;
203
- }
204
- }
205
- }
206
- if ( count( $taxQ ) >= 2 ) {
207
- $relation = ( isset( $scMeta['taxonomy_relation'][0] ) ? $scMeta['taxonomy_relation'][0] : "AND" );
208
- $taxQ['relation'] = $relation;
209
- }
210
- }
211
-
212
- if ( ! empty( $taxQ ) ) {
213
- $args['tax_query'] = $taxQ;
214
- }
215
-
216
-
217
- // Order
218
- if ( in_array( 'order', $adv_filter ) ) {
219
- $order_by = ( isset( $scMeta['order_by'][0] ) ? $scMeta['order_by'][0] : null );
220
- $order = ( isset( $scMeta['order'][0] ) ? $scMeta['order'][0] : null );
221
- if ( $order ) {
222
- $args['order'] = $order;
223
- }
224
- if ( $order_by ) {
225
- $args['orderby'] = $order_by;
226
- $meta_key = ! empty( $scMeta['tpg_meta_key'][0] ) ? trim( $scMeta['tpg_meta_key'][0] ) : null;
227
- if ( in_array( $order_by, array_keys( rtTPG()->rtMetaKeyType() ) ) && $meta_key ) {
228
- $args['orderby'] = $order_by;
229
- $args['meta_key'] = $meta_key;
230
- }
231
- }
232
- }
233
-
234
- // Status
235
- if ( in_array( 'tpg_post_status', $adv_filter ) ) {
236
- $post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : array() );
237
- if ( ! empty( $post_status ) ) {
238
- $args['post_status'] = $post_status;
239
- } else {
240
- $args['post_status'] = 'publish';
241
- }
242
- }
243
- // Author
244
- $author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : array() );
245
- $filterAuthors = array();
246
- if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
247
- $filterAuthors = $args['author__in'] = $author;
248
- }
249
-
250
- // Search
251
- $s = ( isset( $scMeta['s'][0] ) ? $scMeta['s'][0] : array() );
252
- if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
253
- $args['s'] = $s;
254
- }
255
-
256
- // Date query
257
- if ( in_array( 'date_range', $adv_filter ) ) {
258
- $startDate = ( ! empty( $scMeta['date_range_start'][0] ) ? $scMeta['date_range_start'][0] : null );
259
- $endDate = ( ! empty( $scMeta['date_range_end'][0] ) ? $scMeta['date_range_end'][0] : null );
260
- if ( $startDate && $endDate ) {
261
- $args['date_query'] = array(
262
- array(
263
- 'after' => $startDate,
264
- 'before' => $endDate,
265
- 'inclusive' => true,
266
- ),
267
- );
268
- }
269
- }
270
-
271
- $settings = get_option( rtTPG()->options['settings'] );
272
- $oLayoutTag = ! empty( $settings['template_tag'] ) ? absint( $settings['template_tag'] ) : null;
273
- $oLayoutAuthor = ! empty( $settings['template_author'] ) ? $settings['template_author'] : null;
274
- $oLayoutCategory = ! empty( $settings['template_category'] ) ? $settings['template_category'] : null;
275
- $oLayoutSearch = ! empty( $settings['template_search'] ) ? $settings['template_search'] : null;
276
- $dataArchive = null;
277
- if ( ( is_category() && $oLayoutCategory ) || ( is_search() && $oLayoutSearch ) || ( is_tag() && $oLayoutTag ) || ( is_author() && $oLayoutAuthor ) ) {
278
-
279
- unset( $args['post_type'] );
280
- unset( $args['tax_query'] );
281
- unset( $args['author__in'] );
282
- $obj = get_queried_object();
283
- $aType = $aValue = null;
284
- if ( $oLayoutTag && is_tag() ) {
285
- if ( ! empty( $obj->slug ) ) {
286
- $aValue = $args['tag'] = $obj->slug;
287
- $aType = 'tag';
288
- }
289
- } else if ( $oLayoutCategory && is_category() ) {
290
- if ( ! empty( $obj->slug ) ) {
291
- $aValue = $args['category_name'] = $obj->slug;
292
- }
293
- $aType = 'category';
294
- } else if ( $oLayoutAuthor && is_author() ) {
295
- $aValue = $args['author'] = $obj->ID;
296
- $aType = 'author';
297
- } else if ( $oLayoutSearch && is_search() ) {
298
- $aValue = $args['s'] = get_search_query();
299
- $aType = 'search';
300
- }
301
- $dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
302
- $args['posts_per_archive_page'] = $args['posts_per_page'];
303
- }
304
-
305
- // Validation
306
- $containerDataAttr = null;
307
- $containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
308
-
309
- $dCol = $dCol == 5 ? '24' : round( 12 / $dCol );
310
- $tCol = $dCol == 5 ? '24' : round( 12 / $tCol );
311
- $mCol = $dCol == 5 ? '24' : round( 12 / $mCol );
312
- if ( $isCarousel ) {
313
- $dCol = $tCol = $mCol = 12;
314
- }
315
- $arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
316
- if ( $layout == 'layout2' || $layout == 'layout3' ) {
317
- $iCol = ( isset( $scMeta['tgp_layout2_image_column'][0] ) ? absint( $scMeta['tgp_layout2_image_column'][0] ) : 4 );
318
- $iCol = $iCol > 12 ? 4 : $iCol;
319
- $cCol = 12 - $iCol;
320
- $arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
321
- $arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
322
- } else if ( $layout == 'layout4' ) {
323
- $arg['image_area'] = "rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ";
324
- $arg['content_area'] = "rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ";
325
- }
326
- $arg_class = [];
327
- if ( ! $isIsotope && ! rtTPG()->hasPro() ) {
328
- $arg_class[] = 'rt-equal-height';
329
- }
330
- $gridType = ! empty( $scMeta['grid_style'][0] ) ? $scMeta['grid_style'][0] : 'even';
331
- if ( $isIsotope && ! rtTPG()->hasPro() ) {
332
- $arg_class[] = "masonry-grid-item";
333
- } else if ( ! $isCarousel && ! $isOffset ) {
334
- $arg_class[] = $gridType . "-grid-item";
335
- }
336
- $arg_class[] = "rt-grid-item";
337
- if ( $isOffset ) {
338
- $arg_class[] = "rt-offset-item";
339
- }
340
-
341
- $masonryG = null;
342
- if ( $gridType == "even" ) {
343
- $masonryG = " tpg-even";
344
- } else if ( $gridType == "masonry" && ! $isIsotope && ! $isCarousel ) {
345
- $masonryG = " tpg-masonry";
346
- }
347
- $preLoader = $preLoaderHtml = null;
348
- if ( $isIsotope ) {
349
- $arg_class[] = 'isotope-item';
350
- $preLoader = 'tpg-pre-loader';
351
- }
352
- if ( $isCarousel ) {
353
- $arg_class[] = 'carousel-item';
354
- $preLoader = 'tpg-pre-loader';
355
- }
356
- if ( $preLoader && rtTPG()->hasPro() ) {
357
- $preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
358
- }
359
-
360
- $margin = ! empty( $scMeta['margin_option'][0] ) ? $scMeta['margin_option'][0] : 'default';
361
- if ( $margin == 'no' ) {
362
- $arg_class[] = 'no-margin';
363
- }
364
- if ( ! empty( $scMeta['tpg_image_type'][0] ) && $scMeta['tpg_image_type'][0] == 'circle' ) {
365
- $arg_class[] = 'tpg-img-circle';
366
- }
367
- $arg['class'] = implode( " ", $arg_class );
368
- $arg['anchorClass'] = $arg['link_target'] = null;
369
- $link = ! empty( $scMeta['link_to_detail_page'][0] ) ? $scMeta['link_to_detail_page'][0] : 'yes';
370
- if ( $link != 'yes' ) {
371
- $arg['anchorClass'] = ' disabled';
372
- }
373
- $isSinglePopUp = false;
374
- $linkType = ! empty( $scMeta['detail_page_link_type'][0] ) ? $scMeta['detail_page_link_type'][0] : 'popup';
375
- if ( $link == 'yes' ) {
376
- if ( $linkType == 'popup' && rtTPG()->hasPro() ) {
377
- $popupType = ! empty( $scMeta['popup_type'][0] ) ? $scMeta['popup_type'][0] : 'single';
378
- if ( $popupType == 'single' ) {
379
- $arg['anchorClass'] .= ' tpg-single-popup';
380
- $isSinglePopUp = true;
381
- } else {
382
- $arg['anchorClass'] .= ' tpg-multi-popup';
383
- }
384
- } else {
385
- $arg['link_target'] = ! empty( $scMeta['link_target'][0] ) ? " target='{$scMeta['link_target'][0]}'" : null;
386
- }
387
- }
388
-
389
- $parentClass = ( ! empty( $scMeta['parent_class'][0] ) ? trim( $scMeta['parent_class'][0] ) : null );
390
- $defaultImgId = ( ! empty( $scMeta['default_preview_image'][0] ) ? absint( $scMeta['default_preview_image'][0] ) : null );
391
- $customImgSize = ( ! empty( $scMeta['custom_image_size'] ) ? $scMeta['custom_image_size'] : array() );
392
-
393
- $arg['scID'] = $scID;
394
- $arg['items'] = isset( $scMeta['item_fields'] ) ? ( $scMeta['item_fields'] ? $scMeta['item_fields'] : array() ) : array();
395
- if ( in_array( 'cf', $arg['items'] ) ) {
396
- $arg['cf_group'] = array();
397
- $arg['cf_group'] = get_post_meta( $scID, 'cf_group' );
398
- $arg['format'] = array(
399
- 'hide_empty' => get_post_meta( $scID, 'cf_hide_empty_value', true ),
400
- 'show_value' => get_post_meta( $scID, 'cf_show_only_value', true ),
401
- 'hide_group_title' => get_post_meta( $scID, 'cf_hide_group_title', true )
402
- );
403
- }
404
-
405
- // Set readmore false if excerpt type = full content
406
- if ( isset( $arg['excerpt_type'] ) && $arg['excerpt_type'] === 'full' && ( $key = array_search( 'read_more', $arg['items'] ) ) !== false ) {
407
- unset( $arg['items'][ $key ] );
408
- }
409
-
410
- if ( ! empty( $scMeta['ignore_sticky_posts'][0] ) ) {
411
- $args['ignore_sticky_posts'] = true;
412
- } else {
413
- $args['wp_tpg_is_home'] = true;
414
- }
415
-
416
- $filters = ! empty( $scMeta['tgp_filter'] ) ? $scMeta['tgp_filter'] : array();
417
- $action_term = ! empty( $scMeta['tgp_default_filter'][0] ) ? absint( $scMeta['tgp_default_filter'][0] ) : 0;
418
- $hide_all_button = ! empty( $scMeta['tpg_hide_all_button'][0] ) ? true : false;
419
- if ( $taxHierarchical ) {
420
- $terms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true, 0 );
421
- } else {
422
- $terms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true );
423
- }
424
- if ( $hide_all_button && ! $action_term ) {
425
- if ( ! empty( $terms ) ) {
426
- $allKeys = array_keys( $terms );
427
- $action_term = $allKeys[0];
428
- }
429
- }
430
- if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter && $action_term ) {
431
- $args['tax_query'] = array(
432
- array(
433
- 'taxonomy' => $taxFilter,
434
- 'field' => 'term_id',
435
- 'terms' => array( $action_term ),
436
- )
437
- );
438
- }
439
-
440
- if ( $limit != - 1 && $pagination ) {
441
- $tempArgs = $args;
442
- $tempArgs['posts_per_page'] = $limit;
443
- $tempArgs['paged'] = 1;
444
- $tempArgs['fields'] = 'ids';
445
- $tempQ = new WP_Query( $tempArgs );
446
- if ( ! empty( $tempQ->posts ) ) {
447
- $args['post__in'] = $tempQ->posts;
448
- }
449
- }
450
-
451
- $arg['title_tag'] = (!empty($scMeta['title_tag'][0]) && in_array($scMeta['title_tag'][0], array_keys(rtTPG()->getTitleTags()))) ? esc_attr($scMeta['title_tag'][0]) : 'h3';
452
-
453
- $gridQuery = new WP_Query( apply_filters( 'tpg_sc_query_args', $args, $scMeta ) );
454
-
455
- // Start layout
456
- $html .= rtTPG()->layoutStyle( $layoutID, $scMeta, $layout, $scID );
457
- $containerDataAttr .= " data-sc-id='{$scID}'";
458
- $html .= "<div class='rt-container-fluid rt-tpg-container {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
459
- if ( ! empty( $filters ) && ( $isGrid || $isOffset || $isWooCom || $isEdd ) ) {
460
- $html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
461
- $selectedSubTermsForButton = null;
462
- $allText = apply_filters( 'tpg_filter_all_text', __( "All", "the-post-grid" ), $scMeta );
463
- if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter ) {
464
- $filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
465
- $post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
466
- $postCountClass = ( $post_count ? " has-post-count" : null );
467
- $allSelect = " selected";
468
- $isTermSelected = false;
469
- if ( $action_term && $taxFilter ) {
470
- $isTermSelected = true;
471
- $allSelect = null;
472
- }
473
- if ( ! $filterType || $filterType == 'dropdown' ) {
474
- $html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
475
- $termDefaultText = $allText;
476
- $dataTerm = 'all';
477
- $htmlButton = "";
478
- $selectedSubTerms = null;
479
- $pCount = 0;
480
- if ( ! empty( $terms ) ) {
481
- $i = 0;
482
- foreach ( $terms as $id => $term ) {
483
- $pCount = $pCount + $term['count'];
484
- $sT = null;
485
- if ( $taxHierarchical ) {
486
- $subTerms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
487
- if ( ! empty( $subTerms ) ) {
488
- $count = 0;
489
- $item = $allCount = null;
490
- foreach ( $subTerms as $stId => $t ) {
491
- $count = $count + absint( $t['count'] );
492
- $sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
493
- $item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
494
- }
495
- if ( $post_count ) {
496
- $allCount = " (<span class='rt-post-count'>{$count}</span>)";
497
- }
498
- $sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
499
- $sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
500
- <span class='rt-text'>" . $allText . "{$allCount}</span>
501
- <i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
502
- </span>";
503
- $sT .= '<span class="term-dropdown rt-filter-dropdown">';
504
- $sT .= $item;
505
- $sT .= '</span>';
506
- $sT .= "</div>";
507
- }
508
- if ( $action_term === $id ) {
509
- $selectedSubTerms = $sT;
510
- }
511
- }
512
- $postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
513
- if ( $action_term && $action_term == $id ) {
514
- $termDefaultText = $term['name'] . $postCount;
515
- $dataTerm = $id;
516
- }
517
- if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
518
- if ( $taxFilterOperator == "NOT IN" ) {
519
- if ( ! in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
520
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
521
- }
522
- } else {
523
- if ( in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
524
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
525
- }
526
- }
527
- } else {
528
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
529
- }
530
- $i ++;
531
- }
532
- }
533
- $pAllCount = null;
534
- if ( $post_count ) {
535
- $pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
536
- if ( ! $action_term ) {
537
- $termDefaultText = $termDefaultText . $pAllCount;
538
- }
539
- }
540
- if ( ! $hide_all_button ) {
541
- $htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . "{$pAllCount}</span></span>" . $htmlButton;
542
- }
543
- $htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
544
-
545
- $showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
546
- <span class="rt-text">' . $termDefaultText . '</span>
547
- <i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
548
- </span>';
549
-
550
- $html .= $showAllhtml . $htmlButton;
551
- $html .= '</div>' . $selectedSubTerms;
552
- } else {
553
- $termDefaultText = $allText;
554
- $bCount = 0;
555
- $bItems = null;
556
- if ( ! empty( $terms ) ) {
557
- foreach ( $terms as $id => $term ) {
558
- $bCount = $bCount + absint( $term['count'] );
559
- $sT = null;
560
- if ( $taxHierarchical ) {
561
- $subTerms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
562
- if ( ! empty( $subTerms ) ) {
563
- $sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
564
- foreach ( $subTerms as $stId => $t ) {
565
- $sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
566
- $sT .= "<span class='rt-filter-button-item' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
567
- }
568
- $sT .= "</div>";
569
- if ( $action_term === $id ) {
570
- $selectedSubTermsForButton = $sT;
571
- }
572
- }
573
- }
574
- $postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
575
- $termSelected = null;
576
- if ( $isTermSelected && $id == $action_term ) {
577
- $termSelected = " selected";
578
- }
579
- if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
580
- if ( $taxFilterOperator == "NOT IN" ) {
581
- if ( ! in_array( $id, $taxFilterTerms ) ) {
582
- $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
583
- }
584
- } else {
585
- if ( in_array( $id, $taxFilterTerms ) ) {
586
- $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
587
- }
588
- }
589
-
590
- } else {
591
- $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
592
- }
593
- }
594
- }
595
- $html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
596
- if ( ! $hide_all_button ) {
597
- $pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
598
- $html .= "<span class='term-button-item rt-filter-button-item {$allSelect}' data-term='all'>" . $allText . "{$pCountH}</span>";
599
- }
600
- $html .= $bItems;
601
- $html .= "</div>";
602
- }
603
- }
604
-
605
- // Author filter
606
- if ( in_array( '_author_filter', $filters ) ) {
607
- $filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
608
- $post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
609
- $users = get_users( apply_filters( 'tpg_author_arg', array() ) );
610
-
611
- $allSelect = " selected";
612
- $isTermSelected = false;
613
- if ( $action_term && $taxFilter ) {
614
- $isTermSelected = true;
615
- $allSelect = null;
616
- }
617
- if ( ! $filterType || $filterType == 'dropdown' ) {
618
- $html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}'>";
619
- $termDefaultText = $allText;
620
- $dataAuthor = 'all';
621
- $htmlButton = "";
622
- $htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
623
- if ( ! empty( $users ) ) {
624
- foreach ( $users as $user ) {
625
- if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
626
- if ( in_array( $user->ID, $filterAuthors ) ) {
627
- if ( $action_term == $user->ID ) {
628
- $termDefaultText = $user->display_name;
629
- $dataTerm = $user->ID;
630
- } else {
631
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name}</span>";
632
- }
633
- }
634
- } else {
635
- if ( $action_term == $user->ID ) {
636
- $termDefaultText = $user->display_name;
637
- $dataTerm = $user->ID;
638
- } else {
639
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name}</span>";
640
- }
641
- }
642
- }
643
- }
644
-
645
- if ( $isTermSelected ) {
646
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . "{$pAllCount}</span>";
647
- }
648
- $htmlButton .= '</span>';
649
-
650
- $showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
651
- <span class="rt-text">' . $termDefaultText . '</span>
652
- <i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
653
- </span>';
654
-
655
- $html .= $showAllhtml . $htmlButton;
656
- $html .= '</div>';
657
- } else {
658
- $bCount = 0;
659
- $bItems = null;
660
- if ( ! empty( $users ) ) {
661
- foreach ( $users as $user ) {
662
- if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
663
- if ( in_array( $user->ID, $filterAuthors ) ) {
664
- $bItems .= "<span class='author-button-item rt-filter-button-item data-author='{$user->ID}'>{$user->display_name}</span>";
665
- }
666
- } else {
667
- $bItems .= "<span class='author-button-item rt-filter-button-item data-author='{$user->ID}'>{$user->display_name}</span>";
668
- }
669
- }
670
- }
671
- $html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
672
- if ( ! $hide_all_button ) {
673
- $pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
674
- $html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "{$pCountH}</span>";
675
- }
676
- $html .= $bItems;
677
- $html .= "</div>";
678
- }
679
- }
680
-
681
- if ( in_array( '_sort_order', $filters ) ) {
682
- $action_order = ( ! empty( $args['order'] ) ? strtoupper( trim( $args['order'] ) ) : "DESC" );
683
- $html .= '<div class="rt-filter-item-wrap rt-sort-order-action">';
684
- $html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'>&nbsp;<span></span></span>";
685
- $html .= '</div>';
686
- }
687
-
688
- if ( in_array( '_order_by', $filters ) ) {
689
- $wooFeature = ( $postType == "product" ? true : false );
690
- $orders = rtTPG()->rtPostOrderBy( $wooFeature );
691
- $action_orderby = ( ! empty( $args['orderby'] ) ? trim( $args['orderby'] ) : "none" );
692
- if ( $action_orderby == 'none' ) {
693
- $action_orderby_label = __( "Sort By None", "the-post-grid" );
694
- } elseif ( in_array( $action_orderby, array_keys( rtTPG()->rtMetaKeyType() ) ) ) {
695
- $action_orderby_label = __( "Meta value", "the-post-grid" );
696
- } else {
697
- $action_orderby_label = $orders[ $action_orderby ];
698
- }
699
- if ( $action_orderby !== 'none' ) {
700
- $orders['none'] = __( "Sort By None", "the-post-grid" );
701
- }
702
- $html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
703
- $html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
704
- <span class='rt-text-order-by'>{$action_orderby_label}</span>
705
- <i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
706
- </span>";
707
- $html .= '<span class="order-by-dropdown rt-filter-dropdown">';
708
-
709
- foreach ( $orders as $orderKey => $order ) {
710
- $html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
711
- }
712
- $html .= '</span>';
713
- $html .= '</div>';
714
- }
715
-
716
- if ( in_array( '_search', $filters ) ) {
717
- $html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
718
- $html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__( "Search...", 'the-post-grid' ) );
719
- $html .= "<span class='rt-action'>&#128269;</span>";
720
- $html .= "<span class='rt-loading'></span>";
721
- $html .= '</div>';
722
- }
723
- $html .= "</div>$selectedSubTermsForButton</div>";
724
- }
725
-
726
- $html .= "<div data-title='" . __( "Loading ...",
727
- 'the-post-grid' ) . "' class='rt-row rt-content-loader {$layout}{$masonryG} {$preLoader}'>";
728
-
729
- if ( $gridQuery->have_posts() ) {
730
-
731
- if ( $isCarousel ) {
732
- $cOpt = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : array();
733
- $slider_js_options = apply_filters( 'rttpg_slider_js_options', array(
734
- "speed" => ! empty( $scMeta['tpg_carousel_speed'][0] ) ? absint( $scMeta['tpg_carousel_speed'][0] ) : 250,
735
- "autoPlayTimeOut" => ! empty( $scMeta['tpg_carousel_autoplay_timeout'][0] ) ? absint( $scMeta['tpg_carousel_autoplay_timeout'][0] ) : 5000,
736
- "autoPlay" => in_array( 'auto_play', $cOpt ),
737
- "stopOnHover" => in_array( 'stop_hover', $cOpt ),
738
- "nav" => in_array( 'nav_button', $cOpt ),
739
- "dots" => in_array( 'pagination', $cOpt ),
740
- "loop" => in_array( 'loop', $cOpt ),
741
- "lazyLoad" => in_array( 'lazyLoad', $cOpt ),
742
- "autoHeight" => in_array( 'autoHeight', $cOpt ),
743
- "rtl" => in_array( 'rtl', $cOpt )
744
- ), $scMeta );
745
- $html .= sprintf( '<div class="rt-carousel-holder" data-rtowl-options="%s">',
746
- htmlspecialchars( wp_json_encode( $slider_js_options ) ) );
747
- }
748
- $isotope_filter = null;
749
- if ( $isIsotope ) {
750
- $isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
751
- $isotope_dropdown_filter = isset( $scMeta['isotope_filter_dropdown'][0] ) ? $scMeta['isotope_filter_dropdown'][0] : null;
752
- $selectedTerms = array();
753
- if ( isset( $scMeta['post_filter'] ) && in_array( 'tpg_taxonomy',
754
- $scMeta['post_filter'] ) && isset( $scMeta['tpg_taxonomy'] ) && in_array( $isotope_filter,
755
- $scMeta['tpg_taxonomy'] )
756
- ) {
757
- $selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : array() );
758
- }
759
- $termArgs = [
760
- 'taxonomy' => $isotope_filter,
761
- 'orderby' => 'meta_value_num',
762
- 'order' => 'ASC',
763
- 'hide_empty' => false,
764
- 'include' => $selectedTerms
765
- ];
766
- if ( rtTPG()->hasPro() ) {
767
- $termArgs['meta_key'] = '_rt_order';
768
- }
769
- $terms = get_terms( $termArgs );
770
-
771
- $html .= '<div class="tpg-iso-filter">';
772
- $htmlButton = $drop = null;
773
- $fSelectTrigger = false;
774
-
775
- if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
776
- foreach ( $terms as $term ) {
777
- $tItem = ! empty( $scMeta['isotope_default_filter'][0] ) ? $scMeta['isotope_default_filter'][0] : null;
778
- $fSelected = null;
779
- if ( $tItem == $term->term_id ) {
780
- $fSelected = 'selected';
781
- $fSelectTrigger = true;
782
- }
783
- $htmlButton .= sprintf( '<button class="rt-iso-btn-%s%s" data-filter=".iso_%d">%s</button>',
784
- esc_attr( $term->slug ),
785
- $fSelected ? " " . $fSelected : '',
786
- $term->term_id,
787
- $term->name
788
- );
789
- $drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
790
- }
791
- }
792
- if ( empty( $scMeta['isotope_filter_show_all'][0] ) ) {
793
- $fSelect = ( $fSelectTrigger ? null : 'class="selected"' );
794
- $htmlButton = "<button class='rt-iso-btn-all selected' data-filter='*'>" . $arg['show_all_text'] . "</button>" . $htmlButton;
795
- $drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
796
- }
797
- $filter_count = ! empty( $scMeta['isotope_filter_count'][0] ) ? true : false;
798
- $filter_url = ! empty( $scMeta['isotope_filter_url'][0] ) ? true : false;
799
- $htmlButton = "<div id='iso-button-{$rand}' class='rt-tpg-isotope-buttons button-group filter-button-group option-set' data-url='{$filter_url}' data-count='{$filter_count}'>{$htmlButton}</div>";
800
-
801
- if ( $isotope_dropdown_filter ) {
802
- $html .= "<select class='isotope-dropdown-filter'>{$drop}</select>";
803
- } else {
804
- $html .= $htmlButton;
805
- }
806
- if ( ! empty( $scMeta['isotope_search_filter'][0] ) ) {
807
- $html .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" . __( 'Search',
808
- 'the-post-grid' ) . "' /></div>";
809
- }
810
- $html .= '</div>';
811
-
812
- $html .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
813
- }
814
-
815
- $l = $offLoop = 0;
816
- $offsetBigHtml = $offsetSmallHtml = null;
817
-
818
- while ( $gridQuery->have_posts() ) : $gridQuery->the_post();
819
- if ( $colStore == $l ) {
820
- if ( $this->l4toggle ) {
821
- $this->l4toggle = false;
822
- } else {
823
- $this->l4toggle = true;
824
- }
825
- $l = 0;
826
- }
827
- $pID = get_the_ID();
828
- $arg['pID'] = $pID;
829
- $arg['title'] = rtTPG()->get_the_title( $pID, $arg );
830
- $arg['pLink'] = get_permalink();
831
- $arg['toggle'] = $this->l4toggle;
832
- $arg['layoutID'] = $layoutID;
833
- $arg['author'] = apply_filters( 'rttpg_author_link', sprintf( '<a href="%s">%s</a>', get_author_posts_url( get_the_author_meta( 'ID' ) ), get_the_author() ) );
834
- $cc = wp_count_comments( $pID );
835
- $arg['date'] = get_the_date();
836
- $arg['excerpt'] = rtTPG()->get_the_excerpt( $pID, $arg );
837
- $arg['categories'] = get_the_term_list( $pID, 'category', null, '<span class="rt-separator">,</span>' );
838
- $arg['tags'] = get_the_term_list( $pID, 'post_tag', null, '<span class="rt-separator">,</span>' );
839
- if ( $isIsotope ) {
840
- $termAs = wp_get_post_terms( $pID, $isotope_filter, array( "fields" => "all" ) );
841
- $isoFilter = [];
842
- if ( ! empty( $termAs ) ) {
843
- foreach ( $termAs as $term ) {
844
- $isoFilter[] = "iso_" . $term->term_id;
845
- $isoFilter[] = "rt-item-" . esc_attr( $term->slug );
846
- }
847
- }
848
- $arg['isoFilter'] = ! empty( $isoFilter ) ? implode( " ", $isoFilter ) : '';
849
- }
850
- if ( comments_open() ) {
851
- $arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$cc->total_comments} </a>";
852
- } else {
853
- $arg['comment'] = "{$cc->total_comments}";
854
- }
855
- $imgSrc = null;
856
-
857
- if ( $isOffset ) {
858
- if ( $offLoop == 0 ) {
859
- $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, $fImgSize, $mediaSource,
860
- $defaultImgId,
861
- $customImgSize ) : null;
862
- $arg['offset'] = 'big';
863
- $offsetBigHtml = rtTPG()->render( 'layouts/' . $layout, $arg, true );
864
- } else {
865
- $arg['offset'] = 'small';
866
- $arg['offsetCol'] = array( $dCol, $tCol, $mCol );
867
- $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, 'thumbnail',
868
- $mediaSource,
869
- $defaultImgId,
870
- $customImgSize ) : null;
871
- $offsetSmallHtml .= rtTPG()->render( 'layouts/' . $layout, $arg, true );
872
- }
873
- } else {
874
- $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, $fImgSize, $mediaSource,
875
- $defaultImgId,
876
- $customImgSize ) : null;
877
- $html .= rtTPG()->render( 'layouts/' . $layout, $arg, true );
878
- }
879
- $offLoop ++;
880
- $l ++;
881
- endwhile;
882
- if ( $isOffset ) {
883
- $oDCol = rtTPG()->get_offset_col( $dCol );
884
- $oTCol = rtTPG()->get_offset_col( $tCol );
885
- $oMCol = rtTPG()->get_offset_col( $mCol );
886
- if ( $layout == "offset03" || $layout == "offset04" ) {
887
- $oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
888
- $oMCol['big'] = $oMCol['small'] = 12;
889
- }
890
- $html .= "<div class='rt-col-md-{$oDCol['big']} rt-col-sm-{$oTCol['big']} rt-col-xs-{$oMCol['big']}'><div class='rt-row'>{$offsetBigHtml}</div></div>";
891
- $html .= "<div class='rt-col-md-{$oDCol['small']} rt-col-sm-{$oTCol['small']} rt-col-xs-{$oMCol['small']}'><div class='rt-row offset-small-wrap'>{$offsetSmallHtml}</div></div>";
892
- }
893
- if ( $isIsotope || $isCarousel ) {
894
- $html .= '</div>'; // End isotope / Carousel item holder
895
- }
896
-
897
- } else {
898
- $not_found_text = isset( $scMeta['tgp_not_found_text'][0] ) && ! empty( $scMeta['tgp_not_found_text'][0] ) ? esc_attr( $scMeta['tgp_not_found_text'][0] ) : __( 'No post found', 'the-post-grid' );
899
- $html .= sprintf( '<p>%s</p>',
900
- apply_filters( 'tpg_not_found_text', $not_found_text, $args, $scMeta )
901
- );
902
- }
903
- $html .= $preLoaderHtml;
904
- $html .= "</div>"; // End row
905
- $htmlUtility = null;
906
- if ( $pagination && ! $isCarousel ) {
907
- if ( $isOffset ) {
908
- $posts_loading_type = "page_prev_next";
909
- $htmlUtility .= "<div class='rt-cb-page-prev-next'>
910
- <span class='rt-cb-prev-btn'><i class='fa fa-angle-left' aria-hidden='true'></i></span>
911
- <span class='rt-cb-next-btn'><i class='fa fa-angle-right' aria-hidden='true'></i></span>
912
- </div>";
913
- } else {
914
- $hide = ( $gridQuery->max_num_pages < 2 ? " rt-hidden-elm" : null );
915
- if ( $posts_loading_type == "pagination" ) {
916
- if ( $isGrid && empty( $filters ) ) {
917
- $htmlUtility .= rtTPG()->rt_pagination( $gridQuery,
918
- $args['posts_per_page'] );
919
- }
920
- } elseif ( $posts_loading_type == "pagination_ajax" && ! $isIsotope ) {
921
- $htmlUtility .= "<div class='rt-page-numbers'></div>";
922
- } elseif ( $posts_loading_type == "load_more" && rtTPG()->hasPro() ) {
923
- $htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
924
- <span class='rt-loadmore-text'>" . __( 'Load More', 'the-post-grid' ) . "</span>
925
- <div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
926
- </div>";
927
-
928
- } elseif ( $posts_loading_type == "load_on_scroll" && rtTPG()->hasPro() ) {
929
- $htmlUtility .= "<div class='rt-infinite-action'>
930
- <div class='rt-infinite-loading la-fire la-2x'>
931
- <div></div>
932
- <div></div>
933
- <div></div>
934
- </div>
935
- </div>";
936
- }
937
- }
938
- }
939
-
940
- if ( $htmlUtility ) {
941
- $l4toggle = null;
942
- if ( $layout == "layout4" ) {
943
- $l4toggle = "data-l4toggle='{$this->l4toggle}'";
944
- }
945
- $html .= "<div class='rt-pagination-wrap' data-total-pages='{$gridQuery->max_num_pages}' data-posts-per-page='{$args['posts_per_page']}' data-type='{$posts_loading_type}' {$l4toggle} >" . $htmlUtility . "</div>";
946
- }
947
-
948
- $html .= "</div>"; // container rt-tpg
949
-
950
- wp_reset_postdata();
951
-
952
- $scriptGenerator = array();
953
- $scriptGenerator['layout'] = $layoutID;
954
- $scriptGenerator['rand'] = $rand;
955
- $scriptGenerator['scMeta'] = $scMeta;
956
- $scriptGenerator['isCarousel'] = $isCarousel;
957
- $scriptGenerator['isSinglePopUp'] = $isSinglePopUp;
958
- $scriptGenerator['isWooCom'] = $isWooCom;
959
- $this->scA[] = $scriptGenerator;
960
- add_action( 'wp_footer', array( $this, 'register_sc_scripts' ) );
961
- } else {
962
- $html .= "<p>" . __( "No shortCode found", "the-post-grid" ) . "</p>";
963
- }
964
-
965
- //restriction issue
966
- $restriction = ( ! empty( $scMeta['restriction_user_role'] ) ? $scMeta['restriction_user_role'] : array() );
967
- if ( ! empty( $restriction ) ) {
968
- if ( is_user_logged_in() ) {
969
- $currentUserRoles = rtTPG()->getCurrentUserRoles();
970
- if ( in_array( 'administrator', $currentUserRoles ) ) {
971
- $html = $html;
972
- } else {
973
- if ( count( array_intersect( $restriction, $currentUserRoles ) ) ) {
974
- $html = $html;
975
- } else {
976
- $html = "<p>" . __( "You are not permitted to view this content.",
977
- "the-post-grid" ) . "</p>";
978
- }
979
- }
980
-
981
- } else {
982
- $html = "<p>" . __( "This is a restricted content, you need to logged in to view this content.",
983
- "the-post-grid" ) . "</p>";
984
- }
985
- }
986
-
987
- return $html;
988
- }
989
-
990
- public function order_by_popularity_post_clauses( $args ) {
991
- global $wpdb;
992
- $args['orderby'] = "$wpdb->postmeta.meta_value+0 DESC, $wpdb->posts.post_date DESC";
993
-
994
- return $args;
995
- }
996
- }
997
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists( 'rtTPGShortCode' ) ):
4
+
5
+ class rtTPGShortCode {
6
+
7
+ private $scA = array();
8
+ private $l4toggle = false;
9
+
10
+ function __construct() {
11
+ add_shortcode( 'the-post-grid', array( $this, 'the_post_grid_short_code' ) );
12
+ add_action( 'pre_get_posts', array( $this, 'make_sticky_work' ) );
13
+ }
14
+
15
+ function make_sticky_work( $q ) {
16
+ if ( true === $q->get( 'wp_tpg_is_home' ) ) {
17
+ $q->is_home = true;
18
+ }
19
+ }
20
+
21
+ function register_sc_scripts() {
22
+
23
+ $settings = get_option(rtTPG()->options['settings']);
24
+
25
+ $caro = $isSinglePopUp = false;
26
+ $script = array();
27
+ $style = array();
28
+ array_push( $script, 'jquery' );
29
+ $ajaxurl = '';
30
+ if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
31
+ $ajaxurl .= admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
32
+ } else {
33
+ $ajaxurl .= admin_url( 'admin-ajax.php' );
34
+ }
35
+ $variables = array(
36
+ 'nonceID' => rtTPG()->nonceId(),
37
+ 'nonce' => wp_create_nonce( rtTPG()->nonceText() ),
38
+ 'ajaxurl' => $ajaxurl
39
+ );
40
+ foreach ( $this->scA as $sc ) {
41
+ if ( isset( $sc ) && is_array( $sc ) ) {
42
+ if ( $sc['isSinglePopUp'] ) {
43
+ $isSinglePopUp = true;
44
+ }
45
+ if ( $sc['isWooCom'] ) {
46
+ $variables['woocommerce_enable_ajax_add_to_cart'] = get_option( 'woocommerce_enable_ajax_add_to_cart' );
47
+ $variables['woocommerce_cart_redirect_after_add'] = get_option( 'woocommerce_cart_redirect_after_add' );
48
+ }
49
+ }
50
+ }
51
+ if ( count( $this->scA ) ) {
52
+ array_push( $script, 'jquery' );
53
+ array_push( $script, 'rt-image-load-js' );
54
+ array_push( $script, 'rt-isotope-js' );
55
+ array_push( $style, 'rt-fontawsome' );
56
+ array_push( $script, 'rt-actual-height-js' );
57
+ array_push( $script, 'rt-tpg' );
58
+
59
+ if (isset($settings['tpg_load_script'])) {
60
+ wp_enqueue_style('rt-tpg');
61
+ $css = isset($settings['custom_css']) ? stripslashes($settings['custom_css']) : null;
62
+ if ($css) {
63
+ wp_add_inline_style('rt-tpg', $css);
64
+ }
65
+ }
66
+
67
+ if ( is_rtl() ) {
68
+ array_push( $style, 'rt-tpg-rtl' );
69
+ }
70
+ wp_enqueue_style( $style );
71
+ wp_enqueue_script( $script );
72
+ wp_localize_script( 'rt-tpg', 'rttpg', $variables );
73
+
74
+ do_action( 'tpg_after_script', $isSinglePopUp );
75
+
76
+ }
77
+
78
+ if ( $isSinglePopUp && rtTPG()->hasPro() ) {
79
+ $html = null;
80
+ $html .= '<div class="md-modal rt-md-effect" id="rt-modal">
81
+ <div class="md-content">
82
+ <div class="rt-md-content-holder">
83
+
84
+ </div>
85
+ <div class="md-cls-btn">
86
+ <button class="md-close"><i class="fa fa-times" aria-hidden="true"></i></button>
87
+ </div>
88
+ </div>
89
+ </div>';
90
+ $html .= "<div class='md-overlay'></div>";
91
+ echo $html;
92
+ }
93
+ }
94
+
95
+ function the_post_grid_short_code( $atts, $content = null ) {
96
+ $rand = mt_rand();
97
+
98
+ $layoutID = "rt-tpg-container-" . $rand;
99
+
100
+ $html = null;
101
+ $arg = array();
102
+ $atts = shortcode_atts( array(
103
+ 'id' => null
104
+ ), $atts, 'the-post-grid' );
105
+ $scID = $atts['id'];
106
+ if ( $scID && ! is_null( get_post( $scID ) ) ) {
107
+ $scMeta = get_post_meta( $scID );
108
+
109
+ $layout = ( isset( $scMeta['layout'][0] ) ? $scMeta['layout'][0] : 'layout1' );
110
+ if ( ! in_array( $layout, array_keys( rtTPG()->rtTPGLayouts() ) ) ) {
111
+ $layout = 'layout1';
112
+ }
113
+
114
+ $isIsotope = preg_match( '/isotope/', $layout );
115
+ $isCarousel = preg_match( '/carousel/', $layout );
116
+ $isGrid = preg_match( '/layout/', $layout );
117
+ $isWooCom = preg_match( '/wc/', $layout );
118
+ $isEdd = preg_match( '/edd/', $layout );
119
+ $isOffset = preg_match( '/offset/', $layout );
120
+
121
+ $colStore = $dCol = ( isset( $scMeta['column'][0] ) ? absint( $scMeta['column'][0] ) : 3 );
122
+ $tCol = ( isset( $scMeta['tpg_tab_column'][0] ) ? absint( $scMeta['tpg_tab_column'][0] ) : 2 );
123
+ $mCol = ( isset( $scMeta['tpg_mobile_column'][0] ) ? absint( $scMeta['tpg_mobile_column'][0] ) : 1 );
124
+ if ( ! in_array( $dCol, array_keys( rtTPG()->scColumns() ) ) ) {
125
+ $dCol = 3;
126
+ }
127
+ if ( ! in_array( $tCol, array_keys( rtTPG()->scColumns() ) ) ) {
128
+ $tCol = 2;
129
+ }
130
+ if ( ! in_array( $dCol, array_keys( rtTPG()->scColumns() ) ) ) {
131
+ $mCol = 1;
132
+ }
133
+
134
+ if ( $isOffset ) {
135
+ $dCol = ( $dCol < 3 ? 2 : $dCol );
136
+ $tCol = ( $tCol < 3 ? 2 : $tCol );
137
+ $mCol = ( $mCol < 3 ? 1 : $mCol );
138
+ }
139
+ $arg = array();
140
+ $fImg = ( ! empty( $scMeta['feature_image'][0] ) ? true : false );
141
+ $fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : "medium" );
142
+ $mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : "feature_image" );
143
+ $arg['excerpt_type'] = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
144
+ $arg['title_limit_type'] = ( isset( $scMeta['tpg_title_limit_type'][0] ) ? $scMeta['tpg_title_limit_type'][0] : 'character' );
145
+ $arg['excerpt_limit'] = ( isset( $scMeta['excerpt_limit'][0] ) ? absint( $scMeta['excerpt_limit'][0] ) : 0 );
146
+ $arg['title_limit'] = ( isset( $scMeta['tpg_title_limit'][0] ) ? absint( $scMeta['tpg_title_limit'][0] ) : 0 );
147
+ $arg['excerpt_more_text'] = ( isset( $scMeta['tgp_excerpt_more_text'][0] ) ? $scMeta['tgp_excerpt_more_text'][0] : null );
148
+ $arg['read_more_text'] = ( ! empty( $scMeta['tgp_read_more_text'][0] ) ? $scMeta['tgp_read_more_text'][0] : __( 'Read More',
149
+ 'the-post-grid' ) );
150
+ $arg['show_all_text'] = ( ! empty( $scMeta['tpg_show_all_text'][0] ) ? $scMeta['tpg_show_all_text'][0] : __( 'Show all',
151
+ 'the-post-grid' ) );
152
+ $arg['tpg_title_position'] = isset( $scMeta['tpg_title_position'][0] ) && ! empty( $scMeta['tpg_title_position'][0] ) ? $scMeta['tpg_title_position'][0] : null;
153
+ $arg['btn_alignment_class'] = isset( $scMeta['tpg_read_more_button_alignment'][0] ) && ! empty( $scMeta['tpg_read_more_button_alignment'][0] ) ? $scMeta['tpg_read_more_button_alignment'][0] : '';
154
+
155
+ /* Argument create */
156
+ $args = array();
157
+ $postType = ( isset( $scMeta['tpg_post_type'][0] ) ? $scMeta['tpg_post_type'][0] : 'post' );
158
+ if ( $postType ) {
159
+ $args['post_type'] = $postType;
160
+ }
161
+
162
+ // Common filter
163
+ /* post__in */
164
+ $post__in = ( isset( $scMeta['post__in'][0] ) ? $scMeta['post__in'][0] : null );
165
+ if ( $post__in ) {
166
+ $post__in = explode( ',', $post__in );
167
+ $args['post__in'] = $post__in;
168
+ }
169
+ /* post__not_in */
170
+ $post__not_in = ( isset( $scMeta['post__not_in'][0] ) ? $scMeta['post__not_in'][0] : null );
171
+ if ( $post__not_in ) {
172
+ $post__not_in = explode( ',', $post__not_in );
173
+ $args['post__not_in'] = $post__not_in;
174
+ }
175
+
176
+ /* LIMIT */
177
+ $limit = ( ( empty( $scMeta['limit'][0] ) || $scMeta['limit'][0] === '-1' ) ? - 1 : absint( $scMeta['limit'][0] ) );
178
+ $args['posts_per_page'] = $limit;
179
+ $pagination = ! empty( $scMeta['pagination'][0] );
180
+ $posts_loading_type = ( ! empty( $scMeta['posts_loading_type'][0] ) ? $scMeta['posts_loading_type'][0] : "pagination" );
181
+ if ( $pagination ) {
182
+ $posts_per_page = ( isset( $scMeta['posts_per_page'][0] ) ? intval( $scMeta['posts_per_page'][0] ) : $limit );
183
+ $args['posts_per_page'] = $posts_per_page;
184
+ $args['paged'] = get_query_var( 'page' ) ? get_query_var( 'page' ) : ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 );
185
+ }
186
+
187
+ // Advance Filter
188
+ $adv_filter = get_post_meta( $scID, 'post_filter' );
189
+ $taxFilter = get_post_meta( $scID, 'tgp_filter_taxonomy', true );
190
+ $taxHierarchical = get_post_meta( $scID, 'tgp_filter_taxonomy_hierarchical', true );
191
+ $taxFilterTerms = array();
192
+ $taxFilterOperator = "IN";
193
+ // Taxonomy
194
+ $taxQ = array();
195
+ if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $scMeta['tpg_taxonomy'] ) ) {
196
+
197
+ if ( is_array( $scMeta['tpg_taxonomy'] ) && ! empty( $scMeta['tpg_taxonomy'] ) ) {
198
+ foreach ( $scMeta['tpg_taxonomy'] as $taxonomy ) {
199
+ $terms = ( isset( $scMeta[ 'term_' . $taxonomy ] ) ? $scMeta[ 'term_' . $taxonomy ] : array() );
200
+ if ( is_array( $terms ) && ! empty( $terms ) ) {
201
+ $operator = ( isset( $scMeta[ 'term_operator_' . $taxonomy ][0] ) ? $scMeta[ 'term_operator_' . $taxonomy ][0] : "IN" );
202
+ $taxQ[] = array(
203
+ 'taxonomy' => $taxonomy,
204
+ 'field' => 'term_id',
205
+ 'terms' => $terms,
206
+ 'operator' => $operator,
207
+ );
208
+ if ( $taxonomy == $taxFilter ) {
209
+ $taxFilterOperator = $operator;
210
+ }
211
+ }
212
+ if ( $taxonomy == $taxFilter ) {
213
+ $taxFilterTerms = $terms;
214
+ }
215
+ }
216
+ }
217
+ if ( count( $taxQ ) >= 2 ) {
218
+ $relation = ( isset( $scMeta['taxonomy_relation'][0] ) ? $scMeta['taxonomy_relation'][0] : "AND" );
219
+ $taxQ['relation'] = $relation;
220
+ }
221
+ }
222
+
223
+ if ( ! empty( $taxQ ) ) {
224
+ $args['tax_query'] = $taxQ;
225
+ }
226
+
227
+ // Order
228
+ if ( in_array( 'order', $adv_filter ) ) {
229
+ $order_by = ( isset( $scMeta['order_by'][0] ) ? $scMeta['order_by'][0] : null );
230
+ $order = ( isset( $scMeta['order'][0] ) ? $scMeta['order'][0] : null );
231
+ if ( $order ) {
232
+ $args['order'] = $order;
233
+ }
234
+ if ( $order_by ) {
235
+ $args['orderby'] = $order_by;
236
+ $meta_key = ! empty( $scMeta['tpg_meta_key'][0] ) ? trim( $scMeta['tpg_meta_key'][0] ) : null;
237
+ if ( in_array( $order_by, array_keys( rtTPG()->rtMetaKeyType() ) ) && $meta_key ) {
238
+ $args['orderby'] = $order_by;
239
+ $args['meta_key'] = $meta_key;
240
+ }
241
+ }
242
+ }
243
+
244
+ // Status
245
+ if ( in_array( 'tpg_post_status', $adv_filter ) ) {
246
+ $post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : array() );
247
+ if ( ! empty( $post_status ) ) {
248
+ $args['post_status'] = $post_status;
249
+ }
250
+ } else {
251
+ $args['post_status'] = 'publish';
252
+ }
253
+ // Author
254
+ $author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : array() );
255
+ $filterAuthors = array();
256
+ if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
257
+ $filterAuthors = $args['author__in'] = $author;
258
+ }
259
+
260
+ // Search
261
+ $s = ( isset( $scMeta['s'][0] ) ? $scMeta['s'][0] : array() );
262
+ if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
263
+ $args['s'] = $s;
264
+ }
265
+
266
+ // Date query
267
+ if ( in_array( 'date_range', $adv_filter ) ) {
268
+ $startDate = ( ! empty( $scMeta['date_range_start'][0] ) ? $scMeta['date_range_start'][0] : null );
269
+ $endDate = ( ! empty( $scMeta['date_range_end'][0] ) ? $scMeta['date_range_end'][0] : null );
270
+ if ( $startDate && $endDate ) {
271
+ $args['date_query'] = array(
272
+ array(
273
+ 'after' => $startDate,
274
+ 'before' => $endDate,
275
+ 'inclusive' => true,
276
+ ),
277
+ );
278
+ }
279
+ }
280
+
281
+ $settings = get_option( rtTPG()->options['settings'] );
282
+ $oLayoutTag = ! empty( $settings['template_tag'] ) ? absint( $settings['template_tag'] ) : null;
283
+ $oLayoutAuthor = ! empty( $settings['template_author'] ) ? $settings['template_author'] : null;
284
+ $oLayoutCategory = ! empty( $settings['template_category'] ) ? $settings['template_category'] : null;
285
+ $oLayoutSearch = ! empty( $settings['template_search'] ) ? $settings['template_search'] : null;
286
+ $dataArchive = null;
287
+ if ( ( is_category() && $oLayoutCategory ) || ( is_search() && $oLayoutSearch ) || ( is_tag() && $oLayoutTag ) || ( is_author() && $oLayoutAuthor ) ) {
288
+
289
+ unset( $args['post_type'] );
290
+ unset( $args['tax_query'] );
291
+ unset( $args['author__in'] );
292
+ $obj = get_queried_object();
293
+ $aType = $aValue = null;
294
+ if ( $oLayoutTag && is_tag() ) {
295
+ if ( ! empty( $obj->slug ) ) {
296
+ $aValue = $args['tag'] = $obj->slug;
297
+ $aType = 'tag';
298
+ }
299
+ } else if ( $oLayoutCategory && is_category() ) {
300
+ if ( ! empty( $obj->slug ) ) {
301
+ $aValue = $args['category_name'] = $obj->slug;
302
+ }
303
+ $aType = 'category';
304
+ } else if ( $oLayoutAuthor && is_author() ) {
305
+ $aValue = $args['author'] = $obj->ID;
306
+ $aType = 'author';
307
+ } else if ( $oLayoutSearch && is_search() ) {
308
+ $aValue = $args['s'] = get_search_query();
309
+ $aType = 'search';
310
+ }
311
+ $dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
312
+ $args['posts_per_archive_page'] = $args['posts_per_page'];
313
+ }
314
+
315
+ // Validation
316
+ $containerDataAttr = null;
317
+ $containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
318
+
319
+ $dCol = $dCol == 5 ? '24' : round( 12 / $dCol );
320
+ $tCol = $dCol == 5 ? '24' : round( 12 / $tCol );
321
+ $mCol = $dCol == 5 ? '24' : round( 12 / $mCol );
322
+ if ( $isCarousel ) {
323
+ $dCol = $tCol = $mCol = 12;
324
+ }
325
+ $arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
326
+ if ( $layout == 'layout2' || $layout == 'layout3' ) {
327
+ $iCol = ( isset( $scMeta['tgp_layout2_image_column'][0] ) ? absint( $scMeta['tgp_layout2_image_column'][0] ) : 4 );
328
+ $iCol = $iCol > 12 ? 4 : $iCol;
329
+ $cCol = 12 - $iCol;
330
+ $arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
331
+ $arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
332
+ } else if ( $layout == 'layout4' ) {
333
+ $arg['image_area'] = "rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ";
334
+ $arg['content_area'] = "rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ";
335
+ }
336
+ $arg_class = [];
337
+ if ( ! $isIsotope && ! rtTPG()->hasPro() ) {
338
+ $arg_class[] = 'rt-equal-height';
339
+ }
340
+ $gridType = ! empty( $scMeta['grid_style'][0] ) ? $scMeta['grid_style'][0] : 'even';
341
+ if ( $isIsotope && ! rtTPG()->hasPro() ) {
342
+ $arg_class[] = "masonry-grid-item";
343
+ } else if ( ! $isCarousel && ! $isOffset ) {
344
+ $arg_class[] = $gridType . "-grid-item";
345
+ }
346
+ $arg_class[] = "rt-grid-item";
347
+ if ( $isOffset ) {
348
+ $arg_class[] = "rt-offset-item";
349
+ }
350
+
351
+ $masonryG = null;
352
+ if ( $gridType == "even" ) {
353
+ $masonryG = " tpg-even";
354
+ } else if ( $gridType == "masonry" && ! $isIsotope && ! $isCarousel ) {
355
+ $masonryG = " tpg-masonry";
356
+ }
357
+ $preLoader = $preLoaderHtml = null;
358
+ if ( $isIsotope ) {
359
+ $arg_class[] = 'isotope-item';
360
+ $preLoader = 'tpg-pre-loader';
361
+ }
362
+ if ( $isCarousel ) {
363
+ $arg_class[] = 'carousel-item';
364
+ $preLoader = 'tpg-pre-loader';
365
+ }
366
+ if ( $preLoader && rtTPG()->hasPro() ) {
367
+ $preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
368
+ }
369
+
370
+ $margin = ! empty( $scMeta['margin_option'][0] ) ? $scMeta['margin_option'][0] : 'default';
371
+ if ( $margin == 'no' ) {
372
+ $arg_class[] = 'no-margin';
373
+ }
374
+ if ( ! empty( $scMeta['tpg_image_type'][0] ) && $scMeta['tpg_image_type'][0] == 'circle' ) {
375
+ $arg_class[] = 'tpg-img-circle';
376
+ }
377
+ $arg['class'] = implode( " ", $arg_class );
378
+ $arg['anchorClass'] = $arg['link_target'] = null;
379
+ $link = ! empty( $scMeta['link_to_detail_page'][0] ) ? $scMeta['link_to_detail_page'][0] : 'yes';
380
+ if ( $link != 'yes' ) {
381
+ $arg['anchorClass'] = ' disabled';
382
+ }
383
+ $isSinglePopUp = false;
384
+ $linkType = ! empty( $scMeta['detail_page_link_type'][0] ) ? $scMeta['detail_page_link_type'][0] : 'popup';
385
+ if ( $link == 'yes' ) {
386
+ if ( $linkType == 'popup' && rtTPG()->hasPro() ) {
387
+ $popupType = ! empty( $scMeta['popup_type'][0] ) ? $scMeta['popup_type'][0] : 'single';
388
+ if ( $popupType == 'single' ) {
389
+ $arg['anchorClass'] .= ' tpg-single-popup';
390
+ $isSinglePopUp = true;
391
+ } else {
392
+ $arg['anchorClass'] .= ' tpg-multi-popup';
393
+ }
394
+ } else {
395
+ $arg['link_target'] = ! empty( $scMeta['link_target'][0] ) ? " target='{$scMeta['link_target'][0]}'" : null;
396
+ }
397
+ }
398
+
399
+ $parentClass = ( ! empty( $scMeta['parent_class'][0] ) ? trim( $scMeta['parent_class'][0] ) : null );
400
+ $defaultImgId = ( ! empty( $scMeta['default_preview_image'][0] ) ? absint( $scMeta['default_preview_image'][0] ) : null );
401
+ $customImgSize = ( ! empty( $scMeta['custom_image_size'] ) ? $scMeta['custom_image_size'] : array() );
402
+
403
+ $arg['scID'] = $scID;
404
+ $arg['items'] = isset( $scMeta['item_fields'] ) ? ( $scMeta['item_fields'] ? $scMeta['item_fields'] : array() ) : array();
405
+ if ( in_array( 'cf', $arg['items'] ) ) {
406
+ $arg['cf_group'] = array();
407
+ $arg['cf_group'] = get_post_meta( $scID, 'cf_group' );
408
+ $arg['format'] = array(
409
+ 'hide_empty' => get_post_meta( $scID, 'cf_hide_empty_value', true ),
410
+ 'show_value' => get_post_meta( $scID, 'cf_show_only_value', true ),
411
+ 'hide_group_title' => get_post_meta( $scID, 'cf_hide_group_title', true )
412
+ );
413
+ }
414
+
415
+ // Set readmore false if excerpt type = full content
416
+ if ( isset( $arg['excerpt_type'] ) && $arg['excerpt_type'] === 'full' && ( $key = array_search( 'read_more', $arg['items'] ) ) !== false ) {
417
+ unset( $arg['items'][ $key ] );
418
+ }
419
+
420
+ if ( ! empty( $scMeta['ignore_sticky_posts'][0] ) ) {
421
+ $args['ignore_sticky_posts'] = true;
422
+ } else {
423
+ $args['wp_tpg_is_home'] = true;
424
+ }
425
+
426
+ $filters = ! empty( $scMeta['tgp_filter'] ) ? $scMeta['tgp_filter'] : array();
427
+ $action_term = ! empty( $scMeta['tgp_default_filter'][0] ) ? absint( $scMeta['tgp_default_filter'][0] ) : 0;
428
+ $hide_all_button = ! empty( $scMeta['tpg_hide_all_button'][0] ) ? true : false;
429
+ if ( $taxHierarchical ) {
430
+ $terms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true, 0 );
431
+ } else {
432
+ $terms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true );
433
+ }
434
+ if ( $hide_all_button && ! $action_term ) {
435
+ if ( ! empty( $terms ) ) {
436
+ $allKeys = array_keys( $terms );
437
+ $action_term = $allKeys[0];
438
+ }
439
+ }
440
+ if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter && $action_term ) {
441
+ $args['tax_query'] = array(
442
+ array(
443
+ 'taxonomy' => $taxFilter,
444
+ 'field' => 'term_id',
445
+ 'terms' => array( $action_term ),
446
+ )
447
+ );
448
+ }
449
+
450
+ if ( $limit != - 1 && $pagination ) {
451
+ $tempArgs = $args;
452
+ $tempArgs['posts_per_page'] = $limit;
453
+ $tempArgs['paged'] = 1;
454
+ $tempArgs['fields'] = 'ids';
455
+ $tempQ = new WP_Query( $tempArgs );
456
+ if ( ! empty( $tempQ->posts ) ) {
457
+ $args['post__in'] = $tempQ->posts;
458
+ }
459
+ }
460
+
461
+ $arg['title_tag'] = (!empty($scMeta['title_tag'][0]) && in_array($scMeta['title_tag'][0], array_keys(rtTPG()->getTitleTags()))) ? esc_attr($scMeta['title_tag'][0]) : 'h3';
462
+
463
+ $gridQuery = new WP_Query( apply_filters( 'tpg_sc_query_args', $args, $scMeta ) );
464
+
465
+ // Start layout
466
+ $html .= rtTPG()->layoutStyle( $layoutID, $scMeta, $layout, $scID );
467
+ $containerDataAttr .= " data-sc-id='{$scID}'";
468
+ $html .= "<div class='rt-container-fluid rt-tpg-container {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
469
+ if ( !$isCarousel && isset($settings['tpg_load_script']) && isset($settings['tpg_enable_preloader'])) {
470
+ $html .= '<div id="bottom-script-loader"><div class="rt-ball-clip-rotate"><div></div></div></div>';
471
+ }
472
+ if ( ! empty( $filters ) && ( $isGrid || $isOffset || $isWooCom || $isEdd ) ) {
473
+ $html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
474
+ $selectedSubTermsForButton = null;
475
+ $allText = apply_filters( 'tpg_filter_all_text', __( "All", "the-post-grid" ), $scMeta );
476
+ if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter ) {
477
+ $filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
478
+ $post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
479
+ $postCountClass = ( $post_count ? " has-post-count" : null );
480
+ $allSelect = " selected";
481
+ $isTermSelected = false;
482
+ if ( $action_term && $taxFilter ) {
483
+ $isTermSelected = true;
484
+ $allSelect = null;
485
+ }
486
+ if ( ! $filterType || $filterType == 'dropdown' ) {
487
+ $html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
488
+ $termDefaultText = $allText;
489
+ $dataTerm = 'all';
490
+ $htmlButton = "";
491
+ $selectedSubTerms = null;
492
+ $pCount = 0;
493
+ if ( ! empty( $terms ) ) {
494
+ $i = 0;
495
+ foreach ( $terms as $id => $term ) {
496
+ $pCount = $pCount + $term['count'];
497
+ $sT = null;
498
+ if ( $taxHierarchical ) {
499
+ $subTerms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
500
+ if ( ! empty( $subTerms ) ) {
501
+ $count = 0;
502
+ $item = $allCount = null;
503
+ foreach ( $subTerms as $stId => $t ) {
504
+ $count = $count + absint( $t['count'] );
505
+ $sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
506
+ $item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
507
+ }
508
+ if ( $post_count ) {
509
+ $allCount = " (<span class='rt-post-count'>{$count}</span>)";
510
+ }
511
+ $sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
512
+ $sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
513
+ <span class='rt-text'>" . $allText . "{$allCount}</span>
514
+ <i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
515
+ </span>";
516
+ $sT .= '<span class="term-dropdown rt-filter-dropdown">';
517
+ $sT .= $item;
518
+ $sT .= '</span>';
519
+ $sT .= "</div>";
520
+ }
521
+ if ( $action_term === $id ) {
522
+ $selectedSubTerms = $sT;
523
+ }
524
+ }
525
+ $postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
526
+ if ( $action_term && $action_term == $id ) {
527
+ $termDefaultText = $term['name'] . $postCount;
528
+ $dataTerm = $id;
529
+ }
530
+ if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
531
+ if ( $taxFilterOperator == "NOT IN" ) {
532
+ if ( ! in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
533
+ $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
534
+ }
535
+ } else {
536
+ if ( in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
537
+ $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
538
+ }
539
+ }
540
+ } else {
541
+ $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
542
+ }
543
+ $i ++;
544
+ }
545
+ }
546
+ $pAllCount = null;
547
+ if ( $post_count ) {
548
+ $pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
549
+ if ( ! $action_term ) {
550
+ $termDefaultText = $termDefaultText . $pAllCount;
551
+ }
552
+ }
553
+ if ( ! $hide_all_button ) {
554
+ $htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . "{$pAllCount}</span></span>" . $htmlButton;
555
+ }
556
+ $htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
557
+
558
+ $showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
559
+ <span class="rt-text">' . $termDefaultText . '</span>
560
+ <i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
561
+ </span>';
562
+
563
+ $html .= $showAllhtml . $htmlButton;
564
+ $html .= '</div>' . $selectedSubTerms;
565
+ } else {
566
+ $termDefaultText = $allText;
567
+ $bCount = 0;
568
+ $bItems = null;
569
+ if ( ! empty( $terms ) ) {
570
+ foreach ( $terms as $id => $term ) {
571
+ $bCount = $bCount + absint( $term['count'] );
572
+ $sT = null;
573
+ if ( $taxHierarchical ) {
574
+ $subTerms = rtTPG()->rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
575
+ if ( ! empty( $subTerms ) ) {
576
+ $sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
577
+ foreach ( $subTerms as $stId => $t ) {
578
+ $sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
579
+ $sT .= "<span class='rt-filter-button-item' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
580
+ }
581
+ $sT .= "</div>";
582
+ if ( $action_term === $id ) {
583
+ $selectedSubTermsForButton = $sT;
584
+ }
585
+ }
586
+ }
587
+ $postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
588
+ $termSelected = null;
589
+ if ( $isTermSelected && $id == $action_term ) {
590
+ $termSelected = " selected";
591
+ }
592
+ if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
593
+ if ( $taxFilterOperator == "NOT IN" ) {
594
+ if ( ! in_array( $id, $taxFilterTerms ) ) {
595
+ $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
596
+ }
597
+ } else {
598
+ if ( in_array( $id, $taxFilterTerms ) ) {
599
+ $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
600
+ }
601
+ }
602
+
603
+ } else {
604
+ $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
605
+ }
606
+ }
607
+ }
608
+ $html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
609
+ if ( ! $hide_all_button ) {
610
+ $pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
611
+ $html .= "<span class='term-button-item rt-filter-button-item {$allSelect}' data-term='all'>" . $allText . "{$pCountH}</span>";
612
+ }
613
+ $html .= $bItems;
614
+ $html .= "</div>";
615
+ }
616
+ }
617
+
618
+ // Author filter
619
+ if ( in_array( '_author_filter', $filters ) ) {
620
+ $filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
621
+ $post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
622
+ $users = get_users( apply_filters( 'tpg_author_arg', array() ) );
623
+
624
+ $allSelect = " selected";
625
+ $isTermSelected = false;
626
+ if ( $action_term && $taxFilter ) {
627
+ $isTermSelected = true;
628
+ $allSelect = null;
629
+ }
630
+ if ( ! $filterType || $filterType == 'dropdown' ) {
631
+ $html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}'>";
632
+ $termDefaultText = $allText;
633
+ $dataAuthor = 'all';
634
+ $htmlButton = "";
635
+ $htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
636
+ if ( ! empty( $users ) ) {
637
+ foreach ( $users as $user ) {
638
+ if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
639
+ if ( in_array( $user->ID, $filterAuthors ) ) {
640
+ if ( $action_term == $user->ID ) {
641
+ $termDefaultText = $user->display_name;
642
+ $dataTerm = $user->ID;
643
+ } else {
644
+ $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name}</span>";
645
+ }
646
+ }
647
+ } else {
648
+ if ( $action_term == $user->ID ) {
649
+ $termDefaultText = $user->display_name;
650
+ $dataTerm = $user->ID;
651
+ } else {
652
+ $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name}</span>";
653
+ }
654
+ }
655
+ }
656
+ }
657
+
658
+ if ( $isTermSelected ) {
659
+ $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . "{$pAllCount}</span>";
660
+ }
661
+ $htmlButton .= '</span>';
662
+
663
+ $showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
664
+ <span class="rt-text">' . $termDefaultText . '</span>
665
+ <i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
666
+ </span>';
667
+
668
+ $html .= $showAllhtml . $htmlButton;
669
+ $html .= '</div>';
670
+ } else {
671
+ $bCount = 0;
672
+ $bItems = null;
673
+ if ( ! empty( $users ) ) {
674
+ foreach ( $users as $user ) {
675
+ if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
676
+ if ( in_array( $user->ID, $filterAuthors ) ) {
677
+ $bItems .= "<span class='author-button-item rt-filter-button-item data-author='{$user->ID}'>{$user->display_name}</span>";
678
+ }
679
+ } else {
680
+ $bItems .= "<span class='author-button-item rt-filter-button-item data-author='{$user->ID}'>{$user->display_name}</span>";
681
+ }
682
+ }
683
+ }
684
+ $html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
685
+ if ( ! $hide_all_button ) {
686
+ $pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
687
+ $html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "{$pCountH}</span>";
688
+ }
689
+ $html .= $bItems;
690
+ $html .= "</div>";
691
+ }
692
+ }
693
+
694
+ if ( in_array( '_sort_order', $filters ) ) {
695
+ $action_order = ( ! empty( $args['order'] ) ? strtoupper( trim( $args['order'] ) ) : "DESC" );
696
+ $html .= '<div class="rt-filter-item-wrap rt-sort-order-action">';
697
+ $html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'>&nbsp;<span></span></span>";
698
+ $html .= '</div>';
699
+ }
700
+
701
+ if ( in_array( '_order_by', $filters ) ) {
702
+ $wooFeature = ( $postType == "product" ? true : false );
703
+ $orders = rtTPG()->rtPostOrderBy( $wooFeature );
704
+ $action_orderby = ( ! empty( $args['orderby'] ) ? trim( $args['orderby'] ) : "none" );
705
+ if ( $action_orderby == 'none' ) {
706
+ $action_orderby_label = __( "Sort By None", "the-post-grid" );
707
+ } elseif ( in_array( $action_orderby, array_keys( rtTPG()->rtMetaKeyType() ) ) ) {
708
+ $action_orderby_label = __( "Meta value", "the-post-grid" );
709
+ } else {
710
+ $action_orderby_label = $orders[ $action_orderby ];
711
+ }
712
+ if ( $action_orderby !== 'none' ) {
713
+ $orders['none'] = __( "Sort By None", "the-post-grid" );
714
+ }
715
+ $html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
716
+ $html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
717
+ <span class='rt-text-order-by'>{$action_orderby_label}</span>
718
+ <i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
719
+ </span>";
720
+ $html .= '<span class="order-by-dropdown rt-filter-dropdown">';
721
+
722
+ foreach ( $orders as $orderKey => $order ) {
723
+ $html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
724
+ }
725
+ $html .= '</span>';
726
+ $html .= '</div>';
727
+ }
728
+
729
+ if ( in_array( '_search', $filters ) ) {
730
+ $html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
731
+ $html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__( "Search...", 'the-post-grid' ) );
732
+ $html .= "<span class='rt-action'>&#128269;</span>";
733
+ $html .= "<span class='rt-loading'></span>";
734
+ $html .= '</div>';
735
+ }
736
+ $html .= "</div>$selectedSubTermsForButton</div>";
737
+ }
738
+
739
+ $html .= "<div data-title='" . __( "Loading ...",
740
+ 'the-post-grid' ) . "' class='rt-row rt-content-loader {$layout}{$masonryG} {$preLoader}'>";
741
+
742
+ if ( $gridQuery->have_posts() ) {
743
+
744
+ if ( $isCarousel ) {
745
+ $cOpt = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : array();
746
+ $slider_js_options = apply_filters( 'rttpg_slider_js_options', array(
747
+ "speed" => ! empty( $scMeta['tpg_carousel_speed'][0] ) ? absint( $scMeta['tpg_carousel_speed'][0] ) : 250,
748
+ "autoPlayTimeOut" => ! empty( $scMeta['tpg_carousel_autoplay_timeout'][0] ) ? absint( $scMeta['tpg_carousel_autoplay_timeout'][0] ) : 5000,
749
+ "autoPlay" => in_array( 'auto_play', $cOpt ),
750
+ "stopOnHover" => in_array( 'stop_hover', $cOpt ),
751
+ "nav" => in_array( 'nav_button', $cOpt ),
752
+ "dots" => in_array( 'pagination', $cOpt ),
753
+ "loop" => in_array( 'loop', $cOpt ),
754
+ "lazyLoad" => in_array( 'lazyLoad', $cOpt ),
755
+ "autoHeight" => in_array( 'autoHeight', $cOpt ),
756
+ "rtl" => in_array( 'rtl', $cOpt )
757
+ ), $scMeta );
758
+ $html .= sprintf( '<div class="rt-carousel-holder" data-rtowl-options="%s">',
759
+ htmlspecialchars( wp_json_encode( $slider_js_options ) ) );
760
+ }
761
+ $isotope_filter = null;
762
+ if ( $isIsotope ) {
763
+ $isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
764
+ $isotope_dropdown_filter = isset( $scMeta['isotope_filter_dropdown'][0] ) ? $scMeta['isotope_filter_dropdown'][0] : null;
765
+ $selectedTerms = array();
766
+ if ( isset( $scMeta['post_filter'] ) && in_array( 'tpg_taxonomy',
767
+ $scMeta['post_filter'] ) && isset( $scMeta['tpg_taxonomy'] ) && in_array( $isotope_filter,
768
+ $scMeta['tpg_taxonomy'] )
769
+ ) {
770
+ $selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : array() );
771
+ }
772
+ $termArgs = [
773
+ 'taxonomy' => $isotope_filter,
774
+ 'orderby' => 'meta_value_num',
775
+ 'order' => 'ASC',
776
+ 'hide_empty' => false,
777
+ 'include' => $selectedTerms
778
+ ];
779
+ if ( rtTPG()->hasPro() ) {
780
+ $termArgs['meta_key'] = '_rt_order';
781
+ }
782
+ $terms = get_terms( $termArgs );
783
+
784
+ $html .= '<div class="tpg-iso-filter">';
785
+ $htmlButton = $drop = null;
786
+ $fSelectTrigger = false;
787
+
788
+ if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
789
+ foreach ( $terms as $term ) {
790
+ $tItem = ! empty( $scMeta['isotope_default_filter'][0] ) ? $scMeta['isotope_default_filter'][0] : null;
791
+ $fSelected = null;
792
+ if ( $tItem == $term->term_id ) {
793
+ $fSelected = 'selected';
794
+ $fSelectTrigger = true;
795
+ }
796
+ $htmlButton .= sprintf( '<button class="rt-iso-btn-%s%s" data-filter=".iso_%d">%s</button>',
797
+ esc_attr( $term->slug ),
798
+ $fSelected ? " " . $fSelected : '',
799
+ $term->term_id,
800
+ $term->name
801
+ );
802
+ $drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
803
+ }
804
+ }
805
+ if ( empty( $scMeta['isotope_filter_show_all'][0] ) ) {
806
+ $fSelect = ( $fSelectTrigger ? null : 'class="selected"' );
807
+ $htmlButton = "<button class='rt-iso-btn-all selected' data-filter='*'>" . $arg['show_all_text'] . "</button>" . $htmlButton;
808
+ $drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
809
+ }
810
+ $filter_count = ! empty( $scMeta['isotope_filter_count'][0] ) ? true : false;
811
+ $filter_url = ! empty( $scMeta['isotope_filter_url'][0] ) ? true : false;
812
+ $htmlButton = "<div id='iso-button-{$rand}' class='rt-tpg-isotope-buttons button-group filter-button-group option-set' data-url='{$filter_url}' data-count='{$filter_count}'>{$htmlButton}</div>";
813
+
814
+ if ( $isotope_dropdown_filter ) {
815
+ $html .= "<select class='isotope-dropdown-filter'>{$drop}</select>";
816
+ } else {
817
+ $html .= $htmlButton;
818
+ }
819
+ if ( ! empty( $scMeta['isotope_search_filter'][0] ) ) {
820
+ $html .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" . __( 'Search',
821
+ 'the-post-grid' ) . "' /></div>";
822
+ }
823
+ $html .= '</div>';
824
+
825
+ $html .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
826
+ }
827
+
828
+ $l = $offLoop = 0;
829
+ $offsetBigHtml = $offsetSmallHtml = null;
830
+
831
+ while ( $gridQuery->have_posts() ) : $gridQuery->the_post();
832
+ if ( $colStore == $l ) {
833
+ if ( $this->l4toggle ) {
834
+ $this->l4toggle = false;
835
+ } else {
836
+ $this->l4toggle = true;
837
+ }
838
+ $l = 0;
839
+ }
840
+ $pID = get_the_ID();
841
+ $arg['pID'] = $pID;
842
+ $arg['title'] = rtTPG()->get_the_title( $pID, $arg );
843
+ $arg['pLink'] = get_permalink();
844
+ $arg['toggle'] = $this->l4toggle;
845
+ $arg['layoutID'] = $layoutID;
846
+ $arg['author'] = apply_filters( 'rttpg_author_link', sprintf( '<a href="%s">%s</a>', get_author_posts_url( get_the_author_meta( 'ID' ) ), get_the_author() ) );
847
+ $cc = wp_count_comments( $pID );
848
+ $arg['date'] = get_the_date();
849
+ $arg['excerpt'] = rtTPG()->get_the_excerpt( $pID, $arg );
850
+ $arg['categories'] = get_the_term_list( $pID, 'category', null, '<span class="rt-separator">,</span>' );
851
+ $arg['tags'] = get_the_term_list( $pID, 'post_tag', null, '<span class="rt-separator">,</span>' );
852
+ if ( $isIsotope ) {
853
+ $termAs = wp_get_post_terms( $pID, $isotope_filter, array( "fields" => "all" ) );
854
+ $isoFilter = [];
855
+ if ( ! empty( $termAs ) ) {
856
+ foreach ( $termAs as $term ) {
857
+ $isoFilter[] = "iso_" . $term->term_id;
858
+ $isoFilter[] = "rt-item-" . esc_attr( $term->slug );
859
+ }
860
+ }
861
+ $arg['isoFilter'] = ! empty( $isoFilter ) ? implode( " ", $isoFilter ) : '';
862
+ }
863
+ if ( comments_open() ) {
864
+ $arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$cc->total_comments} </a>";
865
+ } else {
866
+ $arg['comment'] = "{$cc->total_comments}";
867
+ }
868
+ $imgSrc = null;
869
+
870
+ if ( $isOffset ) {
871
+ if ( $offLoop == 0 ) {
872
+ $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, $fImgSize, $mediaSource,
873
+ $defaultImgId,
874
+ $customImgSize ) : null;
875
+ $arg['offset'] = 'big';
876
+ $offsetBigHtml = rtTPG()->render( 'layouts/' . $layout, $arg, true );
877
+ } else {
878
+ $arg['offset'] = 'small';
879
+ $arg['offsetCol'] = array( $dCol, $tCol, $mCol );
880
+ $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, 'thumbnail',
881
+ $mediaSource,
882
+ $defaultImgId,
883
+ $customImgSize ) : null;
884
+ $offsetSmallHtml .= rtTPG()->render( 'layouts/' . $layout, $arg, true );
885
+ }
886
+ } else {
887
+ $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, $fImgSize, $mediaSource,
888
+ $defaultImgId,
889
+ $customImgSize ) : null;
890
+ $html .= rtTPG()->render( 'layouts/' . $layout, $arg, true );
891
+ }
892
+ $offLoop ++;
893
+ $l ++;
894
+ endwhile;
895
+ if ( $isOffset ) {
896
+ $oDCol = rtTPG()->get_offset_col( $dCol );
897
+ $oTCol = rtTPG()->get_offset_col( $tCol );
898
+ $oMCol = rtTPG()->get_offset_col( $mCol );
899
+ if ( $layout == "offset03" || $layout == "offset04" ) {
900
+ $oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
901
+ $oMCol['big'] = $oMCol['small'] = 12;
902
+ }
903
+ $html .= "<div class='rt-col-md-{$oDCol['big']} rt-col-sm-{$oTCol['big']} rt-col-xs-{$oMCol['big']}'><div class='rt-row'>{$offsetBigHtml}</div></div>";
904
+ $html .= "<div class='rt-col-md-{$oDCol['small']} rt-col-sm-{$oTCol['small']} rt-col-xs-{$oMCol['small']}'><div class='rt-row offset-small-wrap'>{$offsetSmallHtml}</div></div>";
905
+ }
906
+ if ( $isIsotope || $isCarousel ) {
907
+ $html .= '</div>'; // End isotope / Carousel item holder
908
+ }
909
+
910
+ } else {
911
+ $not_found_text = isset( $scMeta['tgp_not_found_text'][0] ) && ! empty( $scMeta['tgp_not_found_text'][0] ) ? esc_attr( $scMeta['tgp_not_found_text'][0] ) : __( 'No post found', 'the-post-grid' );
912
+ $html .= sprintf( '<p>%s</p>',
913
+ apply_filters( 'tpg_not_found_text', $not_found_text, $args, $scMeta )
914
+ );
915
+ }
916
+ $html .= $preLoaderHtml;
917
+ $html .= "</div>"; // End row
918
+ $htmlUtility = null;
919
+ if ( $pagination && ! $isCarousel ) {
920
+ if ( $isOffset ) {
921
+ $posts_loading_type = "page_prev_next";
922
+ $htmlUtility .= "<div class='rt-cb-page-prev-next'>
923
+ <span class='rt-cb-prev-btn'><i class='fa fa-angle-left' aria-hidden='true'></i></span>
924
+ <span class='rt-cb-next-btn'><i class='fa fa-angle-right' aria-hidden='true'></i></span>
925
+ </div>";
926
+ } else {
927
+ $hide = ( $gridQuery->max_num_pages < 2 ? " rt-hidden-elm" : null );
928
+ if ( $posts_loading_type == "pagination" ) {
929
+ if ( $isGrid && empty( $filters ) ) {
930
+ $htmlUtility .= rtTPG()->rt_pagination( $gridQuery,
931
+ $args['posts_per_page'] );
932
+ }
933
+ } elseif ( $posts_loading_type == "pagination_ajax" && ! $isIsotope ) {
934
+ $htmlUtility .= "<div class='rt-page-numbers'></div>";
935
+ } elseif ( $posts_loading_type == "load_more" && rtTPG()->hasPro() ) {
936
+ $htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
937
+ <span class='rt-loadmore-text'>" . __( 'Load More', 'the-post-grid' ) . "</span>
938
+ <div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
939
+ </div>";
940
+
941
+ } elseif ( $posts_loading_type == "load_on_scroll" && rtTPG()->hasPro() ) {
942
+ $htmlUtility .= "<div class='rt-infinite-action'>
943
+ <div class='rt-infinite-loading la-fire la-2x'>
944
+ <div></div>
945
+ <div></div>
946
+ <div></div>
947
+ </div>
948
+ </div>";
949
+ }
950
+ }
951
+ }
952
+
953
+ if ( $htmlUtility ) {
954
+ $l4toggle = null;
955
+ if ( $layout == "layout4" ) {
956
+ $l4toggle = "data-l4toggle='{$this->l4toggle}'";
957
+ }
958
+ $html .= "<div class='rt-pagination-wrap' data-total-pages='{$gridQuery->max_num_pages}' data-posts-per-page='{$args['posts_per_page']}' data-type='{$posts_loading_type}' {$l4toggle} >" . $htmlUtility . "</div>";
959
+ }
960
+
961
+ $html .= "</div>"; // container rt-tpg
962
+
963
+ wp_reset_postdata();
964
+
965
+ $scriptGenerator = array();
966
+ $scriptGenerator['layout'] = $layoutID;
967
+ $scriptGenerator['rand'] = $rand;
968
+ $scriptGenerator['scMeta'] = $scMeta;
969
+ $scriptGenerator['isCarousel'] = $isCarousel;
970
+ $scriptGenerator['isSinglePopUp'] = $isSinglePopUp;
971
+ $scriptGenerator['isWooCom'] = $isWooCom;
972
+ $this->scA[] = $scriptGenerator;
973
+ add_action( 'wp_footer', array( $this, 'register_sc_scripts' ) );
974
+ } else {
975
+ $html .= "<p>" . __( "No shortCode found", "the-post-grid" ) . "</p>";
976
+ }
977
+
978
+ //restriction issue
979
+ $restriction = ( ! empty( $scMeta['restriction_user_role'] ) ? $scMeta['restriction_user_role'] : array() );
980
+ if ( ! empty( $restriction ) ) {
981
+ if ( is_user_logged_in() ) {
982
+ $currentUserRoles = rtTPG()->getCurrentUserRoles();
983
+ if ( in_array( 'administrator', $currentUserRoles ) ) {
984
+ $html = $html;
985
+ } else {
986
+ if ( count( array_intersect( $restriction, $currentUserRoles ) ) ) {
987
+ $html = $html;
988
+ } else {
989
+ $html = "<p>" . __( "You are not permitted to view this content.",
990
+ "the-post-grid" ) . "</p>";
991
+ }
992
+ }
993
+
994
+ } else {
995
+ $html = "<p>" . __( "This is a restricted content, you need to logged in to view this content.",
996
+ "the-post-grid" ) . "</p>";
997
+ }
998
+ }
999
+
1000
+ return $html;
1001
+ }
1002
+
1003
+ public function order_by_popularity_post_clauses( $args ) {
1004
+ global $wpdb;
1005
+ $args['orderby'] = "$wpdb->postmeta.meta_value+0 DESC, $wpdb->posts.post_date DESC";
1006
+
1007
+ return $args;
1008
+ }
1009
+ }
1010
+ endif;
lib/models/rtTPGField.php CHANGED
@@ -107,6 +107,10 @@ if ( ! class_exists( 'rtTPGField' ) ):
107
  $html .= $this->checkbox();
108
  break;
109
 
 
 
 
 
110
  case 'radio':
111
  $html .= $this->radioField();
112
  break;
@@ -327,6 +331,14 @@ if ( ! class_exists( 'rtTPGField' ) ):
327
  return $h;
328
  }
329
 
 
 
 
 
 
 
 
 
330
  private function radioField() {
331
  $holderClass = explode(' ', $this->holderClass);
332
  $atts = (in_array('pro-field', $holderClass)) && !rtTPG()->hasPro() ? 'disabled="true"' : '';
107
  $html .= $this->checkbox();
108
  break;
109
 
110
+ case 'switch':
111
+ $html .= $this->switchField();
112
+ break;
113
+
114
  case 'radio':
115
  $html .= $this->radioField();
116
  break;
331
  return $h;
332
  }
333
 
334
+ private function switchField() {
335
+ $h = null;
336
+ $checked = ( $this->value ? "checked" : null );
337
+ $h .= "<label class='rttm-switch'><input type='checkbox' {$checked} id='{$this->id}' name='{$this->name}' value='1' /><span class='rttm-switch-slider round'></span></label>";
338
+
339
+ return $h;
340
+ }
341
+
342
  private function radioField() {
343
  $holderClass = explode(' ', $this->holderClass);
344
  $atts = (in_array('pro-field', $holderClass)) && !rtTPG()->hasPro() ? 'disabled="true"' : '';
the-post-grid.php CHANGED
@@ -4,7 +4,7 @@
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: 3.0.3
8
  * Text Domain: the-post-grid
9
  * Domain Path: /languages
10
  * Author URI: https://radiustheme.com/
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: 3.0.4
8
  * Text Domain: the-post-grid
9
  * Domain Path: /languages
10
  * Author URI: https://radiustheme.com/