The Post Grid - Version 3.0.2

Version Description

  • Fixed pagination issue
  • Fixed shortcode title tag issue
Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

README.txt CHANGED
@@ -4,7 +4,7 @@ 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.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -141,6 +141,10 @@ For any bug or suggestion please mail support@radiustheme.com
141
 
142
  == Changelog ==
143
 
 
 
 
 
144
  = 3.0.1 =
145
  * Fixed isotope masonry issue
146
 
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.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
141
 
142
  == Changelog ==
143
 
144
+ = 3.0.2 =
145
+ * Fixed pagination issue
146
+ * Fixed shortcode title tag issue
147
+
148
  = 3.0.1 =
149
  * Fixed isotope masonry issue
150
 
assets/css/admin.css CHANGED
@@ -115,6 +115,10 @@ ul.rt-tab-nav li {
115
  margin-bottom: -1px;
116
  }
117
 
 
 
 
 
118
  ul.rt-tab-nav li:focus {
119
  outline: none;
120
  }
115
  margin-bottom: -1px;
116
  }
117
 
118
+ ul.rt-tab-nav li:nth-child(4) {
119
+ margin-right: 3px;
120
+ }
121
+
122
  ul.rt-tab-nav li:focus {
123
  outline: none;
124
  }
assets/css/thepostgrid.css CHANGED
@@ -1217,18 +1217,30 @@ body > .rt-tooltip .rt-tooltip-bottom:after {
1217
  padding: 15px 0 0;
1218
  }
1219
 
 
1220
  .rt-tpg-container .layout1 .rt-holder .rt-detail h3,
 
 
1221
  .rt-tpg-container .isotope1 .rt-holder .rt-detail h3,
1222
- .rt-tpg-container .carousel1 .rt-holder .rt-detail h3 {
 
 
 
1223
  font-size: 26px;
1224
  line-height: 1.25;
1225
  margin: 0 0 18px;
1226
  font-weight: 400;
1227
  }
1228
 
 
1229
  .rt-tpg-container .layout1 .rt-holder .rt-detail.rt-with-title h3,
 
 
1230
  .rt-tpg-container .isotope1 .rt-holder .rt-detail.rt-with-title h3,
1231
- .rt-tpg-container .carousel1 .rt-holder .rt-detail.rt-with-title h3 {
 
 
 
1232
  margin-bottom: 5px;
1233
  }
1234
 
@@ -1293,7 +1305,9 @@ body > .rt-tooltip .rt-tooltip-bottom:after {
1293
  transform: scale(1.1);
1294
  }
1295
 
1296
- .rt-tpg-container .layout2 .rt-holder .rt-detail h3 {
 
 
1297
  font-size: 26px;
1298
  line-height: 1.25;
1299
  margin: 0px 0 15px 0;
@@ -1343,7 +1357,9 @@ body > .rt-tooltip .rt-tooltip-bottom:after {
1343
  margin-bottom: 20px;
1344
  }
1345
 
1346
- .rt-tpg-container .layout3 .rt-holder .rt-detail h3 {
 
 
1347
  font-size: 26px;
1348
  margin: 0px 0 18px 0;
1349
  line-height: 1.25;
1217
  padding: 15px 0 0;
1218
  }
1219
 
1220
+ .rt-tpg-container .layout1 .rt-holder .rt-detail h2,
1221
  .rt-tpg-container .layout1 .rt-holder .rt-detail h3,
1222
+ .rt-tpg-container .layout1 .rt-holder .rt-detail h4,
1223
+ .rt-tpg-container .isotope1 .rt-holder .rt-detail h2,
1224
  .rt-tpg-container .isotope1 .rt-holder .rt-detail h3,
1225
+ .rt-tpg-container .isotope1 .rt-holder .rt-detail h4,
1226
+ .rt-tpg-container .carousel1 .rt-holder .rt-detail h2,
1227
+ .rt-tpg-container .carousel1 .rt-holder .rt-detail h3,
1228
+ .rt-tpg-container .carousel1 .rt-holder .rt-detail h4 {
1229
  font-size: 26px;
1230
  line-height: 1.25;
1231
  margin: 0 0 18px;
1232
  font-weight: 400;
1233
  }
1234
 
1235
+ .rt-tpg-container .layout1 .rt-holder .rt-detail.rt-with-title h2,
1236
  .rt-tpg-container .layout1 .rt-holder .rt-detail.rt-with-title h3,
1237
+ .rt-tpg-container .layout1 .rt-holder .rt-detail.rt-with-title h4,
1238
+ .rt-tpg-container .isotope1 .rt-holder .rt-detail.rt-with-title h2,
1239
  .rt-tpg-container .isotope1 .rt-holder .rt-detail.rt-with-title h3,
1240
+ .rt-tpg-container .isotope1 .rt-holder .rt-detail.rt-with-title h4,
1241
+ .rt-tpg-container .carousel1 .rt-holder .rt-detail.rt-with-title h2,
1242
+ .rt-tpg-container .carousel1 .rt-holder .rt-detail.rt-with-title h3,
1243
+ .rt-tpg-container .carousel1 .rt-holder .rt-detail.rt-with-title h4 {
1244
  margin-bottom: 5px;
1245
  }
1246
 
1305
  transform: scale(1.1);
1306
  }
1307
 
1308
+ .rt-tpg-container .layout2 .rt-holder .rt-detail h2,
1309
+ .rt-tpg-container .layout2 .rt-holder .rt-detail h3,
1310
+ .rt-tpg-container .layout2 .rt-holder .rt-detail h4 {
1311
  font-size: 26px;
1312
  line-height: 1.25;
1313
  margin: 0px 0 15px 0;
1357
  margin-bottom: 20px;
1358
  }
1359
 
1360
+ .rt-tpg-container .layout3 .rt-holder .rt-detail h2,
1361
+ .rt-tpg-container .layout3 .rt-holder .rt-detail h3,
1362
+ .rt-tpg-container .layout3 .rt-holder .rt-detail h4 {
1363
  font-size: 26px;
1364
  margin: 0px 0 18px 0;
1365
  line-height: 1.25;
assets/js/admin.js CHANGED
@@ -402,13 +402,46 @@
402
  }
403
  }
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
 
406
  function setDefaultItems() {
407
  var target_from = $("#rt-tpg-sc-isotope-filter"),
408
  target = $("#rt-tpg-sc-isotope-default-filter"),
409
  $fId = target_from.val();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  if ($fId) {
411
- var data = 'action=defaultFilterItem&filter=' + $fId + "&rttpg_nonce=" + rttpg.nonce;
412
  $.ajax({
413
  type: "post",
414
  url: rttpg.ajaxurl,
@@ -439,8 +472,28 @@
439
  var target_from = $("#tgp_filter_taxonomy"),
440
  target = $('#tgp_default_filter'),
441
  $fId = target_from.val();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  if ($fId) {
443
- var data = 'action=defaultFilterItem&filter=' + $fId + "&rttpg_nonce=" + rttpg.nonce;
444
  $.ajax({
445
  type: "post",
446
  url: rttpg.ajaxurl,
402
  }
403
  }
404
 
405
+ $('#term_category_holder select').on('change', function (e) {
406
+ setDefaultItems();
407
+ if ($("#tgp_filter-_taxonomy_filter").is(':checked')) {
408
+ setDefaultItemsForFilter();
409
+ }
410
+ });
411
+
412
+ $('#term_post_tag_holder select').on('change', function (e) {
413
+ setDefaultItems();
414
+ if ($("#tgp_filter-_taxonomy_filter").is(':checked')) {
415
+ setDefaultItemsForFilter();
416
+ }
417
+ });
418
 
419
  function setDefaultItems() {
420
  var target_from = $("#rt-tpg-sc-isotope-filter"),
421
  target = $("#rt-tpg-sc-isotope-default-filter"),
422
  $fId = target_from.val();
423
+
424
+ var $term = [];
425
+
426
+ if ($fId == 'category') {
427
+ if ($('#term_category_holder').length && $('#post-taxonomy-category')) {
428
+ var selected_term = $('#term_category_holder select').select2('data');
429
+ selected_term.forEach(function (element){
430
+ $term.push(element.id);
431
+ });
432
+ }
433
+ } else if ($fId == 'post_tag') {
434
+ $term = [];
435
+ if ($('#term_post_tag_holder').length && $('#post-taxonomy-post_tag')) {
436
+ var selected_term = $('#term_post_tag_holder select').select2('data');
437
+ selected_term.forEach(function (element){
438
+ $term.push(element.id);
439
+ });
440
+ }
441
+ }
442
+
443
  if ($fId) {
444
+ var data = 'action=defaultFilterItem&filter=' + $fId + '&include=' + $term + "&rttpg_nonce=" + rttpg.nonce;
445
  $.ajax({
446
  type: "post",
447
  url: rttpg.ajaxurl,
472
  var target_from = $("#tgp_filter_taxonomy"),
473
  target = $('#tgp_default_filter'),
474
  $fId = target_from.val();
475
+
476
+ var $term = [];
477
+
478
+ if ($fId == 'category') {
479
+ if ($('#term_category_holder').length && $('#post-taxonomy-category')) {
480
+ var selected_term = $('#term_category_holder select').select2('data');
481
+ selected_term.forEach(function (element){
482
+ $term.push(element.id);
483
+ });
484
+ }
485
+ } else if ($fId == 'post_tag') {
486
+ $term = [];
487
+ if ($('#term_post_tag_holder').length && $('#post-taxonomy-post_tag')) {
488
+ var selected_term = $('#term_post_tag_holder select').select2('data');
489
+ selected_term.forEach(function (element){
490
+ $term.push(element.id);
491
+ });
492
+ }
493
+ }
494
+
495
  if ($fId) {
496
+ var data = 'action=defaultFilterItem&filter=' + $fId + '&include=' + $term + "&rttpg_nonce=" + rttpg.nonce;
497
  $.ajax({
498
  type: "post",
499
  url: rttpg.ajaxurl,
languages/the-post-grid.pot CHANGED
@@ -29,39 +29,39 @@ msgstr ""
29
  msgid "Server Error !!"
30
  msgstr ""
31
 
32
- #: ../lib/classes/rtTPGAjaxResponse.php:67, ../lib/classes/rtTPGAjaxResponse.php:94, ../lib/classes/rtTPGPreview.php:938
33
  msgid "Session Error !!"
34
  msgstr ""
35
 
36
- #: ../lib/classes/rtTPGAjaxResponse.php:57
37
  msgid "Success"
38
  msgstr ""
39
 
40
- #: ../lib/classes/rtTPGAjaxResponse.php:58, ../lib/classes/rtTPGOptions.php:352
41
  msgid "Show All"
42
  msgstr ""
43
 
44
- #: ../lib/classes/rtTPGAjaxResponse.php:89
45
  msgid "Settings successfully updated"
46
  msgstr ""
47
 
48
- #: ../lib/classes/rtTPGAjaxResponse.php:125, ../lib/classes/rtTPGAjaxResponse.php:144, ../lib/classes/rtTPGAjaxResponse.php:185
49
  msgid "Security error"
50
  msgstr ""
51
 
52
- #: ../lib/classes/rtTPGAjaxResponse.php:121
53
  msgid "<div class=\"field-holder\">No Taxonomy found</div>"
54
  msgstr ""
55
 
56
- #: ../lib/classes/rtTPGAjaxResponse.php:211
57
  msgid "No shortCode found."
58
  msgstr ""
59
 
60
- #: ../lib/classes/rtTPGAjaxResponse.php:200
61
  msgid "Select Short code"
62
  msgstr ""
63
 
64
- #: ../lib/classes/rtTPGAjaxResponse.php:202, ../lib/classes/rtTPGOptions.php:776, ../lib/classes/rtTPGOptions.php:788
65
  msgid "Default"
66
  msgstr ""
67
 
@@ -181,7 +181,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:655, ../lib/classes/rtTPGShortCode.php:702
185
  msgid "Meta value"
186
  msgstr ""
187
 
@@ -309,95 +309,99 @@ msgstr ""
309
  msgid "Excerpt Type"
310
  msgstr ""
311
 
312
- #: ../lib/classes/rtTPGOptions.php:769
 
 
 
 
313
  msgid "Read more button border radius"
314
  msgstr ""
315
 
316
- #: ../lib/classes/rtTPGOptions.php:770
317
  msgid "Leave it blank for default"
318
  msgstr ""
319
 
320
- #: ../lib/classes/rtTPGOptions.php:775
321
  msgid "Read more button alignment"
322
  msgstr ""
323
 
324
- #: ../lib/classes/rtTPGOptions.php:778
325
  msgid "Left"
326
  msgstr ""
327
 
328
- #: ../lib/classes/rtTPGOptions.php:779
329
  msgid "Right"
330
  msgstr ""
331
 
332
- #: ../lib/classes/rtTPGOptions.php:780
333
  msgid "Center"
334
  msgstr ""
335
 
336
- #: ../lib/classes/rtTPGOptions.php:785
337
  msgid "Title Position (Above or Below image)"
338
  msgstr ""
339
 
340
- #: ../lib/classes/rtTPGOptions.php:790
341
  msgid "Above image"
342
  msgstr ""
343
 
344
- #: ../lib/classes/rtTPGOptions.php:791
345
  msgid "Below image"
346
  msgstr ""
347
 
348
- #: ../lib/classes/rtTPGOptions.php:793
349
  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>"
350
  msgstr ""
351
 
352
- #: ../lib/classes/rtTPGOptions.php:876
353
  msgid "Character"
354
  msgstr ""
355
 
356
- #: ../lib/classes/rtTPGOptions.php:877
357
  msgid "Word"
358
  msgstr ""
359
 
360
- #: ../lib/classes/rtTPGOptions.php:880
361
  msgid "Full Content"
362
  msgstr ""
363
 
364
- #: ../lib/classes/rtTPGOptions.php:899
365
  msgid "Taxonomy filter"
366
  msgstr ""
367
 
368
- #: ../lib/classes/rtTPGOptions.php:900
369
  msgid "Author filter"
370
  msgstr ""
371
 
372
- #: ../lib/classes/rtTPGOptions.php:901
373
  msgid "Order - Sort retrieved posts by parameter"
374
  msgstr ""
375
 
376
- #: ../lib/classes/rtTPGOptions.php:902
377
  msgid "Sort Order - Designates the ascending or descending order of the \"orderby\" parameter"
378
  msgstr ""
379
 
380
- #: ../lib/classes/rtTPGOptions.php:903
381
  msgid "Search filter"
382
  msgstr ""
383
 
384
- #: ../lib/classes/rtTPGOptions.php:923
385
  msgid "Layout 1"
386
  msgstr ""
387
 
388
- #: ../lib/classes/rtTPGOptions.php:924
389
  msgid "Layout 2"
390
  msgstr ""
391
 
392
- #: ../lib/classes/rtTPGOptions.php:925
393
  msgid "Layout 3"
394
  msgstr ""
395
 
396
- #: ../lib/classes/rtTPGOptions.php:926
397
  msgid "Isotope Layout"
398
  msgstr ""
399
 
400
- #: ../lib/classes/rtTPGOptions.php:1051
401
  msgid "Get Pro Version"
402
  msgstr ""
403
 
@@ -405,43 +409,43 @@ msgstr ""
405
  msgid "Read More"
406
  msgstr ""
407
 
408
- #: ../lib/classes/rtTPGPreview.php:419, ../lib/classes/rtTPGShortCode.php:469
409
  msgid "All"
410
  msgstr ""
411
 
412
- #: ../lib/classes/rtTPGPreview.php:653, ../lib/classes/rtTPGPreview.php:660, ../lib/classes/rtTPGShortCode.php:700, ../lib/classes/rtTPGShortCode.php:707
413
  msgid "Sort By None"
414
  msgstr ""
415
 
416
- #: ../lib/classes/rtTPGPreview.php:678, ../lib/classes/rtTPGShortCode.php:725
417
  msgid "Search..."
418
  msgstr ""
419
 
420
- #: ../lib/classes/rtTPGPreview.php:686, ../lib/classes/rtTPGShortCode.php:733
421
  msgid "Loading ..."
422
  msgstr ""
423
 
424
- #: ../lib/classes/rtTPGPreview.php:867, ../lib/classes/rtTPGShortCode.php:905
425
  msgid "No post found"
426
  msgstr ""
427
 
428
- #: ../lib/classes/rtTPGPreview.php:770, ../lib/classes/rtTPGShortCode.php:814
429
  msgid "Search"
430
  msgstr ""
431
 
432
- #: ../lib/classes/rtTPGPreview.php:901, ../lib/classes/rtTPGPreview.php:896, ../lib/classes/rtTPGShortCode.php:931
433
  msgid "Load More"
434
  msgstr ""
435
 
436
- #: ../lib/classes/rtTPGShortCode.php:969
437
  msgid "No shortCode found"
438
  msgstr ""
439
 
440
- #: ../lib/classes/rtTPGShortCode.php:989
441
  msgid "This is a restricted content, you need to logged in to view this content."
442
  msgstr ""
443
 
444
- #: ../lib/classes/rtTPGShortCode.php:983
445
  msgid "You are not permitted to view this content."
446
  msgstr ""
447
 
@@ -473,7 +477,7 @@ msgstr ""
473
  msgid "Select post grid"
474
  msgstr ""
475
 
476
- #: ../lib/views/settings/post-source.php:139
477
  msgid "If \"Meta value\", \"Meta value Number\" or \"Meta value datetime\" is chosen then meta key is required."
478
  msgstr ""
479
 
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
 
36
+ #: ../lib/classes/rtTPGAjaxResponse.php:61
37
  msgid "Success"
38
  msgstr ""
39
 
40
+ #: ../lib/classes/rtTPGAjaxResponse.php:62, ../lib/classes/rtTPGOptions.php:352
41
  msgid "Show All"
42
  msgstr ""
43
 
44
+ #: ../lib/classes/rtTPGAjaxResponse.php:93
45
  msgid "Settings successfully updated"
46
  msgstr ""
47
 
48
+ #: ../lib/classes/rtTPGAjaxResponse.php:129, ../lib/classes/rtTPGAjaxResponse.php:148, ../lib/classes/rtTPGAjaxResponse.php:189
49
  msgid "Security error"
50
  msgstr ""
51
 
52
+ #: ../lib/classes/rtTPGAjaxResponse.php:125
53
  msgid "<div class=\"field-holder\">No Taxonomy found</div>"
54
  msgstr ""
55
 
56
+ #: ../lib/classes/rtTPGAjaxResponse.php:215
57
  msgid "No shortCode found."
58
  msgstr ""
59
 
60
+ #: ../lib/classes/rtTPGAjaxResponse.php:204
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
 
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
 
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
 
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
 
477
  msgid "Select post grid"
478
  msgstr ""
479
 
480
+ #: ../lib/views/settings/post-source.php:140
481
  msgid "If \"Meta value\", \"Meta value Number\" or \"Meta value datetime\" is chosen then meta key is required."
482
  msgstr ""
483
 
lib/classes/rtTPGAjaxResponse.php CHANGED
@@ -53,10 +53,14 @@ if (!class_exists('rtTPGAjaxResponse')):
53
  $data = $msg = null;
54
  if (rtTPG()->verifyNonce()) {
55
  if ($filter = $_REQUEST['filter']) {
 
 
 
 
56
  $error = false;
57
  $msg = __('Success', 'the-post-grid');
58
  $data .= "<option value=''>" . __('Show All', 'the-post-grid') . "</option>";
59
- $items = rtTPG()->rt_get_all_term_by_taxonomy($filter, '', 0);
60
  if (!empty($items)) {
61
  foreach ($items as $id => $item) {
62
  $data .= "<option value='{$id}'>{$item}</option>";
53
  $data = $msg = null;
54
  if (rtTPG()->verifyNonce()) {
55
  if ($filter = $_REQUEST['filter']) {
56
+ $include = [];
57
+ if(isset($_REQUEST['include']) && $term = $_REQUEST['include']) {
58
+ $include = explode(',', $term);
59
+ }
60
  $error = false;
61
  $msg = __('Success', 'the-post-grid');
62
  $data .= "<option value=''>" . __('Show All', 'the-post-grid') . "</option>";
63
+ $items = rtTPG()->rt_get_selected_term_by_taxonomy($filter, $include, '', 0);
64
  if (!empty($items)) {
65
  foreach ($items as $id => $item) {
66
  $data .= "<option value='{$id}'>{$item}</option>";
lib/classes/rtTPGHelper.php CHANGED
@@ -74,6 +74,46 @@ if (!class_exists('rtTPGHelper')):
74
  return $terms;
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  function getCurrentUserRoles() {
78
  global $current_user;
79
 
@@ -459,7 +499,7 @@ if (!class_exists('rtTPGHelper')):
459
 
460
  if ($mediaSource == 'feature_image') {
461
  if ($aID = get_post_thumbnail_id($post_id)) {
462
- $image = wp_get_attachment_image($aID, $fImgSize, '', ['class' => $img_class]);
463
  $imgSrc = wp_get_attachment_image_src($aID, $fImgSize);
464
  $imgSrc = $imgSrc[0];
465
  }
@@ -1085,7 +1125,18 @@ if (!class_exists('rtTPGHelper')):
1085
  // Title decoration
1086
 
1087
  if ($title_color || $title_size || $title_weight || $title_alignment) {
1088
- $css .= "#{$layoutID} .{$layout} .rt-holder h3.entry-title,#{$layoutID} .{$layout} .rt-holder h3.entry-title a,#{$layoutID} .rt-holder .rt-woo-info h3 a,#{$layoutID} .rt-holder .rt-woo-info h3{";
 
 
 
 
 
 
 
 
 
 
 
1089
  if ($title_color) {
1090
  $css .= "color:" . $title_color . ";";
1091
  }
@@ -1103,10 +1154,18 @@ if (!class_exists('rtTPGHelper')):
1103
 
1104
  // Title hover color
1105
  if ($title_hover_color) {
1106
- $css .= "#{$layoutID} .{$layout} .rt-holder h3.entry-title:hover,
 
 
 
1107
  #{$layoutID} .{$layout} .rt-holder h3.entry-title a:hover,
 
 
1108
  #{$layoutID} .rt-holder .rt-woo-info h3 a:hover,
1109
- #{$layoutID} .rt-holder .rt-woo-info h3:hover{";
 
 
 
1110
  $css .= "color:" . $title_hover_color . " !important;";
1111
  $css .= "}";
1112
  }
@@ -1137,7 +1196,7 @@ if (!class_exists('rtTPGHelper')):
1137
  $css .= "}";
1138
  }
1139
 
1140
- $css .= "#{$layoutID} .{$layout} .rt-holder .post-meta-user,#{$layoutID} .{$layout} .rt-holder .post-meta-user .meta-data, #{$layoutID} .{$layout} .rt-holder .post-meta-user a{";
1141
  if ($meta_data_color) {
1142
  $css .= "color:" . $meta_data_color . ";";
1143
  }
74
  return $terms;
75
  }
76
 
77
+ function rt_get_selected_term_by_taxonomy($taxonomy = null, $include = [], $count = false, $parent = false) {
78
+ $terms = array();
79
+ if ($taxonomy) {
80
+ $temp_terms = get_terms(array('taxonomy' => $taxonomy, 'hide_empty' => 0));
81
+ if (is_array($temp_terms) && !empty($temp_terms) && empty($temp_terms['errors'])) {
82
+ foreach ($temp_terms as $term) {
83
+ $order = get_term_meta($term->term_id, '_rt_order', true);
84
+ if ($order === "") {
85
+ update_term_meta($term->term_id, '_rt_order', 0);
86
+ }
87
+ }
88
+ global $wp_version;
89
+ $args = array(
90
+ 'taxonomy' => $taxonomy,
91
+ 'orderby' => 'meta_value_num',
92
+ 'meta_key' => '_rt_order',
93
+ 'include' => $include,
94
+ 'hide_empty' => false,
95
+ );
96
+ if ($parent >= 0 && $parent !== false) {
97
+ $args['parent'] = absint($parent);
98
+ }
99
+ $args['orderby'] = 'meta_value_num';
100
+ $args['meta_key'] = '_rt_order';
101
+
102
+ $termObjs = get_terms($args);
103
+
104
+ foreach ($termObjs as $term) {
105
+ if ($count) {
106
+ $terms[$term->term_id] = array('name' => $term->name, 'count' => $term->count);
107
+ } else {
108
+ $terms[$term->term_id] = $term->name;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ return $terms;
115
+ }
116
+
117
  function getCurrentUserRoles() {
118
  global $current_user;
119
 
499
 
500
  if ($mediaSource == 'feature_image') {
501
  if ($aID = get_post_thumbnail_id($post_id)) {
502
+ $image = wp_get_attachment_image($aID, $fImgSize, '', ['class' => $img_class, 'loading' => false]);
503
  $imgSrc = wp_get_attachment_image_src($aID, $fImgSize);
504
  $imgSrc = $imgSrc[0];
505
  }
1125
  // Title decoration
1126
 
1127
  if ($title_color || $title_size || $title_weight || $title_alignment) {
1128
+ $css .= "#{$layoutID} .{$layout} .rt-holder h2.entry-title,
1129
+ #{$layoutID} .{$layout} .rt-holder h3.entry-title,
1130
+ #{$layoutID} .{$layout} .rt-holder h4.entry-title,
1131
+ #{$layoutID} .{$layout} .rt-holder h2.entry-title a,
1132
+ #{$layoutID} .{$layout} .rt-holder h3.entry-title a,
1133
+ #{$layoutID} .{$layout} .rt-holder h4.entry-title a,
1134
+ #{$layoutID} .rt-holder .rt-woo-info h2 a,
1135
+ #{$layoutID} .rt-holder .rt-woo-info h3 a,
1136
+ #{$layoutID} .rt-holder .rt-woo-info h4 a,
1137
+ #{$layoutID} .rt-holder .rt-woo-info h2,
1138
+ #{$layoutID} .rt-holder .rt-woo-info h3,
1139
+ #{$layoutID} .rt-holder .rt-woo-info h4{";
1140
  if ($title_color) {
1141
  $css .= "color:" . $title_color . ";";
1142
  }
1154
 
1155
  // Title hover color
1156
  if ($title_hover_color) {
1157
+ $css .= "#{$layoutID} .{$layout} .rt-holder h2.entry-title:hover,
1158
+ #{$layoutID} .{$layout} .rt-holder h3.entry-title:hover,
1159
+ #{$layoutID} .{$layout} .rt-holder h4.entry-title:hover,
1160
+ #{$layoutID} .{$layout} .rt-holder h2.entry-title a:hover,
1161
  #{$layoutID} .{$layout} .rt-holder h3.entry-title a:hover,
1162
+ #{$layoutID} .{$layout} .rt-holder h4.entry-title a:hover,
1163
+ #{$layoutID} .rt-holder .rt-woo-info h2 a:hover,
1164
  #{$layoutID} .rt-holder .rt-woo-info h3 a:hover,
1165
+ #{$layoutID} .rt-holder .rt-woo-info h4 a:hover,
1166
+ #{$layoutID} .rt-holder .rt-woo-info h2:hover,
1167
+ #{$layoutID} .rt-holder .rt-woo-info h3:hover,
1168
+ #{$layoutID} .rt-holder .rt-woo-info h4:hover{";
1169
  $css .= "color:" . $title_hover_color . " !important;";
1170
  $css .= "}";
1171
  }
1196
  $css .= "}";
1197
  }
1198
 
1199
+ $css .= "#{$layoutID} .{$layout} .rt-holder .post-meta-user,#{$layoutID} .{$layout} .rt-holder .post-meta-user .meta-data, #{$layoutID} .{$layout} .rt-holder .post-meta-user a, #{$layoutID} .{$layout} .rt-holder .rt-detail .post-meta .rt-tpg-social-share {";
1200
  if ($meta_data_color) {
1201
  $css .= "color:" . $meta_data_color . ";";
1202
  }
lib/classes/rtTPGOptions.php CHANGED
@@ -580,6 +580,15 @@ if (!class_exists('rtTPGOptions')):
580
  "type" => "text",
581
  "label" => "Read more text"
582
  ),
 
 
 
 
 
 
 
 
 
583
  'link_to_detail_page' => array(
584
  "type" => "radio",
585
  "label" => "Link To Detail Page",
@@ -641,6 +650,14 @@ if (!class_exists('rtTPGOptions')):
641
  );
642
  }
643
 
 
 
 
 
 
 
 
 
644
  function rtTpgSettingsDetailFieldSelection() {
645
  $settings = get_option(rtTPG()->options['settings']);
646
 
580
  "type" => "text",
581
  "label" => "Read more text"
582
  ),
583
+ 'title_tag' => array(
584
+ 'type' => 'select',
585
+ 'name' => 'title_tag',
586
+ 'label' => esc_html__('Title tag', 'the-post-grid'),
587
+ 'class' => 'rt-select2',
588
+ 'id' => 'title-tag',
589
+ 'options' => $this->getTitleTags(),
590
+ 'default' => 'h3'
591
+ ),
592
  'link_to_detail_page' => array(
593
  "type" => "radio",
594
  "label" => "Link To Detail Page",
650
  );
651
  }
652
 
653
+ function getTitleTags() {
654
+ return array(
655
+ 'h2' => "H2",
656
+ 'h3' => "H3",
657
+ 'h4' => "H4"
658
+ );
659
+ }
660
+
661
  function rtTpgSettingsDetailFieldSelection() {
662
  $settings = get_option(rtTPG()->options['settings']);
663
 
lib/classes/rtTPGPreview.php CHANGED
@@ -408,6 +408,8 @@ if ( ! class_exists( 'rtTPGPreview' ) ):
408
  );
409
  }
410
 
 
 
411
  $gridQuery = new WP_Query( $args );
412
  // Start layout
413
  $data .= rtTPG()->layoutStyle( $layoutID, $scMeta, $layout );
408
  );
409
  }
410
 
411
+ $arg['title_tag'] = (!empty($scMeta['title_tag']) && in_array($scMeta['title_tag'], array_keys(rtTPG()->getTitleTags()))) ? esc_attr($scMeta['title_tag']) : 'h3';
412
+
413
  $gridQuery = new WP_Query( $args );
414
  // Start layout
415
  $data .= rtTPG()->layoutStyle( $layoutID, $scMeta, $layout );
lib/classes/rtTPGShortCode.php CHANGED
@@ -1,1004 +1,997 @@
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') ? 10000000 : (int)$scMeta['limit'][0]);
167
-
168
- $args['posts_per_page'] = $limit;
169
- $pagination = (!empty($scMeta['pagination'][0]) ? true : false);
170
- $posts_loading_type = (!empty($scMeta['posts_loading_type'][0]) ? $scMeta['posts_loading_type'][0] : "pagination");
171
- if ($pagination) {
172
- $posts_per_page = (isset($scMeta['posts_per_page'][0]) ? intval($scMeta['posts_per_page'][0]) : $limit);
173
- if ($posts_per_page > $limit) {
174
- $posts_per_page = $limit;
175
- }
176
- // Set 'posts_per_page' parameter
177
- $args['posts_per_page'] = $posts_per_page;
178
- $paged = get_query_var('page') ? get_query_var('page') : (get_query_var('paged') ? get_query_var('paged') : 1);
179
-
180
- $offset = $posts_per_page * ((int)$paged - 1);
181
-
182
- $args['paged'] = $paged;
183
-
184
- // Update posts_per_page
185
- if (intval($args['posts_per_page']) > $limit - $offset) {
186
- $args['posts_per_page'] = $limit - $offset;
187
- }
188
- //if($args['paged'] == 1){unset($args['paged']);}
189
- }
190
-
191
- // Advance Filter
192
- $adv_filter = get_post_meta($scID, 'post_filter');
193
- $taxFilter = get_post_meta($scID, 'tgp_filter_taxonomy', true);
194
- $taxHierarchical = get_post_meta($scID, 'tgp_filter_taxonomy_hierarchical', true);
195
- $taxFilterTerms = array();
196
- $taxFilterOperator = "IN";
197
- // Taxonomy
198
- $taxQ = array();
199
- if (in_array('tpg_taxonomy', $adv_filter) && isset($scMeta['tpg_taxonomy'])) {
200
-
201
- if (is_array($scMeta['tpg_taxonomy']) && !empty($scMeta['tpg_taxonomy'])) {
202
- foreach ($scMeta['tpg_taxonomy'] as $taxonomy) {
203
- $terms = (isset($scMeta['term_' . $taxonomy]) ? $scMeta['term_' . $taxonomy] : array());
204
- if (is_array($terms) && !empty($terms)) {
205
- $operator = (isset($scMeta['term_operator_' . $taxonomy][0]) ? $scMeta['term_operator_' . $taxonomy][0] : "IN");
206
- $taxQ[] = array(
207
- 'taxonomy' => $taxonomy,
208
- 'field' => 'term_id',
209
- 'terms' => $terms,
210
- 'operator' => $operator,
211
- );
212
- if ($taxonomy == $taxFilter) {
213
- $taxFilterOperator = $operator;
214
- }
215
- }
216
- if ($taxonomy == $taxFilter) {
217
- $taxFilterTerms = $terms;
218
- }
219
- }
220
- }
221
- if (count($taxQ) >= 2) {
222
- $relation = (isset($scMeta['taxonomy_relation'][0]) ? $scMeta['taxonomy_relation'][0] : "AND");
223
- $taxQ['relation'] = $relation;
224
- }
225
- }
226
-
227
- if (!empty($taxQ)) {
228
- $args['tax_query'] = $taxQ;
229
- }
230
-
231
-
232
- // Order
233
- if (in_array('order', $adv_filter)) {
234
- $order_by = (isset($scMeta['order_by'][0]) ? $scMeta['order_by'][0] : null);
235
- $order = (isset($scMeta['order'][0]) ? $scMeta['order'][0] : null);
236
- if ($order) {
237
- $args['order'] = $order;
238
- }
239
- if ($order_by) {
240
- $args['orderby'] = $order_by;
241
- $meta_key = !empty($scMeta['tpg_meta_key'][0]) ? trim($scMeta['tpg_meta_key'][0]) : null;
242
- if (in_array($order_by, array_keys(rtTPG()->rtMetaKeyType())) && $meta_key) {
243
- $args['orderby'] = $order_by;
244
- $args['meta_key'] = $meta_key;
245
- }
246
- }
247
- }
248
-
249
- // Status
250
- if (in_array('tpg_post_status', $adv_filter)) {
251
- $post_status = (isset($scMeta['tpg_post_status']) ? $scMeta['tpg_post_status'] : array());
252
- if (!empty($post_status)) {
253
- $args['post_status'] = $post_status;
254
- } else {
255
- $args['post_status'] = 'publish';
256
- }
257
- }
258
- // Author
259
- $author = (isset($scMeta['author']) ? $scMeta['author'] : array());
260
- $filterAuthors = array();
261
- if (in_array('author', $adv_filter) && !empty($author)) {
262
- $filterAuthors = $args['author__in'] = $author;
263
- }
264
-
265
- // Search
266
- $s = (isset($scMeta['s'][0]) ? $scMeta['s'][0] : array());
267
- if (in_array('s', $adv_filter) && !empty($s)) {
268
- $args['s'] = $s;
269
- }
270
-
271
- // Date query
272
- if (in_array('date_range', $adv_filter)) {
273
- $startDate = (!empty($scMeta['date_range_start'][0]) ? $scMeta['date_range_start'][0] : null);
274
- $endDate = (!empty($scMeta['date_range_end'][0]) ? $scMeta['date_range_end'][0] : null);
275
- if ($startDate && $endDate) {
276
- $args['date_query'] = array(
277
- array(
278
- 'after' => $startDate,
279
- 'before' => $endDate,
280
- 'inclusive' => true,
281
- ),
282
- );
283
- }
284
- }
285
-
286
- $settings = get_option(rtTPG()->options['settings']);
287
- $oLayoutTag = !empty($settings['template_tag']) ? absint($settings['template_tag']) : null;
288
- $oLayoutAuthor = !empty($settings['template_author']) ? $settings['template_author'] : null;
289
- $oLayoutCategory = !empty($settings['template_category']) ? $settings['template_category'] : null;
290
- $oLayoutSearch = !empty($settings['template_search']) ? $settings['template_search'] : null;
291
- $dataArchive = null;
292
- if ((is_category() && $oLayoutCategory) || (is_search() && $oLayoutSearch) || (is_tag() && $oLayoutTag) || (is_author() && $oLayoutAuthor)) {
293
-
294
- unset($args['post_type']);
295
- unset($args['tax_query']);
296
- unset($args['author__in']);
297
- $obj = get_queried_object();
298
- $aType = $aValue = null;
299
- if ($oLayoutTag && is_tag()) {
300
- if (!empty($obj->slug)) {
301
- $aValue = $args['tag'] = $obj->slug;
302
- $aType = 'tag';
303
- }
304
- } else if ($oLayoutCategory && is_category()) {
305
- if (!empty($obj->slug)) {
306
- $aValue = $args['category_name'] = $obj->slug;
307
- }
308
- $aType = 'category';
309
- } else if ($oLayoutAuthor && is_author()) {
310
- $aValue = $args['author'] = $obj->ID;
311
- $aType = 'author';
312
- } else if ($oLayoutSearch && is_search()) {
313
- $aValue = $args['s'] = get_search_query();
314
- $aType = 'search';
315
- }
316
- $dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
317
- $args['posts_per_archive_page'] = $args['posts_per_page'];
318
- }
319
-
320
- // Validation
321
- $containerDataAttr = null;
322
- $containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
323
-
324
- $dCol = $dCol == 5 ? '24' : round(12 / $dCol);
325
- $tCol = $dCol == 5 ? '24' : round(12 / $tCol);
326
- $mCol = $dCol == 5 ? '24' : round(12 / $mCol);
327
- if ($isCarousel) {
328
- $dCol = $tCol = $mCol = 12;
329
- }
330
- $arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
331
- if ($layout == 'layout2' || $layout == 'layout3') {
332
- $iCol = (isset($scMeta['tgp_layout2_image_column'][0]) ? absint($scMeta['tgp_layout2_image_column'][0]) : 4);
333
- $iCol = $iCol > 12 ? 4 : $iCol;
334
- $cCol = 12 - $iCol;
335
- $arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
336
- $arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
337
- } else if ($layout == 'layout4') {
338
- $arg['image_area'] = "rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ";
339
- $arg['content_area'] = "rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ";
340
- }
341
- $arg_class = [];
342
- if (!$isIsotope && !rtTPG()->hasPro()) {
343
- $arg_class[] = 'rt-equal-height';
344
- }
345
- $gridType = !empty($scMeta['grid_style'][0]) ? $scMeta['grid_style'][0] : 'even';
346
- if ($isIsotope && !rtTPG()->hasPro()) {
347
- $arg_class[] = "masonry-grid-item";
348
- } else if (!$isCarousel && !$isOffset) {
349
- $arg_class[] = $gridType . "-grid-item";
350
- }
351
- $arg_class[] = "rt-grid-item";
352
- if ($isOffset) {
353
- $arg_class[] = "rt-offset-item";
354
- }
355
-
356
- $masonryG = null;
357
- if ($gridType == "even") {
358
- $masonryG = " tpg-even";
359
- } else if ($gridType == "masonry" && !$isIsotope && !$isCarousel) {
360
- $masonryG = " tpg-masonry";
361
- }
362
- $preLoader = $preLoaderHtml = null;
363
- if ($isIsotope) {
364
- $arg_class[] = 'isotope-item';
365
- $preLoader = 'tpg-pre-loader';
366
- }
367
- if ($isCarousel) {
368
- $arg_class[] = 'carousel-item';
369
- $preLoader = 'tpg-pre-loader';
370
- }
371
- if ($preLoader && rtTPG()->hasPro()) {
372
- $preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
373
- }
374
-
375
- $margin = !empty($scMeta['margin_option'][0]) ? $scMeta['margin_option'][0] : 'default';
376
- if ($margin == 'no') {
377
- $arg_class[] = 'no-margin';
378
- }
379
- if (!empty($scMeta['tpg_image_type'][0]) && $scMeta['tpg_image_type'][0] == 'circle') {
380
- $arg_class[] = 'tpg-img-circle';
381
- }
382
- $arg['class'] = implode(" ", $arg_class);
383
- $arg['anchorClass'] = $arg['link_target'] = null;
384
- $link = !empty($scMeta['link_to_detail_page'][0]) ? $scMeta['link_to_detail_page'][0] : 'yes';
385
- if ($link != 'yes') {
386
- $arg['anchorClass'] = ' disabled';
387
- }
388
- $isSinglePopUp = false;
389
- $linkType = !empty($scMeta['detail_page_link_type'][0]) ? $scMeta['detail_page_link_type'][0] : 'popup';
390
- if ($link == 'yes') {
391
- if ($linkType == 'popup' && rtTPG()->hasPro()) {
392
- $popupType = !empty($scMeta['popup_type'][0]) ? $scMeta['popup_type'][0] : 'single';
393
- if ($popupType == 'single') {
394
- $arg['anchorClass'] .= ' tpg-single-popup';
395
- $isSinglePopUp = true;
396
- } else {
397
- $arg['anchorClass'] .= ' tpg-multi-popup';
398
- }
399
- } else {
400
- $arg['link_target'] = !empty($scMeta['link_target'][0]) ? " target='{$scMeta['link_target'][0]}'" : null;
401
- }
402
- }
403
-
404
- $parentClass = (!empty($scMeta['parent_class'][0]) ? trim($scMeta['parent_class'][0]) : null);
405
- $defaultImgId = (!empty($scMeta['default_preview_image'][0]) ? absint($scMeta['default_preview_image'][0]) : null);
406
- $customImgSize = (!empty($scMeta['custom_image_size']) ? $scMeta['custom_image_size'] : array());
407
-
408
- $arg['scID'] = $scID;
409
- $arg['items'] = isset($scMeta['item_fields']) ? ($scMeta['item_fields'] ? $scMeta['item_fields'] : array()) : array();
410
- if (in_array('cf', $arg['items'])) {
411
- $arg['cf_group'] = array();
412
- $arg['cf_group'] = get_post_meta($scID, 'cf_group');
413
- $arg['format'] = array(
414
- 'hide_empty' => get_post_meta($scID, 'cf_hide_empty_value', true),
415
- 'show_value' => get_post_meta($scID, 'cf_show_only_value', true),
416
- 'hide_group_title' => get_post_meta($scID, 'cf_hide_group_title', true)
417
- );
418
- }
419
-
420
- // Set readmore false if excerpt type = full content
421
- if (isset($arg['excerpt_type']) && $arg['excerpt_type'] === 'full' && ($key = array_search('read_more', $arg['items'])) !== false) {
422
- unset($arg['items'][$key]);
423
- }
424
-
425
- if (!empty($scMeta['ignore_sticky_posts'][0])) {
426
- $args['ignore_sticky_posts'] = true;
427
- } else {
428
- $args['wp_tpg_is_home'] = true;
429
- }
430
-
431
- $filters = !empty($scMeta['tgp_filter']) ? $scMeta['tgp_filter'] : array();
432
- $action_term = !empty($scMeta['tgp_default_filter'][0]) ? absint($scMeta['tgp_default_filter'][0]) : 0;
433
- $hide_all_button = !empty($scMeta['tpg_hide_all_button'][0]) ? true : false;
434
- if ($taxHierarchical) {
435
- $terms = rtTPG()->rt_get_all_term_by_taxonomy($taxFilter, true, 0);
436
- } else {
437
- $terms = rtTPG()->rt_get_all_term_by_taxonomy($taxFilter, true);
438
- }
439
- if ($hide_all_button && !$action_term) {
440
- if (!empty($terms)) {
441
- $allKeys = array_keys($terms);
442
- $action_term = $allKeys[0];
443
- }
444
- }
445
- if (in_array('_taxonomy_filter', $filters) && $taxFilter && $action_term) {
446
- $args['tax_query'] = array(
447
- array(
448
- 'taxonomy' => $taxFilter,
449
- 'field' => 'term_id',
450
- 'terms' => array($action_term),
451
- )
452
- );
453
- }
454
-
455
- $gridQuery = new WP_Query(apply_filters('tpg_sc_query_args', $args, $scMeta));
456
-
457
- if (isset($posts_per_page) && $posts_per_page && $limit) {
458
- $max_page = ceil($limit / $posts_per_page);
459
- $gridQuery->max_num_pages = $gridQuery->max_num_pages < $max_page ? $gridQuery->max_num_pages : $max_page;
460
- }
461
-
462
- // Start layout
463
- $html .= rtTPG()->layoutStyle($layoutID, $scMeta, $layout, $scID);
464
- $containerDataAttr .= " data-sc-id='{$scID}'";
465
- $html .= "<div class='rt-container-fluid rt-tpg-container {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
466
- if (!empty($filters) && ($isGrid || $isOffset || $isWooCom || $isEdd)) {
467
- $html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
468
- $selectedSubTermsForButton = null;
469
- $allText = apply_filters('tpg_filter_all_text', __("All", "the-post-grid"), $scMeta);
470
- if (in_array('_taxonomy_filter', $filters) && $taxFilter) {
471
- $filterType = (!empty($scMeta['tgp_filter_type'][0]) ? $scMeta['tgp_filter_type'][0] : null);
472
- $post_count = (!empty($scMeta['tpg_post_count'][0]) ? $scMeta['tpg_post_count'][0] : null);
473
- $postCountClass = ($post_count ? " has-post-count" : null);
474
- $allSelect = " selected";
475
- $isTermSelected = false;
476
- if ($action_term && $taxFilter) {
477
- $isTermSelected = true;
478
- $allSelect = null;
479
- }
480
- if (!$filterType || $filterType == 'dropdown') {
481
- $html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
482
- $termDefaultText = $allText;
483
- $dataTerm = 'all';
484
- $htmlButton = "";
485
- $selectedSubTerms = null;
486
- $pCount = 0;
487
- if (!empty($terms)) {
488
- $i = 0;
489
- foreach ($terms as $id => $term) {
490
- $pCount = $pCount + $term['count'];
491
- $sT = null;
492
- if ($taxHierarchical) {
493
- $subTerms = rtTPG()->rt_get_all_term_by_taxonomy($taxFilter, true, $id);
494
- if (!empty($subTerms)) {
495
- $count = 0;
496
- $item = $allCount = null;
497
- foreach ($subTerms as $stId => $t) {
498
- $count = $count + absint($t['count']);
499
- $sTPostCount = ($post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null);
500
- $item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
501
- }
502
- if ($post_count) {
503
- $allCount = " (<span class='rt-post-count'>{$count}</span>)";
504
- }
505
- $sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
506
- $sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
507
- <span class='rt-text'>" . $allText . "{$allCount}</span>
508
- <i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
509
- </span>";
510
- $sT .= '<span class="term-dropdown rt-filter-dropdown">';
511
- $sT .= $item;
512
- $sT .= '</span>';
513
- $sT .= "</div>";
514
- }
515
- if ($action_term === $id) {
516
- $selectedSubTerms = $sT;
517
- }
518
- }
519
- $postCount = ($post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null);
520
- if ($action_term && $action_term == $id) {
521
- $termDefaultText = $term['name'] . $postCount;
522
- $dataTerm = $id;
523
- }
524
- if (is_array($taxFilterTerms) && !empty($taxFilterTerms)) {
525
- if ($taxFilterOperator == "NOT IN") {
526
- if (!in_array($id, $taxFilterTerms) && $action_term != $id) {
527
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
528
- }
529
- } else {
530
- if (in_array($id, $taxFilterTerms) && $action_term != $id) {
531
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
532
- }
533
- }
534
- } else {
535
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
536
- }
537
- $i++;
538
- }
539
- }
540
- $pAllCount = null;
541
- if ($post_count) {
542
- $pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
543
- if (!$action_term) {
544
- $termDefaultText = $termDefaultText . $pAllCount;
545
- }
546
- }
547
- if (!$hide_all_button) {
548
- $htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . "{$pAllCount}</span></span>" . $htmlButton;
549
- }
550
- $htmlButton = sprintf('<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton);
551
-
552
- $showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
553
- <span class="rt-text">' . $termDefaultText . '</span>
554
- <i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
555
- </span>';
556
-
557
- $html .= $showAllhtml . $htmlButton;
558
- $html .= '</div>' . $selectedSubTerms;
559
- } else {
560
- $termDefaultText = $allText;
561
- $bCount = 0;
562
- $bItems = null;
563
- if (!empty($terms)) {
564
- foreach ($terms as $id => $term) {
565
- $bCount = $bCount + absint($term['count']);
566
- $sT = null;
567
- if ($taxHierarchical) {
568
- $subTerms = rtTPG()->rt_get_all_term_by_taxonomy($taxFilter, true, $id);
569
- if (!empty($subTerms)) {
570
- $sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
571
- foreach ($subTerms as $stId => $t) {
572
- $sTPostCount = ($post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null);
573
- $sT .= "<span class='rt-filter-button-item' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
574
- }
575
- $sT .= "</div>";
576
- if ($action_term === $id) {
577
- $selectedSubTermsForButton = $sT;
578
- }
579
- }
580
- }
581
- $postCount = ($post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null);
582
- $termSelected = null;
583
- if ($isTermSelected && $id == $action_term) {
584
- $termSelected = " selected";
585
- }
586
- if (is_array($taxFilterTerms) && !empty($taxFilterTerms)) {
587
- if ($taxFilterOperator == "NOT IN") {
588
- if (!in_array($id, $taxFilterTerms)) {
589
- $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
590
- }
591
- } else {
592
- if (in_array($id, $taxFilterTerms)) {
593
- $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
594
- }
595
- }
596
-
597
- } else {
598
- $bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
599
- }
600
- }
601
- }
602
- $html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
603
- if (!$hide_all_button) {
604
- $pCountH = ($post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null);
605
- $html .= "<span class='term-button-item rt-filter-button-item {$allSelect}' data-term='all'>" . $allText . "{$pCountH}</span>";
606
- }
607
- $html .= $bItems;
608
- $html .= "</div>";
609
- }
610
- }
611
-
612
- // Author filter
613
- if (in_array('_author_filter', $filters)) {
614
- $filterType = (!empty($scMeta['tgp_filter_type'][0]) ? $scMeta['tgp_filter_type'][0] : null);
615
- $post_count = (!empty($scMeta['tpg_post_count'][0]) ? $scMeta['tpg_post_count'][0] : null);
616
- $users = get_users(apply_filters('tpg_author_arg', array()));
617
-
618
- $allSelect = " selected";
619
- $isTermSelected = false;
620
- if ($action_term && $taxFilter) {
621
- $isTermSelected = true;
622
- $allSelect = null;
623
- }
624
- if (!$filterType || $filterType == 'dropdown') {
625
- $html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}'>";
626
- $termDefaultText = $allText;
627
- $dataAuthor = 'all';
628
- $htmlButton = "";
629
- $htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
630
- if (!empty($users)) {
631
- foreach ($users as $user) {
632
- if (is_array($filterAuthors) && !empty($filterAuthors)) {
633
- if (in_array($user->ID, $filterAuthors)) {
634
- if ($action_term == $user->ID) {
635
- $termDefaultText = $user->display_name;
636
- $dataTerm = $user->ID;
637
- } else {
638
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name}</span>";
639
- }
640
- }
641
- } else {
642
- if ($action_term == $user->ID) {
643
- $termDefaultText = $user->display_name;
644
- $dataTerm = $user->ID;
645
- } else {
646
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name}</span>";
647
- }
648
- }
649
- }
650
- }
651
-
652
- if ($isTermSelected) {
653
- $htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . "{$pAllCount}</span>";
654
- }
655
- $htmlButton .= '</span>';
656
-
657
- $showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
658
- <span class="rt-text">' . $termDefaultText . '</span>
659
- <i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
660
- </span>';
661
-
662
- $html .= $showAllhtml . $htmlButton;
663
- $html .= '</div>';
664
- } else {
665
- $bCount = 0;
666
- $bItems = null;
667
- if (!empty($users)) {
668
- foreach ($users as $user) {
669
- if (is_array($filterAuthors) && !empty($filterAuthors)) {
670
- if (in_array($user->ID, $filterAuthors)) {
671
- $bItems .= "<span class='author-button-item rt-filter-button-item data-author='{$user->ID}'>{$user->display_name}</span>";
672
- }
673
- } else {
674
- $bItems .= "<span class='author-button-item rt-filter-button-item data-author='{$user->ID}'>{$user->display_name}</span>";
675
- }
676
- }
677
- }
678
- $html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
679
- if (!$hide_all_button) {
680
- $pCountH = ($post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null);
681
- $html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "{$pCountH}</span>";
682
- }
683
- $html .= $bItems;
684
- $html .= "</div>";
685
- }
686
- }
687
-
688
- if (in_array('_sort_order', $filters)) {
689
- $action_order = (!empty($args['order']) ? strtoupper(trim($args['order'])) : "DESC");
690
- $html .= '<div class="rt-filter-item-wrap rt-sort-order-action">';
691
- $html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'>&nbsp;<span></span></span>";
692
- $html .= '</div>';
693
- }
694
-
695
- if (in_array('_order_by', $filters)) {
696
- $wooFeature = ($postType == "product" ? true : false);
697
- $orders = rtTPG()->rtPostOrderBy($wooFeature);
698
- $action_orderby = (!empty($args['orderby']) ? trim($args['orderby']) : "none");
699
- if ($action_orderby == 'none') {
700
- $action_orderby_label = __("Sort By None", "the-post-grid");
701
- } elseif (in_array($action_orderby, array_keys(rtTPG()->rtMetaKeyType()))) {
702
- $action_orderby_label = __("Meta value", "the-post-grid");
703
- } else {
704
- $action_orderby_label = $orders[$action_orderby];
705
- }
706
- if ($action_orderby !== 'none') {
707
- $orders['none'] = __("Sort By None", "the-post-grid");
708
- }
709
- $html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
710
- $html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
711
- <span class='rt-text-order-by'>{$action_orderby_label}</span>
712
- <i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
713
- </span>";
714
- $html .= '<span class="order-by-dropdown rt-filter-dropdown">';
715
-
716
- foreach ($orders as $orderKey => $order) {
717
- $html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
718
- }
719
- $html .= '</span>';
720
- $html .= '</div>';
721
- }
722
-
723
- if (in_array('_search', $filters)) {
724
- $html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
725
- $html .= sprintf('<input type="text" class="rt-search-input" placeholder="%s">', esc_html__("Search...", 'the-post-grid'));
726
- $html .= "<span class='rt-action'>&#128269;</span>";
727
- $html .= "<span class='rt-loading'></span>";
728
- $html .= '</div>';
729
- }
730
- $html .= "</div>$selectedSubTermsForButton</div>";
731
- }
732
-
733
- $html .= "<div data-title='" . __("Loading ...",
734
- 'the-post-grid') . "' class='rt-row rt-content-loader {$layout}{$masonryG} {$preLoader}'>";
735
-
736
- if ($gridQuery->have_posts()) {
737
-
738
- if ($isCarousel) {
739
- $cOpt = !empty($scMeta['carousel_property']) ? $scMeta['carousel_property'] : array();
740
- $slider_js_options = apply_filters('rttpg_slider_js_options', array(
741
- "speed" => !empty($scMeta['tpg_carousel_speed'][0]) ? absint($scMeta['tpg_carousel_speed'][0]) : 250,
742
- "autoPlayTimeOut" => !empty($scMeta['tpg_carousel_autoplay_timeout'][0]) ? absint($scMeta['tpg_carousel_autoplay_timeout'][0]) : 5000,
743
- "autoPlay" => in_array('auto_play', $cOpt) ? true : false,
744
- "stopOnHover" => in_array('stop_hover', $cOpt) ? true : false,
745
- "nav" => in_array('nav_button', $cOpt) ? true : false,
746
- "dots" => in_array('pagination', $cOpt) ? true : false,
747
- "loop" => in_array('loop', $cOpt) ? true : false,
748
- "lazyLoad" => in_array('lazyLoad', $cOpt) ? true : false,
749
- "autoHeight" => in_array('autoHeight', $cOpt) ? true : false,
750
- "rtl" => in_array('rtl', $cOpt) ? true : false
751
- ), $scMeta);
752
- $html .= sprintf('<div class="rt-carousel-holder" data-rtowl-options="%s">',
753
- htmlspecialchars(wp_json_encode($slider_js_options)));
754
- }
755
- $isotope_filter = null;
756
- if ($isIsotope) {
757
- $isotope_filter = isset($scMeta['isotope_filter'][0]) ? $scMeta['isotope_filter'][0] : null;
758
- $isotope_dropdown_filter = isset($scMeta['isotope_filter_dropdown'][0]) ? $scMeta['isotope_filter_dropdown'][0] : null;
759
- $selectedTerms = array();
760
- if (isset($scMeta['post_filter']) && in_array('tpg_taxonomy',
761
- $scMeta['post_filter']) && isset($scMeta['tpg_taxonomy']) && in_array($isotope_filter,
762
- $scMeta['tpg_taxonomy'])
763
- ) {
764
- $selectedTerms = (isset($scMeta['term_' . $isotope_filter]) ? $scMeta['term_' . $isotope_filter] : array());
765
- }
766
- $termArgs = [
767
- 'taxonomy' => $isotope_filter,
768
- 'orderby' => 'meta_value_num',
769
- 'order' => 'ASC',
770
- 'hide_empty' => false,
771
- 'include' => $selectedTerms
772
- ];
773
- if (rtTPG()->hasPro()) {
774
- $termArgs['meta_key'] = '_rt_order';
775
- }
776
- $terms = get_terms($termArgs);
777
-
778
- $html .= '<div class="tpg-iso-filter">';
779
- $htmlButton = $drop = null;
780
- $fSelectTrigger = false;
781
-
782
- if (!empty($terms) && !is_wp_error($terms)) {
783
- foreach ($terms as $term) {
784
- $tItem = !empty($scMeta['isotope_default_filter'][0]) ? $scMeta['isotope_default_filter'][0] : null;
785
- $fSelected = null;
786
- if ($tItem == $term->term_id) {
787
- $fSelected = 'selected';
788
- $fSelectTrigger = true;
789
- }
790
- $htmlButton .= sprintf('<button class="rt-iso-btn-%s%s" data-filter=".iso_%d">%s</button>',
791
- esc_attr($term->slug),
792
- $fSelected ? " " . $fSelected : '',
793
- $term->term_id,
794
- $term->name
795
- );
796
- $drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
797
- }
798
- }
799
- if (empty($scMeta['isotope_filter_show_all'][0])) {
800
- $fSelect = ($fSelectTrigger ? null : 'class="selected"');
801
- $htmlButton = "<button class='rt-iso-btn-all selected' data-filter='*'>" . $arg['show_all_text'] . "</button>" . $htmlButton;
802
- $drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
803
- }
804
- $filter_count = !empty($scMeta['isotope_filter_count'][0]) ? true : false;
805
- $filter_url = !empty($scMeta['isotope_filter_url'][0]) ? true : false;
806
- $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>";
807
-
808
- if ($isotope_dropdown_filter) {
809
- $html .= "<select class='isotope-dropdown-filter'>{$drop}</select>";
810
- } else {
811
- $html .= $htmlButton;
812
- }
813
- if (!empty($scMeta['isotope_search_filter'][0])) {
814
- $html .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" . __('Search',
815
- 'the-post-grid') . "' /></div>";
816
- }
817
- $html .= '</div>';
818
-
819
- $html .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
820
- }
821
-
822
- $l = $offLoop = 0;
823
- $offsetBigHtml = $offsetSmallHtml = null;
824
-
825
- while ($gridQuery->have_posts()) : $gridQuery->the_post();
826
- if ($colStore == $l) {
827
- if ($this->l4toggle) {
828
- $this->l4toggle = false;
829
- } else {
830
- $this->l4toggle = true;
831
- }
832
- $l = 0;
833
- }
834
- $pID = get_the_ID();
835
- $arg['pID'] = $pID;
836
- $arg['title'] = rtTPG()->get_the_title($pID, $arg);
837
- $arg['pLink'] = get_permalink();
838
- $arg['toggle'] = $this->l4toggle;
839
- $arg['layoutID'] = $layoutID;
840
- $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()));
841
- $cc = wp_count_comments($pID);
842
- $arg['date'] = get_the_date();
843
- $arg['excerpt'] = rtTPG()->get_the_excerpt($pID, $arg);
844
- $arg['categories'] = get_the_term_list($pID, 'category', null, '<span class="rt-separator">,</span>');
845
- $arg['tags'] = get_the_term_list($pID, 'post_tag', null, '<span class="rt-separator">,</span>');
846
- if ($isIsotope) {
847
- $termAs = wp_get_post_terms($pID, $isotope_filter, array("fields" => "all"));
848
- $isoFilter = [];
849
- if (!empty($termAs)) {
850
- foreach ($termAs as $term) {
851
- $isoFilter[] = "iso_" . $term->term_id;
852
- $isoFilter[] = "rt-item-" . esc_attr($term->slug);
853
- }
854
- }
855
- $arg['isoFilter'] = !empty($isoFilter) ? implode(" ", $isoFilter) : '';
856
- }
857
- if (comments_open()) {
858
- $arg['comment'] = "<a href='" . get_comments_link($pID) . "'>{$cc->total_comments} </a>";
859
- } else {
860
- $arg['comment'] = "{$cc->total_comments}";
861
- }
862
- $imgSrc = null;
863
-
864
- if ($isOffset) {
865
- if ($offLoop == 0) {
866
- $arg['imgSrc'] = !$fImg ? rtTPG()->getFeatureImageSrc($pID, $fImgSize, $mediaSource,
867
- $defaultImgId,
868
- $customImgSize) : null;
869
- $arg['offset'] = 'big';
870
- $offsetBigHtml = rtTPG()->render('layouts/' . $layout, $arg, true);
871
- } else {
872
- $arg['offset'] = 'small';
873
- $arg['offsetCol'] = array($dCol, $tCol, $mCol);
874
- $arg['imgSrc'] = !$fImg ? rtTPG()->getFeatureImageSrc($pID, 'thumbnail',
875
- $mediaSource,
876
- $defaultImgId,
877
- $customImgSize) : null;
878
- $offsetSmallHtml .= rtTPG()->render('layouts/' . $layout, $arg, true);
879
- }
880
- } else {
881
- $arg['imgSrc'] = !$fImg ? rtTPG()->getFeatureImageSrc($pID, $fImgSize, $mediaSource,
882
- $defaultImgId,
883
- $customImgSize) : null;
884
- $html .= rtTPG()->render('layouts/' . $layout, $arg, true);
885
- }
886
- $offLoop++;
887
- $l++;
888
- endwhile;
889
- if ($isOffset) {
890
- $oDCol = rtTPG()->get_offset_col($dCol);
891
- $oTCol = rtTPG()->get_offset_col($tCol);
892
- $oMCol = rtTPG()->get_offset_col($mCol);
893
- if ($layout == "offset03" || $layout == "offset04") {
894
- $oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
895
- $oMCol['big'] = $oMCol['small'] = 12;
896
- }
897
- $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>";
898
- $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>";
899
- }
900
- if ($isIsotope || $isCarousel) {
901
- $html .= '</div>'; // End isotope / Carousel item holder
902
- }
903
-
904
- } else {
905
- $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');
906
- $html .= sprintf('<p>%s</p>',
907
- apply_filters('tpg_not_found_text', $not_found_text, $args, $scMeta)
908
- );
909
- }
910
- $html .= $preLoaderHtml;
911
- $html .= "</div>"; // End row
912
- $htmlUtility = null;
913
- if ($pagination && !$isCarousel) {
914
- if ($isOffset) {
915
- $posts_loading_type = "page_prev_next";
916
- $htmlUtility .= "<div class='rt-cb-page-prev-next'>
917
- <span class='rt-cb-prev-btn'><i class='fa fa-angle-left' aria-hidden='true'></i></span>
918
- <span class='rt-cb-next-btn'><i class='fa fa-angle-right' aria-hidden='true'></i></span>
919
- </div>";
920
- } else {
921
- $hide = ($gridQuery->max_num_pages < 2 ? " rt-hidden-elm" : null);
922
- if ($posts_loading_type == "pagination") {
923
- if ($isGrid && empty($filters)) {
924
- $htmlUtility .= rtTPG()->rt_pagination($gridQuery,
925
- $args['posts_per_page']);
926
- }
927
- } elseif ($posts_loading_type == "pagination_ajax" && !$isIsotope) {
928
- $htmlUtility .= "<div class='rt-page-numbers'></div>";
929
- } elseif ($posts_loading_type == "load_more" && rtTPG()->hasPro()) {
930
- $htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
931
- <span class='rt-loadmore-text'>" . __('Load More', 'the-post-grid') . "</span>
932
- <div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
933
- </div>";
934
-
935
- } elseif ($posts_loading_type == "load_on_scroll" && rtTPG()->hasPro()) {
936
- $htmlUtility .= "<div class='rt-infinite-action'>
937
- <div class='rt-infinite-loading la-fire la-2x'>
938
- <div></div>
939
- <div></div>
940
- <div></div>
941
- </div>
942
- </div>";
943
- }
944
- }
945
- }
946
-
947
- if ($htmlUtility) {
948
- $l4toggle = null;
949
- if ($layout == "layout4") {
950
- $l4toggle = "data-l4toggle='{$this->l4toggle}'";
951
- }
952
- $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>";
953
- }
954
-
955
- $html .= "</div>"; // container rt-tpg
956
-
957
- wp_reset_postdata();
958
-
959
- $scriptGenerator = array();
960
- $scriptGenerator['layout'] = $layoutID;
961
- $scriptGenerator['rand'] = $rand;
962
- $scriptGenerator['scMeta'] = $scMeta;
963
- $scriptGenerator['isCarousel'] = $isCarousel;
964
- $scriptGenerator['isSinglePopUp'] = $isSinglePopUp;
965
- $scriptGenerator['isWooCom'] = $isWooCom;
966
- $this->scA[] = $scriptGenerator;
967
- add_action('wp_footer', array($this, 'register_sc_scripts'));
968
- } else {
969
- $html .= "<p>" . __("No shortCode found", "the-post-grid") . "</p>";
970
- }
971
-
972
- //restriction issue
973
- $restriction = (!empty($scMeta['restriction_user_role']) ? $scMeta['restriction_user_role'] : array());
974
- if (!empty($restriction)) {
975
- if (is_user_logged_in()) {
976
- $currentUserRoles = rtTPG()->getCurrentUserRoles();
977
- if (in_array('administrator', $currentUserRoles)) {
978
- $html = $html;
979
- } else {
980
- if (count(array_intersect($restriction, $currentUserRoles))) {
981
- $html = $html;
982
- } else {
983
- $html = "<p>" . __("You are not permitted to view this content.",
984
- "the-post-grid") . "</p>";
985
- }
986
- }
987
-
988
- } else {
989
- $html = "<p>" . __("This is a restricted content, you need to logged in to view this content.",
990
- "the-post-grid") . "</p>";
991
- }
992
- }
993
-
994
- return $html;
995
- }
996
-
997
- public function order_by_popularity_post_clauses($args) {
998
- global $wpdb;
999
- $args['orderby'] = "$wpdb->postmeta.meta_value+0 DESC, $wpdb->posts.post_date DESC";
1000
-
1001
- return $args;
1002
- }
1003
- }
1004
- 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
+ $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;
 
 
 
 
 
 
 
lib/templates/layouts/isotope1.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  $html = $htmlDetail = $iTitle = null;
4
  if(in_array('title', $items)){
5
- $iTitle = "<h3 class='entry-title'><a data-id='{$pID}' class='{$anchorClass}' href='{$pLink}'{$link_target}>{$title}</a></h3>";
6
  }
7
 
8
  $html .= sprintf('<div class="%s" data-id="%d">', esc_attr(implode(" ", array_filter([$grid, $class, $isoFilter]))), $pID);
2
 
3
  $html = $htmlDetail = $iTitle = null;
4
  if(in_array('title', $items)){
5
+ $iTitle = sprintf('<%1$s class="entry-title"><a data-id="%2$s" class="%3$s" href="%4$s"%5$s>%6$s</a></%1$s>', $title_tag,$pID,$anchorClass,$pLink,$link_target,$title);
6
  }
7
 
8
  $html .= sprintf('<div class="%s" data-id="%d">', esc_attr(implode(" ", array_filter([$grid, $class, $isoFilter]))), $pID);
lib/templates/layouts/layout1.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  $html = $htmlDetail = $metaHtml = $iTitle = null;
4
  if(in_array('title', $items)){
5
- $iTitle = "<h3 class='entry-title'><a data-id='{$pID}' class='{$anchorClass}' href='{$pLink}'{$link_target}>{$title}</a></h3>";
6
  }
7
 
8
  $html .= sprintf('<div class="%s" data-id="%d">', esc_attr(implode(" ", [$grid, $class])), $pID);
2
 
3
  $html = $htmlDetail = $metaHtml = $iTitle = null;
4
  if(in_array('title', $items)){
5
+ $iTitle = sprintf('<%1$s class="entry-title"><a data-id="%2$s" class="%3$s" href="%4$s"%5$s>%6$s</a></%1$s>', $title_tag,$pID,$anchorClass,$pLink,$link_target,$title);
6
  }
7
 
8
  $html .= sprintf('<div class="%s" data-id="%d">', esc_attr(implode(" ", [$grid, $class])), $pID);
lib/templates/layouts/layout2.php CHANGED
@@ -17,7 +17,7 @@ $html .= sprintf('<div class="%s" data-id="%d">', esc_attr(implode(" ", [$grid,
17
  $html .= "<div class='{$content_area}'>";
18
 
19
  if(in_array('title', $items)){
20
- $htmlDetail .= "<h3 class='entry-title'><a data-id='{$pID}' class='{$anchorClass}' href='{$pLink}'{$link_target}>{$title}</a></h3>";
21
  }
22
 
23
  $metaHtml = null;
17
  $html .= "<div class='{$content_area}'>";
18
 
19
  if(in_array('title', $items)){
20
+ $htmlDetail .= sprintf('<%1$s class="entry-title"><a data-id="%2$s" class="%3$s" href="%4$s"%5$s>%6$s</a></%1$s>', $title_tag,$pID,$anchorClass,$pLink,$link_target,$title);
21
  }
22
 
23
  $metaHtml = null;
lib/templates/layouts/layout3.php CHANGED
@@ -17,7 +17,7 @@ $html .= sprintf('<div class="%s" data-id="%d">', esc_attr(implode(" ", [$grid,
17
  $html .= "<div class='{$content_area}'>";
18
 
19
  if(in_array('title', $items)){
20
- $htmlDetail .= "<h3 class='entry-title'><a data-id='{$pID}' class='{$anchorClass}' href='{$pLink}'{$link_target}>{$title}</a></h3>";
21
  }
22
 
23
  $metaHtml = null;
17
  $html .= "<div class='{$content_area}'>";
18
 
19
  if(in_array('title', $items)){
20
+ $htmlDetail .= sprintf('<%1$s class="entry-title"><a data-id="%2$s" class="%3$s" href="%4$s"%5$s>%6$s</a></%1$s>', $title_tag,$pID,$anchorClass,$pLink,$link_target,$title);
21
  }
22
 
23
  $metaHtml = null;
lib/views/settings/post-source.php CHANGED
@@ -23,6 +23,7 @@ echo $sHtml;
23
  foreach($advFilters['post_filter']['options'] as $key => $filter){
24
  if($key == 'tpg_taxonomy'){
25
  $html .= "<div class='rt-tpg-filter taxonomy tpg_taxonomy tpg-hidden'>";
 
26
  if(isset($pt) && $pt){
27
  $taxonomies = rtTPG()->rt_get_all_taxonomy_by_post_type($pt);
28
  $taxA = get_post_meta($post->ID, 'tpg_taxonomy');
23
  foreach($advFilters['post_filter']['options'] as $key => $filter){
24
  if($key == 'tpg_taxonomy'){
25
  $html .= "<div class='rt-tpg-filter taxonomy tpg_taxonomy tpg-hidden'>";
26
+
27
  if(isset($pt) && $pt){
28
  $taxonomies = rtTPG()->rt_get_all_taxonomy_by_post_type($pt);
29
  $taxA = get_post_meta($post->ID, 'tpg_taxonomy');
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.1
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.2
8
  * Text Domain: the-post-grid
9
  * Domain Path: /languages
10
  * Author URI: https://radiustheme.com/