The Post Grid - Version 2.3.3

Version Description

  • Documentation update
Download this release

Release Info

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

Code changes from version 2.3.2 to 2.3.3

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.3
7
- Stable tag: 2.3.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -16,7 +16,7 @@ Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter
16
 
17
  The Post Grid is a fully Responsive & Mobile friendly plugin to display your page/post in Grid, List and Isotope View without any line of coding. It is fast and easy to generate grid from admin end and insert into page/post. You can Display posts by any category(s), tag(s), author(s), keyword(s) also Order posts by Id, Title, Created date, Modified date and Menu order.
18
 
19
- [youtube https://www.youtube.com/watch?v=V651fm6eaV4]
20
 
21
  By using The Post Grid plugin you can display your post in Grid List & Isotope view in minutes, without any line of Coding...
22
 
@@ -139,6 +139,9 @@ For any bug or suggestion please mail support@radiustheme.com
139
 
140
  == Changelog ==
141
 
 
 
 
142
  = 2.3.2 =
143
  * Full Content view
144
 
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.3
7
+ Stable tag: 2.3.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
16
 
17
  The Post Grid is a fully Responsive & Mobile friendly plugin to display your page/post in Grid, List and Isotope View without any line of coding. It is fast and easy to generate grid from admin end and insert into page/post. You can Display posts by any category(s), tag(s), author(s), keyword(s) also Order posts by Id, Title, Created date, Modified date and Menu order.
18
 
19
+ [youtube https://www.youtube.com/watch?v=6ivjE8qc0Mw]
20
 
21
  By using The Post Grid plugin you can display your post in Grid List & Isotope view in minutes, without any line of Coding...
22
 
139
 
140
  == Changelog ==
141
 
142
+ = 2.3.3 =
143
+ * Documentation update
144
+
145
  = 2.3.2 =
146
  * Full Content view
147
 
assets/css/admin.css CHANGED
@@ -1,258 +1,494 @@
1
- /* tab css */
2
- .tpg-hidden {
 
 
3
  display: none;
4
  }
5
 
6
- .rt-loading {
7
- background: url('../images/loading.gif') no-repeat center center;
8
- padding: 11px;
9
  }
10
 
11
- body.post-type-rttpg div#misc-publishing-actions, body.post-type-rttpg div#minor-publishing-actions {
 
12
  display: none;
13
  }
14
 
15
- div#rttpg_meta_marketing {
16
- background: #3E6BFF;
17
- color: #fff;
 
 
 
 
18
  }
19
 
20
- div#rttpg_meta_marketing a.button-link {
21
- color: red;
22
- text-decoration: none;
23
- font-size: 20px;
24
- display: block;
25
- text-align: center;
26
  }
27
 
28
- div#rttpg_meta_marketing h2 {
29
- color: #fff;
 
 
30
  }
31
 
32
- #sc-tabs ul.rt-tab-nav {
33
- clear: both;
34
- margin-top: 0;
 
35
  padding: 0;
36
- display: inline-block;
37
- width: 100%;
38
- margin-bottom: -4px;
39
  }
40
 
41
- #sc-tabs ul.rt-tab-nav li {
42
- background: none repeat scroll 0 0 rgb(230, 230, 230);
43
  cursor: pointer;
44
  display: inline-block;
45
- float: left;
46
- margin: 0;
47
  }
48
 
49
- #sc-tabs ul.rt-tab-nav li:focus {
50
- outline: none;
51
  }
52
 
53
- #sc-tabs ul.rt-tab-nav li.ui-tabs-active a, #sc-tabs ul.rt-tab-nav li a:hover {
54
- background: #8cc63e;
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
 
57
- #sc-tabs ul.rt-tab-nav li.ui-tabs-active a:after, #sc-tabs ul.rt-tab-nav li a:hover:after {
58
- width: 0;
59
- height: 0;
60
- border-left: 10px solid transparent;
61
- border-right: 10px solid transparent;
62
- border-top: 5px solid #8cc63e;
63
  position: absolute;
64
- bottom: -5px;
65
  left: 0;
66
  right: 0;
67
- text-align: center;
68
- margin: auto;
69
- content: "";
70
  }
71
 
72
- #sc-tabs ul.rt-tab-nav li a {
73
- text-decoration: none;
74
- display: block;
75
- padding: 8px 15px;
76
- border-right: 1px solid;
77
- background: #0071bd;
78
- color: #fff;
79
- position: relative;
80
  }
81
 
82
- #sc-tabs ul.rt-tab-nav li:last-child a {
 
 
 
 
83
  border-right: 0;
84
  }
85
 
86
- #sc-tabs ul.rt-tab-nav li a:focus {
87
- -webkit-box-shadow: none;
88
  box-shadow: none;
89
  }
90
 
91
- .rt-tab-container {
 
 
 
 
92
  display: none;
93
- border: 1px solid #e7e7e7;
 
 
 
 
 
 
94
  }
95
 
96
- .rt-tab-container .field-holder:first-child {
97
- border-top: none;
98
- padding-top: 15px;
 
 
 
 
 
 
 
99
  }
100
 
101
- .field-holder .field .full {
102
  width: 100%;
 
103
  }
104
 
105
- .rt-tpg-filter.taxonomy {
106
- background: #D8ECBC;
 
107
  }
108
 
109
- .term-filter-item-container > .field-holder.term-filter-item-operator {
110
- border-top: none;
111
  }
112
 
113
- .term-filter-item-container {
114
- border: 1px solid #5BA2D2;
 
 
 
 
 
 
 
115
  }
116
 
117
- .term-filter-item-container {
118
- border-top: none;
 
 
119
  }
120
 
121
- .term-filter-item-container:first-child {
122
- border-top: 1px solid #5BA2D2;
123
  }
124
 
125
- .rt-tab-container .field-holder, .rt-tpg-filter.taxonomy .rt-tpg-filter-item .field-holder:first-child, .rt-tpg-filter-container > .field-holder:first-child {
126
- border-top: 1px solid #e7e7e7;
127
  }
128
 
129
- .rt-tpg-filter.taxonomy .rt-tpg-filter-item .field-holder:first-child, .rt-tpg-filter-container > .field-holder:first-child, div#sc-post-post-source > .field-holder > .field > .field-holder:first-child {
130
- padding-top: 10px;
131
  }
132
 
133
- .rt-tpg-filter-container .field-holder, .rt-tpg-filter-holder > h3 {
134
- border-bottom: 1px solid #e7e7e7;
 
 
135
  }
136
 
137
- .rt-tpg-filter-holder > h3 {
138
- background: #0071bd;
139
- color: #fff;
140
  }
141
 
142
- .rt-tpg-filter.taxonomy .field-holder, .rt-tpg-filter.order > .rt-tpg-filter-item > .field-holder > .field > .field-holder, .rt-tpg-filter-holder .rt-tpg-filter:last-child .rt-tpg-filter-item > .field-holder {
143
- border-bottom: none;
144
  }
145
 
146
- .rt-tab-container .field-holder .field-label {
147
- float: left;
148
- max-width: 150px;
149
- width: 25%;
150
  }
151
 
152
- .rt-tab-container .field-holder .field {
153
- float: right;
154
- width: 75%;
155
  }
156
 
157
- .rt-tab-container .field-holder:after {
158
- clear: both;
159
- content: ".";
160
- visibility: hidden;
161
- display: block;
162
- height: 0;
163
  }
164
 
165
- .rt-setting-holder .field-holder {
166
- padding: 10px;
167
  }
168
 
169
- .rt-setting-holder .field-holder .field-label {
170
- margin-bottom: 10px;
171
- font-weight: bold;
172
  }
173
 
174
- .field-holder .checkbox-group > label {
175
- margin-right: 15px;
 
176
  }
177
 
178
- .checkbox-group.vertical > label, .radio-group.vertical > label {
179
  display: block;
180
  margin-bottom: 5px;
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  input.large-text.code.rt-code-sc {
184
  color: #fff;
185
- background: #8cc63e;
186
  font-weight: bold;
187
- padding-top: 3px;
188
  }
189
 
190
- .rt-textarea {
191
- width: 100%;
192
- height: 150px;
193
  }
194
 
195
- .rt-setting-holder .custom-css {
196
- border: 1px solid #DFDFDF;
197
- -moz-border-radius: 3px;
198
- -webkit-border-radius: 3px;
199
- border-radius: 3px;
200
- width: 100%;
201
- max-width: 800px;
202
- height: 200px;
203
- position: relative;
204
  }
205
 
206
- /* settings page */
207
- .rt-help {
 
 
 
 
 
208
  background: #fff;
209
- padding: 10px 20px;
210
  }
211
 
212
- .rt-response.loading {
213
- padding: 5px;
214
  }
215
 
216
- .rt-response.updated, .rt-response.error {
217
- padding-top: 5px;
218
- padding-bottom: 5px;
219
  }
220
 
221
- .width50 {
222
- width: 49%;
223
- float: left;
224
  }
225
 
226
- .pro-features {
227
- background: #3E6BFF;
228
- color: #fff;
229
- padding: 30px;
230
- width: 90%;
231
  }
232
 
233
- .pro-features h3 {
234
- color: #fff;
235
- margin-top: 0px;
236
- padding-bottom: 6px;
237
- border-bottom: 1px solid #fff;
238
  }
239
 
240
- .pro-features .button-link {
 
 
 
 
 
 
241
  color: #fff;
242
- background: #FF1F10 !important;
243
- padding: 10px 20px;
244
- text-decoration: none;
245
- margin-top: 5px;
246
  }
247
 
248
- .pro-features .button-link:hover {
249
- color: #ffffff;
250
- text-decoration: underline;
251
  }
252
 
253
- @media (max-width: 767px ) {
254
- .rt-setting-holder .field-holder {
255
- float: none;
256
- width: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
- }
 
 
 
 
 
 
 
 
 
 
1
+ /* ============== MetaBox START ============== */
2
+ .post-type-rttpg #misc-publishing-actions,
3
+ .post-type-rttpg #submitdiv > .handlediv,
4
+ .post-type-rttpg #submitdiv h2 {
5
  display: none;
6
  }
7
 
8
+ .post-type-rttpg #minor-publishing-actions {
9
+ padding: 0;
 
10
  }
11
 
12
+ #rt_plugin_sc_pro_information button.handlediv,
13
+ #rt_plugin_sc_pro_information h2.hndle {
14
  display: none;
15
  }
16
 
17
+ #rttpg_meta h2.hndle {
18
+ font-size: 18px;
19
+ color: #000000;
20
+ background-color: #ffffff;
21
+ border-radius: 4px;
22
+ padding: 20px;
23
+ margin-bottom: 20px;
24
  }
25
 
26
+ #rttpg_meta,
27
+ #rt_plugin_sc_pro_information {
28
+ background: transparent;
29
+ border: 0;
 
 
30
  }
31
 
32
+ #rttpg_meta .inside,
33
+ #rt_plugin_sc_pro_information .inside {
34
+ padding: 0;
35
+ margin: 0;
36
  }
37
 
38
+ /* ============== MetaBox END ================ */
39
+
40
+ /* ============== Nav style START ============== */
41
+ ul.rt-tab-nav {
42
  padding: 0;
43
+ display: flex;
44
+ border-bottom: 1px solid #dee2e6;
45
+ margin: 0;
46
  }
47
 
48
+ ul.rt-tab-nav li {
 
49
  cursor: pointer;
50
  display: inline-block;
51
+ margin-bottom: -1px;
 
52
  }
53
 
54
+ ul.rt-tab-nav li + li {
55
+ margin-left: 2px;
56
  }
57
 
58
+ ul.rt-tab-nav li a {
59
+ position: relative;
60
+ font-size: 15px;
61
+ color: #ffffff;
62
+ background-color: #ffffff;
63
+ padding: 10px 25px;
64
+ border-radius: 4px 4px 0 0;
65
+ display: inline-block;
66
+ text-decoration: none;
67
+ z-index: 2;
68
+ transition: all 0.3s ease-in-out;
69
+ }
70
+
71
+ ul.rt-tab-nav li:focus {
72
+ outline: none;
73
  }
74
 
75
+ ul.rt-tab-nav li a:after {
76
+ content: "";
77
+ height: 100%;
78
+ width: 100%;
79
+ background-color: #5d3dfd;
80
+ border-radius: 4px 4px 0 0;
81
  position: absolute;
82
+ top: 0;
83
  left: 0;
84
  right: 0;
85
+ z-index: -1;
86
+ transition: all 0.3s ease-in-out;
 
87
  }
88
 
89
+ ul.rt-tab-nav li.active a {
90
+ color: #5d3dfd;
91
+ }
92
+
93
+ ul.rt-tab-nav li.active a:after {
94
+ height: 10%;
 
 
95
  }
96
 
97
+ ul.rt-tab-nav li a i {
98
+ margin-right: 10px;
99
+ }
100
+
101
+ ul.rt-tab-nav li:last-child a {
102
  border-right: 0;
103
  }
104
 
105
+ ul.rt-tab-nav li a:focus {
 
106
  box-shadow: none;
107
  }
108
 
109
+ /* ============== Nav style END ================ */
110
+
111
+
112
+ /* ============== Container START ============== */
113
+ .rt-tab-content {
114
  display: none;
115
+ background: #fff;
116
+ }
117
+
118
+ .rt-field-wrapper {
119
+ border-bottom: 1px solid #e7e7e7;
120
+ padding: 10px 0;
121
+ display: flex;
122
  }
123
 
124
+ .rt-label {
125
+ font-weight: bold;
126
+ flex: 0 0 200px;
127
+ padding: 15px 10px 15px 15px;
128
+ }
129
+
130
+ .rt-field {
131
+ flex: 1;
132
+ padding: 15px 15px 15px 10px;
133
+ max-width: 800px;
134
  }
135
 
136
+ .rt-field textarea.rt-textarea {
137
  width: 100%;
138
+ height: 80px;
139
  }
140
 
141
+ .rt-field .rt-form-control {
142
+ width: 100%;
143
+ max-width: 100%;
144
  }
145
 
146
+ .rt-field .rt-form-control[type="number"] {
147
+ width: 70px;
148
  }
149
 
150
+ .rt-field-wrapper .custom-css {
151
+ border: 1px solid #dfdfdf;
152
+ -moz-border-radius: 3px;
153
+ -webkit-border-radius: 3px;
154
+ border-radius: 3px;
155
+ width: 100%;
156
+ max-width: 800px;
157
+ height: 200px;
158
+ position: relative;
159
  }
160
 
161
+ .rt-field-wrapper .checkbox-group.vertical > label,
162
+ .rt-field-wrapper .radio-group.vertical > label {
163
+ display: block;
164
+ margin-bottom: 5px;
165
  }
166
 
167
+ .rt-field-wrapper .checkbox-group > label {
168
+ margin-right: 15px;
169
  }
170
 
171
+ .rt-field-wrapper .rt-select {
172
+ min-width: 300px;
173
  }
174
 
175
+ .rt-field-wrapper .select2-container {
176
+ width: 100% !important;
177
  }
178
 
179
+
180
+ .rt-field-wrapper .wp-picker-container .iris-picker {
181
+ position: absolute;
182
+ z-index: 999;
183
  }
184
 
185
+ .rt-field-wrapper .wp-picker-container.wp-picker-active {
186
+ width: 265px;
 
187
  }
188
 
189
+ .rt-field-wrapper > .rt-field > .field-item > .wp-picker-container > a {
190
+ margin: 0;
191
  }
192
 
193
+ .rt-multiple-field-container {
194
+ display: flex;
195
+ flex-wrap: wrap;
 
196
  }
197
 
198
+ .rt-multiple-field-container .rt-inner-field.rt-col-3 {
199
+ flex: 33.33333333%;
 
200
  }
201
 
202
+ .rt-multiple-field-container .rt-inner-field.rt-col-4 {
203
+ flex: 25%;
 
 
 
 
204
  }
205
 
206
+ .rt-multiple-field-container .rt-inner-field.rt-col-3 {
207
+ width: 33.33333333%;
208
  }
209
 
210
+ .rt-multiple-field-container .rt-inner-field {
211
+ padding: 0 5px;
212
+ margin-bottom: 15px;
213
  }
214
 
215
+ .rt-multiple-field-container .rt-inner-field label {
216
+ display: block;
217
+ margin-bottom: 5px;
218
  }
219
 
220
+ .rt-inner-field-container .label {
221
  display: block;
222
  margin-bottom: 5px;
223
  }
224
 
225
+ .rt-field-wrapper[style*='display: block'] {
226
+ display: flex !important;
227
+ }
228
+
229
+ /* ============== Container END ================ */
230
+ /* ============== Pro Feature START ============== */
231
+
232
+ body .rt-admin-btn,
233
+ body .rt-admin-btn.button-primary {
234
+ text-align: center;
235
+ display: inline-block;
236
+ font-size: 15px;
237
+ font-weight: 400;
238
+ color: #5d3dfd;
239
+ text-decoration: none;
240
+ padding: 9px 18px;
241
+ border-radius: 4px;
242
+ position: relative;
243
+ z-index: 2;
244
+ line-height: 1.4;
245
+ transition: all 0.3s ease-in-out;
246
+ height: auto;
247
+ border: 2px solid #5d3dfd;
248
+ }
249
+
250
+ body .rt-admin-btn.button-primary,
251
+ body .rt-admin-btn:hover {
252
+ background-color: #4e35cc;
253
+ color: #ffffff;
254
+ text-decoration: none;
255
+ }
256
+
257
+ .rt-document-box.rt-update-pro-btn-wrap {
258
+ padding: 0;
259
+ }
260
+
261
+ .rt-update-pro-btn-wrap {
262
+ margin-bottom: 30px;
263
+ }
264
+
265
+ .rt-update-pro-btn-wrap .rt-update-pro-btn {
266
+ text-align: center;
267
+ background-color: #5d3dfd;
268
+ display: block;
269
+ font-size: 16px;
270
+ font-weight: 600;
271
+ color: #ffffff;
272
+ text-decoration: none;
273
+ padding: 20px 30px;
274
+ border-radius: 4px;
275
+ transition: all 0.3s ease-in-out;
276
+ }
277
+
278
+ .rt-document-box {
279
+ background-color: #ffffff;
280
+ -webkit-box-shadow: 0 1px 18px 0 rgba(0, 0, 0, 0.08);
281
+ box-shadow: 0 1px 18px 0 rgba(0, 0, 0, 0.08);
282
+ border-radius: 4px;
283
+ padding: 30px 20px;
284
+ display: flex;
285
+ }
286
+
287
+ .rt-document-box ol {
288
+ margin-left: 1em;
289
+ }
290
+
291
+ .rt-document-box + .rt-document-box {
292
+ margin-top: 30px;
293
+ }
294
+
295
+ .rt-document-box .rt-box-icon {
296
+ height: 30px;
297
+ width: 30px;
298
+ background-color: #ecf1ff;
299
+ border-radius: 50%;
300
+ display: flex;
301
+ align-items: center;
302
+ justify-content: center;
303
+ align-content: center;
304
+ margin-right: 10px;
305
+ }
306
+
307
+ .rt-document-box .rt-box-icon i {
308
+ font-size: 20px;
309
+ color: #5d3dfd;
310
+ }
311
+
312
+ .rt-document-box .rt-box-content {
313
+ -webkit-box-flex: 1;
314
+ -ms-flex: 1;
315
+ flex: 1;
316
+ }
317
+
318
+ .rt-document-box .rt-box-content .rt-box-title {
319
+ margin: 0 0 12px 0;
320
+ font-size: 20px;
321
+ color: #000000;
322
+ font-weight: 600;
323
+ }
324
+
325
+ .rt-document-box .rt-box-content p {
326
+ font-size: 14px;
327
+ color: #646464;
328
+ margin: 0 0 25px 0;
329
+ }
330
+
331
+ .rt-update-pro-btn-wrap .rt-update-pro-btn:hover {
332
+ background-color: #4e35cc;
333
+ text-decoration: none;
334
+ color: #ffffff;
335
+ }
336
+
337
+ .rt-pro-feature-content .rt-update-pro-btn {
338
+ display: block;
339
+ width: 100%;
340
+ }
341
+
342
+ .rt-setting-title h3 {
343
+ font-size: 18px;
344
+ color: #000000;
345
+ background-color: #ffffff;
346
+ border-radius: 4px;
347
+ padding: 20px;
348
+ margin-bottom: 20px;
349
+ }
350
+
351
+ .rt-pro-feature-content {
352
+ display: flex;
353
+ }
354
+
355
+ .rt-settings-container .rt-document-box + .rt-document-box {
356
+ margin-top: 0;
357
+ margin-left: 30px;
358
+ }
359
+
360
+ .rt-settings-container .rt-pro-feature-content .rt-update-pro-btn {
361
+ display: flex;
362
+ justify-content: center;
363
+ align-items: center;
364
+ }
365
+
366
+ .rt-settings-container .rt-response {
367
+ display: none;
368
+ background: #fff;
369
+ border: 1px solid #ccd0d4;
370
+ border-left-width: 4px;
371
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
372
+ margin: 10px 0;
373
+ padding: 10px 12px;
374
+ }
375
+
376
+ /* ============== Pro Feature END ================ */
377
+ /************************** Others START **************************/
378
+
379
  input.large-text.code.rt-code-sc {
380
  color: #fff;
381
+ background: #5d3dfd;
382
  font-weight: bold;
 
383
  }
384
 
385
+ .rt-response.success {
386
+ border-left-color: #46b450;
 
387
  }
388
 
389
+ .rt-response.error {
390
+ border-left-color: #dc3232;
 
 
 
 
 
 
 
391
  }
392
 
393
+
394
+ /*Product Listing*/
395
+ .rt-product-list {
396
+ display: grid;
397
+ grid-template-columns: repeat(auto-fill, minmax(400px, 400px));
398
+ grid-column-gap: 25px;
399
+ grid-row-gap: 25px;
400
  background: #fff;
401
+ padding: 15px;
402
  }
403
 
404
+ .rt-product-list .rt-product {
405
+ border: 1px solid #dcdada;
406
  }
407
 
408
+ .rt-product-list .rt-product .rt-media img {
409
+ max-width: 100%;
 
410
  }
411
 
412
+ .rt-product-list .rt-product .rt-product-info {
413
+ padding: 15px;
 
414
  }
415
 
416
+ .rt-product-list .rt-product .rt-product-info h3.rt-product-title {
417
+ margin: 0 0 15px 0 !important;
 
 
 
418
  }
419
 
420
+ .rt-product-list .rt-product .rt-product-info .rt-product-action {
421
+ display: grid;
422
+ grid-template-columns: auto auto;
423
+ grid-gap: 10px;
 
424
  }
425
 
426
+ .rt-product-list .rt-product .rt-product-info .rt-product-action a {
427
+ text-align: center;
428
+ }
429
+
430
+ /* Extra */
431
+ .rt-tpg-filter-holder > h3 {
432
+ background: #5d3dfd;
433
  color: #fff;
434
+ text-align: center;
435
+ margin: 0;
436
+ padding: .3em 0;
 
437
  }
438
 
439
+ .tpg-hidden {
440
+ display: none;
 
441
  }
442
 
443
+ .rt-loading {
444
+ background: url('../images/loading.gif') no-repeat center center;
445
+ padding: 11px;
446
+ }
447
+
448
+ /************************** Others END ****************************/
449
+
450
+
451
+ /* ------------------------------------------------------------------------- *
452
+ * Media Query
453
+ /* ------------------------------------------------------------------------- */
454
+ @media (max-width: 1199px) {
455
+ .rt-update-pro-btn-wrap .rt-update-pro-btn {
456
+ font-size: 20px;
457
+ }
458
+ }
459
+
460
+ @media (max-width: 767px) {
461
+ .rt-update-pro-btn-wrap .rt-update-pro-btn {
462
+ font-size: 18px;
463
+ }
464
+
465
+ .rt-pro-feature-content {
466
+ flex-direction: column;
467
+ }
468
+
469
+ .rt-settings-container .rt-document-box + .rt-document-box {
470
+ margin-top: 30px;
471
+ margin-left: 0;
472
+ }
473
+ }
474
+
475
+ @media (max-width: 479px) {
476
+ .rt-update-pro-btn-wrap .rt-update-pro-btn {
477
+ font-size: 16px;
478
+ }
479
+
480
+ .rt-field-wrapper {
481
+ flex-direction: column;
482
+ padding: 10px;
483
  }
484
+
485
+ .rt-label {
486
+ flex: 1;
487
+ padding: 0;
488
+ margin-bottom: 10px;
489
+ }
490
+
491
+ .rt-field {
492
+ padding: 0;
493
+ }
494
+ }
assets/css/thepostgrid.css CHANGED
@@ -164,6 +164,15 @@
164
  padding-right: 0;
165
  }
166
 
 
 
 
 
 
 
 
 
 
167
  /**********************************************************************/
168
  /********************************* Layout 1 *************************/
169
  /**********************************************************************/
@@ -230,7 +239,7 @@
230
 
231
  #poststuff .rt-tpg-container .layout1 .rt-holder .rt-detail h2,
232
  #poststuff .rt-tpg-container .layout1 .rt-holder .rt-detail h3,
233
- #poststuff .rt-tpg-container .layout1 .rt-holder .rt-detail h4 ,
234
  .rt-tpg-container .layout1 .rt-holder .rt-detail h2,
235
  .rt-tpg-container .layout1 .rt-holder .rt-detail h3,
236
  .rt-tpg-container .layout1 .rt-holder .rt-detail h4 {
@@ -267,7 +276,6 @@
267
  }
268
 
269
  .rt-tpg-container .layout1 .rt-holder .rt-detail .read-more a {
270
- padding: 6px 12px;
271
  border-radius: 5px;
272
  -moz-border-radius: 5px;
273
  -webkit-border-radius: 5px;
@@ -372,7 +380,6 @@
372
 
373
  .rt-tpg-container .layout2 .rt-holder .rt-detail .read-more a {
374
  display: inline-block;
375
- padding: 6px 12px;
376
  border-radius: 5px;
377
  -moz-border-radius: 5px;
378
  -webkit-border-radius: 5px;
@@ -400,7 +407,7 @@
400
  .rt-tpg-container .layout3 .rt-holder .rt-detail h4 {
401
  font-size: 26px;
402
  margin: 0 0 14px 0;
403
- padding: 0px;
404
  font-weight: 400;
405
  line-height: 1.25;
406
  }
@@ -462,12 +469,12 @@
462
  }
463
 
464
  .rt-tpg-container .layout3 .rt-holder .rt-detail .read-more a {
465
- padding: 6px 12px;
466
  border-radius: 5px;
467
  -moz-border-radius: 5px;
468
  -webkit-border-radius: 5px;
469
  background: #337ab7;
470
  font-size: 15px;
 
471
  }
472
 
473
  .rt-tpg-container .layout3 .rt-holder .rt-img-holder > a img.rounded,
@@ -580,7 +587,6 @@
580
  }
581
 
582
  .rt-tpg-container .isotope1 .rt-holder .rt-detail .read-more a {
583
- padding: 6px 12px;
584
  border-radius: 5px;
585
  -moz-border-radius: 5px;
586
  -webkit-border-radius: 5px;
@@ -591,7 +597,7 @@
591
  /* isotope Buttons */
592
  .rt-tpg-container .rt-tpg-isotope-buttons {
593
  text-align: center;
594
- margin: 15px 0;
595
  }
596
 
597
  .rt-tpg-container .rt-tpg-isotope-buttons .selected {
@@ -601,7 +607,7 @@
601
  .rt-tpg-container .rt-tpg-isotope-buttons button {
602
  border: none;
603
  margin: 4px;
604
- padding: 6px 14px;
605
  outline: 0;
606
  text-transform: none;
607
  font-weight: 400;
164
  padding-right: 0;
165
  }
166
 
167
+ .rt-detail .post-content {
168
+ margin-bottom: 10px;
169
+ }
170
+
171
+ .rt-detail .read-more a {
172
+ padding: 8px 15px;
173
+ display: inline-block;
174
+ }
175
+
176
  /**********************************************************************/
177
  /********************************* Layout 1 *************************/
178
  /**********************************************************************/
239
 
240
  #poststuff .rt-tpg-container .layout1 .rt-holder .rt-detail h2,
241
  #poststuff .rt-tpg-container .layout1 .rt-holder .rt-detail h3,
242
+ #poststuff .rt-tpg-container .layout1 .rt-holder .rt-detail h4,
243
  .rt-tpg-container .layout1 .rt-holder .rt-detail h2,
244
  .rt-tpg-container .layout1 .rt-holder .rt-detail h3,
245
  .rt-tpg-container .layout1 .rt-holder .rt-detail h4 {
276
  }
277
 
278
  .rt-tpg-container .layout1 .rt-holder .rt-detail .read-more a {
 
279
  border-radius: 5px;
280
  -moz-border-radius: 5px;
281
  -webkit-border-radius: 5px;
380
 
381
  .rt-tpg-container .layout2 .rt-holder .rt-detail .read-more a {
382
  display: inline-block;
 
383
  border-radius: 5px;
384
  -moz-border-radius: 5px;
385
  -webkit-border-radius: 5px;
407
  .rt-tpg-container .layout3 .rt-holder .rt-detail h4 {
408
  font-size: 26px;
409
  margin: 0 0 14px 0;
410
+ padding: 0;
411
  font-weight: 400;
412
  line-height: 1.25;
413
  }
469
  }
470
 
471
  .rt-tpg-container .layout3 .rt-holder .rt-detail .read-more a {
 
472
  border-radius: 5px;
473
  -moz-border-radius: 5px;
474
  -webkit-border-radius: 5px;
475
  background: #337ab7;
476
  font-size: 15px;
477
+ display: inline-block;
478
  }
479
 
480
  .rt-tpg-container .layout3 .rt-holder .rt-img-holder > a img.rounded,
587
  }
588
 
589
  .rt-tpg-container .isotope1 .rt-holder .rt-detail .read-more a {
 
590
  border-radius: 5px;
591
  -moz-border-radius: 5px;
592
  -webkit-border-radius: 5px;
597
  /* isotope Buttons */
598
  .rt-tpg-container .rt-tpg-isotope-buttons {
599
  text-align: center;
600
+ margin: 15px 0 30px 0;
601
  }
602
 
603
  .rt-tpg-container .rt-tpg-isotope-buttons .selected {
607
  .rt-tpg-container .rt-tpg-isotope-buttons button {
608
  border: none;
609
  margin: 4px;
610
+ padding: 8px 15px;
611
  outline: 0;
612
  text-transform: none;
613
  font-weight: 400;
assets/images/rt-tpg-menu.png CHANGED
Binary file
assets/images/rt-tpg-sc.png CHANGED
Binary file
assets/images/rt-tpg_18.png CHANGED
Binary file
assets/images/rt-tpg_32.png CHANGED
Binary file
assets/js/admin.js CHANGED
@@ -1,24 +1,39 @@
1
  (function ($) {
2
  'use strict';
3
 
4
- if ($('#sc-tabs').length && $.fn.tabs) {
5
- $('#sc-tabs').tabs();
6
- }
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- if ($.fn.select2) {
9
  $(".rt-select2").select2({dropdownAutoWidth: true});
10
  }
 
11
  var postType = jQuery("#rc-sc-post-type").val();
12
  rtTgpFilter();
 
13
  thpShowHideScMeta();
14
  renderTpgPreview();
15
- $("#rttpg_meta").on('change', 'select,input', function () {
16
- renderTpgPreview();
17
- });
18
- $("#rttpg_meta").on("input propertychange", function () {
19
- renderTpgPreview();
20
- });
21
- if ($("#rttpg_meta .rt-color").length && $.fn.wpColorPicker) {
 
 
22
  var cOptions = {
23
  defaultColor: false,
24
  change: function (event, ui) {
@@ -30,17 +45,18 @@
30
  hide: true,
31
  palettes: true
32
  };
33
- $("#rttpg_meta .rt-color").wpColorPicker(cOptions);
34
  }
 
35
  $(document).on('change', '#post_filter input[type=checkbox]', function () {
36
  var id = $(this).val();
37
- if (id == 'tpg_taxonomy') {
38
  if (this.checked) {
39
  rtTPGTaxonomyListByPostType(postType, $(this));
40
  } else {
41
- jQuery('.rt-tpg-filter.taxonomy > .taxonomy-field').hide('slow').html('');
42
- jQuery('.rt-tpg-filter.taxonomy > .rt-tpg-filter-item .term-filter-holder').hide('slow').html('');
43
- jQuery('.rt-tpg-filter.taxonomy > .rt-tpg-filter-item .term-filter-item-relation').hide('slow');
44
  }
45
  }
46
  if (this.checked) {
@@ -58,17 +74,17 @@
58
 
59
  $(document).on('change', "#rt-tpg-pagination", function () {
60
  if (this.checked) {
61
- jQuery(".field-holder.posts-per-page").show();
62
  } else {
63
- jQuery(".field-holder.posts-per-page").hide();
64
  }
65
  });
66
 
67
  $(document).on('change', "#rt-feature-image", function () {
68
  if (this.checked) {
69
- jQuery(".field-holder.feature-image-options").hide();
70
  } else {
71
- jQuery(".field-holder.feature-image-options").show();
72
  }
73
  });
74
 
@@ -86,10 +102,23 @@
86
  $(".rt-tpg-filter.taxonomy > .taxonomy-field").html('');
87
  $(".rt-tpg-filter.taxonomy > .rt-tpg-filter-item .term-filter-item-container").remove();
88
  $(".rt-tpg-filter.hidden").hide();
89
- $(".field-holder.term-filter-item-relation ").hide();
90
  }
91
  });
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  function renderTpgPreview() {
95
  if ($("#rttpg_meta").length) {
@@ -129,7 +158,7 @@
129
  data: data,
130
  beforeSend: function () {
131
  if (element) {
132
- $("<span class='rt-loading'></span>").insertAfter(element);
133
  }
134
  },
135
  success: function (data) {
@@ -141,156 +170,137 @@
141
  });
142
  }
143
 
144
- })(jQuery);
145
 
146
- function rtTPGTaxonomyListByPostType(postType, $this) {
147
 
148
- var arg = "post_type=" + postType;
149
- tpgAjaxCall($this, 'rtTPGTaxonomyListByPostType', arg, function (data) {
150
- //console.log(data);
151
- if (data.error) {
152
- alert(data.msg);
153
- } else {
154
- jQuery('.rt-tpg-filter.taxonomy > .taxonomy-field').html(data.data).show('slow');
155
- }
156
- });
157
- }
158
-
159
- function rtTPGIsotopeFilter($this) {
160
- var arg = "post_type=" + $this.val();
161
- var bindElement = $this;
162
- var target = jQuery('.field-holder.sc-isotope-filter .field > select');
163
- tpgAjaxCall(bindElement, 'rtTPGIsotopeFilter', arg, function (data) {
164
- if (data.error) {
165
- alert(data.msg);
166
- } else {
167
- target.html(data.data);
168
- tgpLiveReloadScript();
169
- }
170
- });
171
- }
172
-
173
- function rtTPGTermListByTaxonomy($this) {
174
- var term = $this.val();
175
- var targetHolder = jQuery('.rt-tpg-filter.taxonomy').children('.rt-tpg-filter-item').children('.field-holder').children('.term-filter-holder');
176
- var target = targetHolder.children('.term-filter-item-container.' + term);
177
- if ($this.is(':checked')) {
178
- var arg = "taxonomy=" + $this.val();
179
- var bindElement = $this;
180
- tpgAjaxCall(bindElement, 'rtTPGTermListByTaxonomy', arg, function (data) {
181
  //console.log(data);
182
  if (data.error) {
183
  alert(data.msg);
184
  } else {
185
- targetHolder.show();
186
- jQuery(data.data).prependTo(targetHolder).fadeIn('slow');
187
- tgpLiveReloadScript();
188
  }
189
  });
190
- } else {
191
- target.hide('slow').html('').remove();
192
  }
193
 
194
- var termLength = jQuery('input[name="tpg_taxonomy[]"]:checked').length;
195
- if (termLength > 1) {
196
- jQuery('.field-holder.term-filter-item-relation ').show('slow');
197
- } else {
198
- jQuery('.field-holder.term-filter-item-relation ').hide('slow');
199
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
- }
202
-
203
- function rtTPGSettings(e) {
204
- jQuery('rt-response').hide();
205
- var arg = jQuery(e).serialize();
206
- var bindElement = jQuery('.rtSaveButton');
207
- tpgAjaxCall(bindElement, 'rtTPGSettings', arg, function (data) {
208
- if (data.error) {
209
- jQuery('.rt-response').addClass('updated');
210
- jQuery('.rt-response').removeClass('error');
211
- jQuery('.rt-response').show('slow').text(data.msg);
212
  } else {
213
- jQuery('.rt-response').addClass('error');
214
- jQuery('.rt-response').show('slow').text(data.msg);
215
  }
216
- });
 
217
 
218
- }
 
 
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- function tpgAjaxCall(element, action, arg, handle) {
222
- var data;
223
- if (action) data = "action=" + action;
224
- if (arg) data = arg + "&action=" + action;
225
- if (arg && !action) data = arg;
226
 
227
- var n = data.search(rttpg.nonceID);
228
- if (n < 0) {
229
- data = data + "&rttpg_nonce=" + rttpg.nonce;
 
 
 
 
 
 
 
 
 
230
  }
231
- jQuery.ajax({
232
- type: "post",
233
- url: rttpg.ajaxurl,
234
- data: data,
235
- beforeSend: function () {
236
- jQuery("<span class='rt-loading'></span>").insertAfter(element);
237
- },
238
- success: function (data) {
239
- jQuery(".rt-loading").remove();
240
- handle(data);
241
- }
242
- });
243
- }
244
 
245
- function rtTgpFilter() {
246
- jQuery("#post_filter input[type=checkbox]:checked").each(function () {
247
- var id = jQuery(this).val();
248
- jQuery(".rt-tpg-filter." + id).show();
249
- });
250
 
251
- jQuery("#post-taxonomy input[type=checkbox]:checked").each(function () {
252
- var id = jQuery(this).val();
253
- jQuery(".filter-item." + id).show();
254
- });
 
 
255
 
256
- }
257
 
258
- function thpShowHideScMeta() {
259
 
260
- var layout = jQuery("#rt-tpg-sc-layout").val();
261
- if (layout == 'isotope1') {
262
- jQuery(".field-holder.pagination, .field-holder.posts-per-page").hide();
263
- jQuery(".field-holder.sc-isotope-filter").show();
264
- } else {
265
- jQuery(".field-holder.pagination").show();
266
- jQuery(".field-holder.sc-isotope-filter").hide();
267
- var pagination = jQuery("#rt-tpg-pagination").is(':checked');
268
- if (pagination) {
269
- jQuery(".field-holder.posts-per-page").show();
270
  } else {
271
- jQuery(".field-holder.posts-per-page").hide();
 
 
 
 
 
 
 
272
  }
273
- }
274
- if (layout == 'layout2' || layout == 'layout3') {
275
- jQuery('.holder-layout2-image-column').show();
276
- } else {
277
- jQuery('.holder-layout2-image-column').hide();
278
- }
279
- if (jQuery("#post-taxonomy input[name='tpg_taxonomy[]']").is(":checked")) {
280
- jQuery(".rt-tpg-filter-item.term-filter-item").show();
281
- } else {
282
- jQuery(".rt-tpg-filter-item.term-filter-item").hide();
283
- }
284
 
 
 
 
 
 
285
 
286
- if (jQuery("#rt-feature-image").is(':checked')) {
287
- jQuery(".field-holder.feature-image-options").hide();
288
- } else {
289
- jQuery(".field-holder.feature-image-options").show();
290
  }
291
 
292
- }
 
293
 
294
- function tgpLiveReloadScript() {
295
- jQuery("select.rt-select2").select2({dropdownAutoWidth: true});
296
- }
1
  (function ($) {
2
  'use strict';
3
 
4
+ /* rt tab active navigation */
5
+ $(".rt-tab-nav li").on('click', 'a', function (e) {
6
+ e.preventDefault();
7
+ var $this = $(this),
8
+ container = $this.parents('.rt-tab-container'),
9
+ nav = container.children('.rt-tab-nav'),
10
+ content = container.children(".rt-tab-content"),
11
+ $id = $this.attr('href');
12
+ console.log($id);
13
+ content.hide();
14
+ nav.find('li').removeClass('active');
15
+ $this.parent().addClass('active');
16
+ container.find($id).show();
17
+ });
18
 
19
+ if ($(".rt-select2").length && $.fn.select2) {
20
  $(".rt-select2").select2({dropdownAutoWidth: true});
21
  }
22
+
23
  var postType = jQuery("#rc-sc-post-type").val();
24
  rtTgpFilter();
25
+ detailLinkEffect();
26
  thpShowHideScMeta();
27
  renderTpgPreview();
28
+ $("#rttpg_meta")
29
+ .on('change', 'select,input', function () {
30
+ renderTpgPreview();
31
+ })
32
+ .on("input propertychange", function () {
33
+ renderTpgPreview();
34
+ });
35
+ var colorSlt = $("#rttpg_meta .rt-color");
36
+ if (colorSlt.length && $.fn.wpColorPicker) {
37
  var cOptions = {
38
  defaultColor: false,
39
  change: function (event, ui) {
45
  hide: true,
46
  palettes: true
47
  };
48
+ colorSlt.wpColorPicker(cOptions);
49
  }
50
+
51
  $(document).on('change', '#post_filter input[type=checkbox]', function () {
52
  var id = $(this).val();
53
+ if (id === 'tpg_taxonomy') {
54
  if (this.checked) {
55
  rtTPGTaxonomyListByPostType(postType, $(this));
56
  } else {
57
+ $('.rt-tpg-filter.taxonomy > .taxonomy-field').hide('slow').html('');
58
+ $('.rt-tpg-filter.taxonomy > .rt-tpg-filter-item .term-filter-holder').hide('slow').html('');
59
+ $('.rt-tpg-filter.taxonomy > .rt-tpg-filter-item .term-filter-item-relation').hide('slow');
60
  }
61
  }
62
  if (this.checked) {
74
 
75
  $(document).on('change', "#rt-tpg-pagination", function () {
76
  if (this.checked) {
77
+ $(".rt-field-wrapper.posts-per-page").show();
78
  } else {
79
+ $(".rt-field-wrapper.posts-per-page").hide();
80
  }
81
  });
82
 
83
  $(document).on('change', "#rt-feature-image", function () {
84
  if (this.checked) {
85
+ $(".rt-field-wrapper.feature-image-options").hide();
86
  } else {
87
+ $(".rt-field-wrapper.feature-image-options").show();
88
  }
89
  });
90
 
102
  $(".rt-tpg-filter.taxonomy > .taxonomy-field").html('');
103
  $(".rt-tpg-filter.taxonomy > .rt-tpg-filter-item .term-filter-item-container").remove();
104
  $(".rt-tpg-filter.hidden").hide();
105
+ $(".rt-field-wrapper.term-filter-item-relation ").hide();
106
  }
107
  });
108
 
109
+ $("#link_to_detail_page_holder").on("click", "input[type='radio']", function () {
110
+ detailLinkEffect();
111
+ });
112
+
113
+ function detailLinkEffect() {
114
+ var detailPageLink = $("#link_to_detail_page_holder input[name='link_to_detail_page']:checked").val();
115
+ if (detailPageLink === "yes") {
116
+ $(".rt-field-wrapper.tpg-link-target").show();
117
+ } else {
118
+ $(".rt-field-wrapper.tpg-link-target").hide();
119
+ }
120
+ }
121
+
122
 
123
  function renderTpgPreview() {
124
  if ($("#rttpg_meta").length) {
158
  data: data,
159
  beforeSend: function () {
160
  if (element) {
161
+ $("<span class='rt-loading'> </span>").insertAfter(element);
162
  }
163
  },
164
  success: function (data) {
170
  });
171
  }
172
 
 
173
 
174
+ function rtTPGTaxonomyListByPostType(postType, $this) {
175
 
176
+ var arg = "post_type=" + postType;
177
+ tpgAjaxCall($this, 'rtTPGTaxonomyListByPostType', arg, function (data) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  //console.log(data);
179
  if (data.error) {
180
  alert(data.msg);
181
  } else {
182
+ jQuery('.rt-tpg-filter.taxonomy > .taxonomy-field').html(data.data).show('slow');
 
 
183
  }
184
  });
 
 
185
  }
186
 
187
+ function rtTPGTermListByTaxonomy($this) {
188
+ var term = $this.val();
189
+ var targetHolder = jQuery('.rt-tpg-filter.taxonomy').children('.rt-tpg-filter-item').children('.rt-field-wrapper').children('.term-filter-holder');
190
+ var target = targetHolder.children('.term-filter-item-container.' + term);
191
+ if ($this.is(':checked')) {
192
+ var arg = "taxonomy=" + $this.val();
193
+ var bindElement = $this;
194
+ tpgAjaxCall(bindElement, 'rtTPGTermListByTaxonomy', arg, function (data) {
195
+ //console.log(data);
196
+ if (data.error) {
197
+ alert(data.msg);
198
+ } else {
199
+ targetHolder.show();
200
+ jQuery(data.data).prependTo(targetHolder).fadeIn('slow');
201
+ tgpLiveReloadScript();
202
+ }
203
+ });
204
+ } else {
205
+ target.hide('slow').html('').remove();
206
+ }
207
 
208
+ var termLength = jQuery('input[name="tpg_taxonomy[]"]:checked').length;
209
+ if (termLength > 1) {
210
+ jQuery('.rt-field-wrapper.term-filter-item-relation ').show('slow');
 
 
 
 
 
 
 
 
211
  } else {
212
+ jQuery('.rt-field-wrapper.term-filter-item-relation ').hide('slow');
 
213
  }
214
+ }
215
+
216
 
217
+ function tgpLiveReloadScript() {
218
+ $("select.rt-select2").select2({dropdownAutoWidth: true});
219
+ }
220
 
221
+ $("#rt-tpg-settings-form").on('submit', function (e) {
222
+ e.preventDefault();
223
+ var form = $(this),
224
+ response_wrap = form.next('.rt-response'),
225
+ arg = form.serialize(),
226
+ bindElement = form.find('.rtSaveButton');
227
+ response_wrap.hide();
228
+ tpgAjaxCall(bindElement, 'rtTPGSettings', arg, function (data) {
229
+ if (!data.error) {
230
+ response_wrap.removeClass('error').addClass('success');
231
+ response_wrap.show('slow').text(data.msg);
232
+ } else {
233
+ response_wrap.addClass('error').removeClass('success');
234
+ response_wrap.show('slow').text(data.msg);
235
+ }
236
+ });
237
+ });
238
 
 
 
 
 
 
239
 
240
+ function rtTPGIsotopeFilter($this) {
241
+ var arg = "post_type=" + $this.val();
242
+ var bindElement = $this;
243
+ var target = jQuery('.rt-field-wrapper.sc-isotope-filter .field > select');
244
+ tpgAjaxCall(bindElement, 'rtTPGIsotopeFilter', arg, function (data) {
245
+ if (data.error) {
246
+ alert(data.msg);
247
+ } else {
248
+ target.html(data.data);
249
+ tgpLiveReloadScript();
250
+ }
251
+ });
252
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
253
 
254
+ function rtTgpFilter() {
255
+ $("#post_filter input[type=checkbox]:checked").each(function () {
256
+ var id = $(this).val();
257
+ $(".rt-tpg-filter." + id).show();
258
+ });
259
 
260
+ $("#post-taxonomy input[type=checkbox]:checked").each(function () {
261
+ var id = $(this).val();
262
+ $(".filter-item." + id).show();
263
+ });
264
+
265
+ }
266
 
 
267
 
268
+ function thpShowHideScMeta() {
269
 
270
+ var layout = $("#rt-tpg-sc-layout").val();
271
+ if (layout === 'isotope1') {
272
+ $(".rt-field-wrapper.pagination, .rt-field-wrapper.posts-per-page").hide();
273
+ $(".rt-field-wrapper.sc-isotope-filter").show();
 
 
 
 
 
 
274
  } else {
275
+ $(".rt-field-wrapper.pagination").show();
276
+ $(".rt-field-wrapper.sc-isotope-filter").hide();
277
+ var pagination = $("#rt-tpg-pagination").is(':checked');
278
+ if (pagination) {
279
+ $(".rt-field-wrapper.posts-per-page").show();
280
+ } else {
281
+ $(".rt-field-wrapper.posts-per-page").hide();
282
+ }
283
  }
284
+ if (layout === 'layout2' || layout === 'layout3') {
285
+ $('.holder-layout2-image-column').show();
286
+ } else {
287
+ $('.holder-layout2-image-column').hide();
288
+ }
289
+ if ($("#post-taxonomy input[name='tpg_taxonomy[]']").is(":checked")) {
290
+ $(".rt-tpg-filter-item.term-filter-item").show();
291
+ } else {
292
+ $(".rt-tpg-filter-item.term-filter-item").hide();
293
+ }
294
+
295
 
296
+ if ($("#rt-feature-image").is(':checked')) {
297
+ $(".rt-field-wrapper.feature-image-options").hide();
298
+ } else {
299
+ $(".rt-field-wrapper.feature-image-options").show();
300
+ }
301
 
 
 
 
 
302
  }
303
 
304
+ })(jQuery);
305
+
306
 
 
 
 
languages/the-post-grid.pot CHANGED
@@ -3,8 +3,8 @@ msgid ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: The Post Grid\n"
6
- "POT-Creation-Date: 2019-08-26 12:13+0600\n"
7
- "PO-Revision-Date: 2019-08-26 12:12+0600\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
@@ -20,32 +20,32 @@ msgstr ""
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
- #: lib/classes/rtTPGAjaxResponse.php:26
24
  msgid "Settings successfully updated"
25
  msgstr ""
26
 
27
- #: lib/classes/rtTPGAjaxResponse.php:28
28
  msgid "Security Error !!"
29
  msgstr ""
30
 
31
- #: lib/classes/rtTPGAjaxResponse.php:56
32
- msgid "<div class=\"field-holder\">No Taxonomy found</div>"
33
  msgstr ""
34
 
35
- #: lib/classes/rtTPGAjaxResponse.php:60 lib/classes/rtTPGAjaxResponse.php:79
36
- #: lib/classes/rtTPGAjaxResponse.php:118
37
  msgid "Security error"
38
  msgstr ""
39
 
40
- #: lib/classes/rtTPGAjaxResponse.php:137
41
  msgid "Select Short code"
42
  msgstr ""
43
 
44
- #: lib/classes/rtTPGAjaxResponse.php:139
45
  msgid "Default"
46
  msgstr ""
47
 
48
- #: lib/classes/rtTPGAjaxResponse.php:148
49
  msgid "No shortCode found."
50
  msgstr ""
51
 
@@ -96,35 +96,49 @@ msgstr ""
96
  msgid "Settings"
97
  msgstr ""
98
 
99
- #: lib/classes/rtTPGMeta.php:27
100
  msgid "Shortcode"
101
  msgstr ""
102
 
103
- #: lib/classes/rtTPGMeta.php:85
104
  msgid "Short Code Generator"
105
  msgstr ""
106
 
107
- #: lib/classes/rtTPGMeta.php:92
108
- msgid "Pro Features"
109
  msgstr ""
110
 
111
- #: lib/classes/rtTPGMeta.php:99
112
- msgid "Layout Preview"
 
 
 
 
 
 
 
 
 
 
113
  msgstr ""
114
 
115
- #: lib/classes/rtTPGMeta.php:141
 
 
 
 
116
  msgid "Post Source"
117
  msgstr ""
118
 
119
- #: lib/classes/rtTPGMeta.php:142
120
  msgid "Layout Settings"
121
  msgstr ""
122
 
123
- #: lib/classes/rtTPGMeta.php:143
124
  msgid "Field Selection"
125
  msgstr ""
126
 
127
- #: lib/classes/rtTPGMeta.php:144
128
  msgid "Style"
129
  msgstr ""
130
 
@@ -157,7 +171,7 @@ msgid "Show all text"
157
  msgstr ""
158
 
159
  #: lib/classes/rtTPGOptions.php:191 lib/classes/rtTPGShortCode.php:71
160
- #: lib/classes/rtTPGShortCode.php:100
161
  msgid "Show all"
162
  msgstr ""
163
 
@@ -214,72 +228,96 @@ msgstr ""
214
  msgid "Title tag"
215
  msgstr ""
216
 
217
- #: lib/classes/rtTPGOptions.php:380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  msgid "Title color"
219
  msgstr ""
220
 
221
- #: lib/classes/rtTPGOptions.php:387
222
  msgid "Title hover color"
223
  msgstr ""
224
 
225
- #: lib/classes/rtTPGOptions.php:396
226
  msgid "Read more button border radius"
227
  msgstr ""
228
 
229
- #: lib/classes/rtTPGOptions.php:397
230
  msgid "Leave it blank for default"
231
  msgstr ""
232
 
233
- #: lib/classes/rtTPGOptions.php:426
234
  msgid "Feature Image"
235
  msgstr ""
236
 
237
- #: lib/classes/rtTPGOptions.php:427
238
  msgid "First Image from content"
239
  msgstr ""
240
 
241
- #: lib/classes/rtTPGOptions.php:455
242
  msgid "Title"
243
  msgstr ""
244
 
245
- #: lib/classes/rtTPGOptions.php:456
246
  msgid "Excerpt"
247
  msgstr ""
248
 
249
- #: lib/classes/rtTPGOptions.php:457 lib/classes/rtTPGShortCode.php:69
250
- #: lib/classes/rtTPGShortCode.php:98
251
  msgid "Read More"
252
  msgstr ""
253
 
254
- #: lib/classes/rtTPGOptions.php:458
255
  msgid "Post Date"
256
  msgstr ""
257
 
258
- #: lib/classes/rtTPGOptions.php:459
259
  msgid "Author"
260
  msgstr ""
261
 
262
- #: lib/classes/rtTPGOptions.php:460
263
  msgid "Categories"
264
  msgstr ""
265
 
266
- #: lib/classes/rtTPGOptions.php:461
267
  msgid "Tags"
268
  msgstr ""
269
 
270
- #: lib/classes/rtTPGOptions.php:462
271
  msgid "Comment Count"
272
  msgstr ""
273
 
274
- #: lib/classes/rtTPGShortCode.php:342
 
 
 
 
275
  msgid "No post found"
276
  msgstr ""
277
 
278
- #: lib/classes/rtTPGShortCode.php:370
279
  msgid "Session Error !!"
280
  msgstr ""
281
 
282
- #: lib/classes/rtTPGShortCode.php:372
283
  msgid "No shortCode found"
284
  msgstr ""
285
 
@@ -287,7 +325,19 @@ msgstr ""
287
  msgid "Post Grid"
288
  msgstr ""
289
 
290
- #: lib/views/settings/settings.php:5
 
 
 
 
 
 
 
 
 
 
 
 
291
  msgid "The Post Grid Settings"
292
  msgstr ""
293
 
@@ -295,8 +345,8 @@ msgstr ""
295
  msgid "General settings"
296
  msgstr ""
297
 
298
- #: lib/views/settings/settings.php:9
299
- msgid "Documentation"
300
  msgstr ""
301
 
302
  #: lib/widgets/RT_TPGWidget.php:14
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: The Post Grid\n"
6
+ "POT-Creation-Date: 2020-02-12 16:37+0600\n"
7
+ "PO-Revision-Date: 2020-02-12 16:37+0600\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
+ #: lib/classes/rtTPGAjaxResponse.php:27
24
  msgid "Settings successfully updated"
25
  msgstr ""
26
 
27
+ #: lib/classes/rtTPGAjaxResponse.php:29
28
  msgid "Security Error !!"
29
  msgstr ""
30
 
31
+ #: lib/classes/rtTPGAjaxResponse.php:57
32
+ msgid "No Taxonomy found"
33
  msgstr ""
34
 
35
+ #: lib/classes/rtTPGAjaxResponse.php:61 lib/classes/rtTPGAjaxResponse.php:80
36
+ #: lib/classes/rtTPGAjaxResponse.php:119
37
  msgid "Security error"
38
  msgstr ""
39
 
40
+ #: lib/classes/rtTPGAjaxResponse.php:138
41
  msgid "Select Short code"
42
  msgstr ""
43
 
44
+ #: lib/classes/rtTPGAjaxResponse.php:140
45
  msgid "Default"
46
  msgstr ""
47
 
48
+ #: lib/classes/rtTPGAjaxResponse.php:149
49
  msgid "No shortCode found."
50
  msgstr ""
51
 
96
  msgid "Settings"
97
  msgstr ""
98
 
99
+ #: lib/classes/rtTPGMeta.php:28
100
  msgid "Shortcode"
101
  msgstr ""
102
 
103
+ #: lib/classes/rtTPGMeta.php:83
104
  msgid "Short Code Generator"
105
  msgstr ""
106
 
107
+ #: lib/classes/rtTPGMeta.php:90
108
+ msgid "Layout Preview"
109
  msgstr ""
110
 
111
+ #: lib/classes/rtTPGMeta.php:98 lib/classes/rtTPGMeta.php:123
112
+ msgid "Documentation"
113
+ msgstr ""
114
+
115
+ #: lib/classes/rtTPGMeta.php:110
116
+ msgid "Update Pro To Get More Features"
117
+ msgstr ""
118
+
119
+ #: lib/classes/rtTPGMeta.php:124
120
+ msgid ""
121
+ "Get started by spending some time with the documentation we included step by "
122
+ "step process with screenshots with video."
123
  msgstr ""
124
 
125
+ #: lib/classes/rtTPGMeta.php:133
126
+ msgid "Get Support"
127
+ msgstr ""
128
+
129
+ #: lib/classes/rtTPGMeta.php:174
130
  msgid "Post Source"
131
  msgstr ""
132
 
133
+ #: lib/classes/rtTPGMeta.php:175
134
  msgid "Layout Settings"
135
  msgstr ""
136
 
137
+ #: lib/classes/rtTPGMeta.php:176
138
  msgid "Field Selection"
139
  msgstr ""
140
 
141
+ #: lib/classes/rtTPGMeta.php:177
142
  msgid "Style"
143
  msgstr ""
144
 
171
  msgstr ""
172
 
173
  #: lib/classes/rtTPGOptions.php:191 lib/classes/rtTPGShortCode.php:71
174
+ #: lib/classes/rtTPGShortCode.php:101
175
  msgid "Show all"
176
  msgstr ""
177
 
228
  msgid "Title tag"
229
  msgstr ""
230
 
231
+ #: lib/classes/rtTPGOptions.php:322
232
+ msgid "Link To Detail Page"
233
+ msgstr ""
234
+
235
+ #: lib/classes/rtTPGOptions.php:333
236
+ msgid "Link Target"
237
+ msgstr ""
238
+
239
+ #: lib/classes/rtTPGOptions.php:346
240
+ msgid "Character"
241
+ msgstr ""
242
+
243
+ #: lib/classes/rtTPGOptions.php:347
244
+ msgid "Word"
245
+ msgstr ""
246
+
247
+ #: lib/classes/rtTPGOptions.php:350
248
+ msgid "Full Content"
249
+ msgstr ""
250
+
251
+ #: lib/classes/rtTPGOptions.php:405
252
  msgid "Title color"
253
  msgstr ""
254
 
255
+ #: lib/classes/rtTPGOptions.php:412
256
  msgid "Title hover color"
257
  msgstr ""
258
 
259
+ #: lib/classes/rtTPGOptions.php:421
260
  msgid "Read more button border radius"
261
  msgstr ""
262
 
263
+ #: lib/classes/rtTPGOptions.php:422
264
  msgid "Leave it blank for default"
265
  msgstr ""
266
 
267
+ #: lib/classes/rtTPGOptions.php:451
268
  msgid "Feature Image"
269
  msgstr ""
270
 
271
+ #: lib/classes/rtTPGOptions.php:452
272
  msgid "First Image from content"
273
  msgstr ""
274
 
275
+ #: lib/classes/rtTPGOptions.php:480
276
  msgid "Title"
277
  msgstr ""
278
 
279
+ #: lib/classes/rtTPGOptions.php:481
280
  msgid "Excerpt"
281
  msgstr ""
282
 
283
+ #: lib/classes/rtTPGOptions.php:482 lib/classes/rtTPGShortCode.php:69
284
+ #: lib/classes/rtTPGShortCode.php:99
285
  msgid "Read More"
286
  msgstr ""
287
 
288
+ #: lib/classes/rtTPGOptions.php:483
289
  msgid "Post Date"
290
  msgstr ""
291
 
292
+ #: lib/classes/rtTPGOptions.php:484
293
  msgid "Author"
294
  msgstr ""
295
 
296
+ #: lib/classes/rtTPGOptions.php:485
297
  msgid "Categories"
298
  msgstr ""
299
 
300
+ #: lib/classes/rtTPGOptions.php:486
301
  msgid "Tags"
302
  msgstr ""
303
 
304
+ #: lib/classes/rtTPGOptions.php:487
305
  msgid "Comment Count"
306
  msgstr ""
307
 
308
+ #: lib/classes/rtTPGOptions.php:508
309
+ msgid "Get Pro Version"
310
+ msgstr ""
311
+
312
+ #: lib/classes/rtTPGShortCode.php:352
313
  msgid "No post found"
314
  msgstr ""
315
 
316
+ #: lib/classes/rtTPGShortCode.php:380
317
  msgid "Session Error !!"
318
  msgstr ""
319
 
320
+ #: lib/classes/rtTPGShortCode.php:382
321
  msgid "No shortCode found"
322
  msgstr ""
323
 
325
  msgid "Post Grid"
326
  msgstr ""
327
 
328
+ #: lib/views/settings/post-source.php:19
329
+ msgid "Advance filter options"
330
+ msgstr ""
331
+
332
+ #: lib/views/settings/post-source.php:103
333
+ msgid "Terms"
334
+ msgstr ""
335
+
336
+ #: lib/views/settings/post-source.php:125
337
+ msgid "Order Settings"
338
+ msgstr ""
339
+
340
+ #: lib/views/settings/settings.php:3
341
  msgid "The Post Grid Settings"
342
  msgstr ""
343
 
345
  msgid "General settings"
346
  msgstr ""
347
 
348
+ #: lib/views/settings/settings.php:14
349
+ msgid "Save Changes"
350
  msgstr ""
351
 
352
  #: lib/widgets/RT_TPGWidget.php:14
lib/classes/rtTPGAjaxResponse.php CHANGED
@@ -1,156 +1,157 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'rtTPGAjaxResponse' ) ):
4
 
5
- class rtTPGAjaxResponse {
6
- function __construct() {
7
- add_action( 'wp_ajax_rtTPGSettings', array( $this, 'rtTPGSaveSettings' ) );
8
- add_action( 'wp_ajax_rtTPGShortCodeList', array( $this, 'shortCodeList' ) );
9
- add_action( 'wp_ajax_rtTPGTaxonomyListByPostType', array( $this, 'rtTPGTaxonomyListByPostType' ) );
10
- add_action( 'wp_ajax_rtTPGIsotopeFilter', array( $this, 'rtTPGIsotopeFilter' ) );
11
- add_action( 'wp_ajax_rtTPGTermListByTaxonomy', array( $this, 'rtTPGTermListByTaxonomy' ) );
12
- }
 
13
 
14
- function rtTPGSaveSettings() {
15
- global $rtTPG;
16
- $rtTPG->rtTPGSettingFields();
17
- $error = true;
18
- $msg = null;
19
 
20
- if ( $rtTPG->verifyNonce() ) {
21
- unset( $_REQUEST['action'] );
22
- unset( $_REQUEST[ $rtTPG->nonceId() ] );
23
- unset( $_REQUEST['_wp_http_referer'] );
24
- update_option( $rtTPG->options['settings'], $_REQUEST );
25
- $error = true;
26
- $msg = __( 'Settings successfully updated', 'the-post-grid' );
27
- } else {
28
- $msg = __( 'Security Error !!', 'the-post-grid' );
29
- }
30
- wp_send_json( array(
31
- 'error' => $error,
32
- 'msg' => $msg
33
- ) );
34
- die();
35
- }
36
 
37
- function rtTPGTaxonomyListByPostType() {
38
- global $rtTPG;
39
- $error = true;
40
- $msg = $data = null;
41
- if ( $rtTPG->verifyNonce() ) {
42
- $error = false;
43
- $taxonomies = $rtTPG->rt_get_all_taxonomy_by_post_type( isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : null );
44
- if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
45
- $data .= $rtTPG->rtFieldGenerator(
46
- array(
47
- 'type' => 'checkbox',
48
- 'name' => 'tpg_taxonomy',
49
- 'label' => 'Taxonomy',
50
- 'id' => 'post-taxonomy',
51
- "multiple" => true,
52
- 'options' => $taxonomies
53
- )
54
- );
55
- } else {
56
- $data = __( '<div class="field-holder">No Taxonomy found</div>', 'the-post-grid' );
57
- }
58
 
59
- } else {
60
- $msg = __( 'Security error', 'the-post-grid' );
61
- }
62
- wp_send_json( array( 'error' => $error, 'msg' => $msg, 'data' => $data ) );
63
- die();
64
- }
65
 
66
- function rtTPGIsotopeFilter() {
67
- global $rtTPG;
68
- $error = true;
69
- $msg = $data = null;
70
- if ( $rtTPG->verifyNonce() ) {
71
- $error = false;
72
- $taxonomies = $rtTPG->rt_get_taxonomy_for_isotope_filter( isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : null );
73
- if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
74
- foreach ( $taxonomies as $tKey => $tax ) {
75
- $data .= "<option value='{$tKey}'>{$tax}</option>";
76
- }
77
- }
78
- } else {
79
- $msg = __( 'Security error', 'the-post-grid' );
80
- }
81
- wp_send_json( array( 'error' => $error, 'msg' => $msg, 'data' => $data ) );
82
- die();
83
- }
84
 
85
- function rtTPGTermListByTaxonomy() {
86
- global $rtTPG;
87
- $error = true;
88
- $msg = $data = null;
89
- if ( $rtTPG->verifyNonce() ) {
90
- $error = false;
91
- $taxonomy = isset( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : null;
92
- $data .= "<div class='term-filter-item-container {$taxonomy}'>";
93
- $data .= $rtTPG->rtFieldGenerator(
94
- array(
95
- 'type' => 'select',
96
- 'name' => 'term_' . $taxonomy,
97
- 'label' => ucfirst( str_replace( '_', ' ', $taxonomy ) ),
98
- 'class' => 'rt-select2 full',
99
- 'id' => 'term-' . mt_rand(),
100
- 'holderClass' => "term-filter-item {$taxonomy}",
101
- 'value' => null,
102
- "multiple" => true,
103
- 'options' => $rtTPG->rt_get_all_term_by_taxonomy( $taxonomy )
104
- )
105
- );
106
- $data .= $rtTPG->rtFieldGenerator(
107
- array(
108
- 'type' => 'select',
109
- 'name' => 'term_operator_' . $taxonomy,
110
- 'label' => 'Operator',
111
- 'class' => 'rt-select2 full',
112
- 'holderClass' => "term-filter-item-operator {$taxonomy}",
113
- 'options' => $rtTPG->rtTermOperators()
114
- )
115
- );
116
- $data .= "</div>";
117
- } else {
118
- $msg = __( 'Security error', 'the-post-grid' );
119
- }
120
- wp_send_json( array( 'error' => $error, 'msg' => $msg, 'data' => $data ) );
121
- die();
122
- }
123
 
124
- function shortCodeList() {
125
- global $rtTPG;
126
- $html = null;
127
- $scQ = new WP_Query( array( 'post_type' => $rtTPG->post_type,
128
- 'order_by' => 'title',
129
- 'order' => 'DESC',
130
- 'post_status' => 'publish',
131
- 'posts_per_page' => - 1
132
- ) );
133
- if ( $scQ->have_posts() ) {
134
 
135
- $html .= "<div class='mce-container mce-form'>";
136
- $html .= "<div class='mce-container-body'>";
137
- $html .= '<label class="mce-widget mce-label" style="padding: 20px;font-weight: bold;" for="scid">' . __( 'Select Short code', 'the-post-grid' ) . '</label>';
138
- $html .= "<select name='id' id='scid' style='width: 150px;margin: 15px;'>";
139
- $html .= "<option value=''>" . __( 'Default', 'the-post-grid' ) . "</option>";
140
- while ( $scQ->have_posts() ) {
141
- $scQ->the_post();
142
- $html .= "<option value='" . get_the_ID() . "'>" . get_the_title() . "</option>";
143
- }
144
- $html .= "</select>";
145
- $html .= "</div>";
146
- $html .= "</div>";
147
- } else {
148
- $html .= "<div>" . __( 'No shortCode found.', 'the-post-grid' ) . "</div>";
149
- }
150
- echo $html;
151
- die();
152
- }
153
 
154
- }
155
 
156
  endif;
1
  <?php
2
 
3
+ if (!class_exists('rtTPGAjaxResponse')):
4
 
5
+ class rtTPGAjaxResponse
6
+ {
7
+ function __construct() {
8
+ add_action('wp_ajax_rtTPGSettings', array($this, 'rtTPGSaveSettings'));
9
+ add_action('wp_ajax_rtTPGShortCodeList', array($this, 'shortCodeList'));
10
+ add_action('wp_ajax_rtTPGTaxonomyListByPostType', array($this, 'rtTPGTaxonomyListByPostType'));
11
+ add_action('wp_ajax_rtTPGIsotopeFilter', array($this, 'rtTPGIsotopeFilter'));
12
+ add_action('wp_ajax_rtTPGTermListByTaxonomy', array($this, 'rtTPGTermListByTaxonomy'));
13
+ }
14
 
15
+ function rtTPGSaveSettings() {
16
+ global $rtTPG;
17
+ $rtTPG->rtTPGSettingFields();
18
+ $error = true;
19
+ $msg = null;
20
 
21
+ if ($rtTPG->verifyNonce()) {
22
+ unset($_REQUEST['action']);
23
+ unset($_REQUEST[$rtTPG->nonceId()]);
24
+ unset($_REQUEST['_wp_http_referer']);
25
+ update_option($rtTPG->options['settings'], $_REQUEST);
26
+ $error = false;
27
+ $msg = __('Settings successfully updated', 'the-post-grid');
28
+ } else {
29
+ $msg = __('Security Error !!', 'the-post-grid');
30
+ }
31
+ wp_send_json(array(
32
+ 'error' => $error,
33
+ 'msg' => $msg
34
+ ));
35
+ die();
36
+ }
37
 
38
+ function rtTPGTaxonomyListByPostType() {
39
+ global $rtTPG;
40
+ $error = true;
41
+ $msg = $data = null;
42
+ if ($rtTPG->verifyNonce()) {
43
+ $error = false;
44
+ $taxonomies = $rtTPG->rt_get_all_taxonomy_by_post_type(isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : null);
45
+ if (is_array($taxonomies) && !empty($taxonomies)) {
46
+ $data .= $rtTPG->rtFieldGenerator(
47
+ array(
48
+ 'type' => 'checkbox',
49
+ 'name' => 'tpg_taxonomy',
50
+ 'label' => 'Taxonomy',
51
+ 'id' => 'post-taxonomy',
52
+ "multiple" => true,
53
+ 'options' => $taxonomies
54
+ )
55
+ );
56
+ } else {
57
+ $data = '<div class="rt-field-wrapper">' . __('No Taxonomy found', 'the-post-grid') . '</div>';
58
+ }
59
 
60
+ } else {
61
+ $msg = __('Security error', 'the-post-grid');
62
+ }
63
+ wp_send_json(array('error' => $error, 'msg' => $msg, 'data' => $data));
64
+ die();
65
+ }
66
 
67
+ function rtTPGIsotopeFilter() {
68
+ global $rtTPG;
69
+ $error = true;
70
+ $msg = $data = null;
71
+ if ($rtTPG->verifyNonce()) {
72
+ $error = false;
73
+ $taxonomies = $rtTPG->rt_get_taxonomy_for_isotope_filter(isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : null);
74
+ if (is_array($taxonomies) && !empty($taxonomies)) {
75
+ foreach ($taxonomies as $tKey => $tax) {
76
+ $data .= "<option value='{$tKey}'>{$tax}</option>";
77
+ }
78
+ }
79
+ } else {
80
+ $msg = __('Security error', 'the-post-grid');
81
+ }
82
+ wp_send_json(array('error' => $error, 'msg' => $msg, 'data' => $data));
83
+ die();
84
+ }
85
 
86
+ function rtTPGTermListByTaxonomy() {
87
+ global $rtTPG;
88
+ $error = true;
89
+ $msg = $data = null;
90
+ if ($rtTPG->verifyNonce()) {
91
+ $error = false;
92
+ $taxonomy = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : null;
93
+ $data .= "<div class='term-filter-item-container {$taxonomy}'>";
94
+ $data .= $rtTPG->rtFieldGenerator(
95
+ array(
96
+ 'type' => 'select',
97
+ 'name' => 'term_' . $taxonomy,
98
+ 'label' => ucfirst(str_replace('_', ' ', $taxonomy)),
99
+ 'class' => 'rt-select2 full',
100
+ 'id' => 'term-' . mt_rand(),
101
+ 'holderClass' => "term-filter-item {$taxonomy}",
102
+ 'value' => null,
103
+ "multiple" => true,
104
+ 'options' => $rtTPG->rt_get_all_term_by_taxonomy($taxonomy)
105
+ )
106
+ );
107
+ $data .= $rtTPG->rtFieldGenerator(
108
+ array(
109
+ 'type' => 'select',
110
+ 'name' => 'term_operator_' . $taxonomy,
111
+ 'label' => 'Operator',
112
+ 'class' => 'rt-select2 full',
113
+ 'holderClass' => "term-filter-item-operator {$taxonomy}",
114
+ 'options' => $rtTPG->rtTermOperators()
115
+ )
116
+ );
117
+ $data .= "</div>";
118
+ } else {
119
+ $msg = __('Security error', 'the-post-grid');
120
+ }
121
+ wp_send_json(array('error' => $error, 'msg' => $msg, 'data' => $data));
122
+ die();
123
+ }
124
 
125
+ function shortCodeList() {
126
+ global $rtTPG;
127
+ $html = null;
128
+ $scQ = new WP_Query(array('post_type' => $rtTPG->post_type,
129
+ 'order_by' => 'title',
130
+ 'order' => 'DESC',
131
+ 'post_status' => 'publish',
132
+ 'posts_per_page' => -1
133
+ ));
134
+ if ($scQ->have_posts()) {
135
 
136
+ $html .= "<div class='mce-container mce-form'>";
137
+ $html .= "<div class='mce-container-body'>";
138
+ $html .= '<label class="mce-widget mce-label" style="padding: 20px;font-weight: bold;" for="scid">' . __('Select Short code', 'the-post-grid') . '</label>';
139
+ $html .= "<select name='id' id='scid' style='width: 150px;margin: 15px;'>";
140
+ $html .= "<option value=''>" . __('Default', 'the-post-grid') . "</option>";
141
+ while ($scQ->have_posts()) {
142
+ $scQ->the_post();
143
+ $html .= "<option value='" . get_the_ID() . "'>" . get_the_title() . "</option>";
144
+ }
145
+ $html .= "</select>";
146
+ $html .= "</div>";
147
+ $html .= "</div>";
148
+ } else {
149
+ $html .= "<div>" . __('No shortCode found.', 'the-post-grid') . "</div>";
150
+ }
151
+ echo $html;
152
+ die();
153
+ }
154
 
155
+ }
156
 
157
  endif;
lib/classes/rtTPGHelper.php CHANGED
@@ -1,359 +1,338 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'rtTPGHelper' ) ):
4
-
5
- class rtTPGHelper {
6
- function verifyNonce() {
7
- global $rtTPG;
8
- $nonce = isset( $_REQUEST[ $this->nonceId() ] ) ? $_REQUEST[ $this->nonceId() ] : null;
9
- $nonceText = $rtTPG->nonceText();
10
- if ( ! wp_verify_nonce( $nonce, $nonceText ) ) {
11
- return false;
12
- }
13
-
14
- return true;
15
- }
16
-
17
- function nonceText() {
18
- return "rttpg_nonce_secret";
19
- }
20
-
21
- function nonceId() {
22
- return "rttpg_nonce";
23
- }
24
-
25
- function rtAllOptionFields() {
26
- global $rtTPG;
27
- $fields = array();
28
- $fieldsA = array_merge(
29
- $rtTPG->rtTPGCommonFilterFields(),
30
- $rtTPG->rtTPGLayoutSettingFields(),
31
- $rtTPG->rtTPGStyleFields()
32
- );
33
- foreach ( $fieldsA as $field ) {
34
- $fields[] = $field;
35
- }
36
- array_push( $fields, $rtTPG->rtTPGPostType() );
37
- array_push( $fields, $rtTPG->rtTPAdvanceFilters() );
38
- array_push( $fields, $rtTPG->itemFields() );
39
-
40
- return $fields;
41
- }
42
-
43
- function rt_get_all_term_by_taxonomy( $taxonomy = null ) {
44
- $terms = array();
45
- if ( $taxonomy ) {
46
- $tList = get_terms( array( $taxonomy ), array( 'hide_empty' => 0 ) );
47
- if ( is_array( $tList ) && ! empty( $tList ) && empty( $tList['errors'] ) ) {
48
- foreach ( $tList as $term ) {
49
- $terms[ $term->term_id ] = $term->name;
50
- }
51
- }
52
- }
53
-
54
- return $terms;
55
- }
56
-
57
- function rt_get_taxonomy_for_isotope_filter( $post_type = null ) {
58
- if ( ! $post_type ) {
59
- $post_type = get_post_meta( get_the_ID(), 'tpg_post_type', true );
60
- }
61
- if ( ! $post_type ) {
62
- $post_type = 'post';
63
- }
64
-
65
- return $this->rt_get_all_taxonomy_by_post_type( $post_type );
66
- }
67
-
68
- function rt_get_all_taxonomy_by_post_type( $post_type = null ) {
69
- $taxonomies = array();
70
- if ( $post_type && post_type_exists( $post_type ) ) {
71
- $taxObj = get_object_taxonomies( $post_type, 'objects' );
72
- if ( is_array( $taxObj ) && ! empty( $taxObj ) ) {
73
- foreach ( $taxObj as $tKey => $taxonomy ) {
74
- $taxonomies[ $tKey ] = $taxonomy->label;
75
- }
76
- }
77
- }
78
- if ( $post_type == 'post' ) {
79
- unset( $taxonomies['post_format'] );
80
- }
81
-
82
- return $taxonomies;
83
- }
84
-
85
- function rt_get_users() {
86
- $users = array();
87
- $u = get_users( apply_filters( 'tpg_author_arg', array() ) );
88
- if ( ! empty( $u ) ) {
89
- foreach ( $u as $user ) {
90
- $users[ $user->ID ] = $user->display_name;
91
- }
92
- }
93
-
94
- return $users;
95
- }
96
-
97
- function getAllTPGShortCodeList() {
98
- global $rtTPG;
99
- $scList = null;
100
- $scQ = get_posts( array(
101
- 'post_type' => $rtTPG->post_type,
102
- 'order_by' => 'title',
103
- 'order' => 'ASC',
104
- 'post_status' => 'publish',
105
- 'posts_per_page' => - 1
106
- ) );
107
- if ( ! empty( $scQ ) ) {
108
- foreach ( $scQ as $sc ) {
109
- $scList[ $sc->ID ] = $sc->post_title;
110
- }
111
- }
112
-
113
- return $scList;
114
- }
115
-
116
- function rtFieldGenerator( $fields = array(), $multi = false ) {
117
- $html = null;
118
- if ( is_array( $fields ) && ! empty( $fields ) ) {
119
- $rtField = new rtTPGField();
120
- if ( $multi ) {
121
- foreach ( $fields as $field ) {
122
- $html .= $rtField->Field( $field );
123
- }
124
- } else {
125
- $html .= $rtField->Field( $fields );
126
- }
127
- }
128
-
129
- return $html;
130
- }
131
-
132
- function rtFieldGeneratorBackup( $fields = array(), $multi = false ) {
133
- $html = null;
134
- if ( is_array( $fields ) && ! empty( $fields ) ) {
135
- $rtField = new rtTPGField();
136
- if ( $multi ) {
137
- $i = 0;
138
- $trigger = 0;
139
- foreach ( $fields as $field ) {
140
- $html .= ( $trigger == 0 ? "<div class='rt-row'>" : null );
141
- $html .= $rtField->Field( $field );
142
- $i ++;
143
- $trigger ++;
144
- if ( $trigger == 2 || count( $fields ) == $i ) {
145
- $html .= "</div>";
146
- $trigger = 0;
147
- }
148
- }
149
- } else {
150
- $html .= "<div class='rt-row'>";
151
- $html .= $rtField->Field( $fields );
152
- $html .= "</div>";
153
- }
154
- }
155
-
156
- return $html;
157
- }
158
-
159
- function get_image_sizes() {
160
- global $_wp_additional_image_sizes;
161
-
162
- $sizes = array();
163
-
164
- foreach ( get_intermediate_image_sizes() as $_size ) {
165
- if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
166
- $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
167
- $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
168
- $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
169
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
170
- $sizes[ $_size ] = array(
171
- 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
172
- 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
173
- 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
174
- );
175
- }
176
- }
177
-
178
- $imgSize = array();
179
- foreach ( $sizes as $key => $img ) {
180
- $imgSize[ $key ] = ucfirst( $key ) . " ({$img['width']}*{$img['height']})";
181
- }
182
-
183
- return $imgSize;
184
- }
185
-
186
- function getFeatureImageSrc( $post_id = null, $fImgSize = 'medium', $mediaSource = 'feature_image' ) {
187
- $imgSrc = null;
188
- if ( $mediaSource == 'feature_image' ) {
189
- if ( $aID = get_post_thumbnail_id( $post_id ) ) {
190
- $image = wp_get_attachment_image_src( $aID, $fImgSize );
191
- $imgSrc = $image[0];
192
- }
193
- } else if ( $mediaSource == 'first_image' ) {
194
- if ( $img = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_the_content( $post_id ),
195
- $matches ) ) {
196
- $imgSrc = $matches[1][0];
197
- }
198
- }
199
-
200
- return $imgSrc;
201
- }
202
-
203
- function get_the_title( $post_id, $data = array() ) {
204
- $title = $originalTitle = get_the_title( $post_id );
205
- $limit = isset( $data['title_limit'] ) ? abs( $data['title_limit'] ) : 0;
206
- $limit_type = isset( $data['title_limit_type'] ) ? trim( $data['title_limit_type'] ) : 'character';
207
- if ( $limit ) {
208
- if ( $limit_type == "word" ) {
209
- $limit = $limit + 1;
210
- $title = explode( ' ', $title, $limit );
211
- if ( count( $title ) >= $limit ) {
212
- array_pop( $title );
213
- $title = implode( " ", $title );
214
- } else {
215
- $title = $originalTitle;
216
- }
217
- } else {
218
- if ( $limit > 0 && strlen( $title ) > $limit ) {
219
- $title = mb_substr( $title, 0, $limit, "utf-8" );
220
- $title = preg_replace( '/\W\w+\s*(\W*)$/', '$1', $title );
221
- }
222
- }
223
- }
224
-
225
- return apply_filters( 'tpg_get_the_title', $title, $post_id, $data, $originalTitle );
226
- }
227
-
228
- function get_the_excerpt( $post_id, $data = array() ) {
229
- $type = $data['excerpt_type'];
230
- if ( $type == 'full' ) {
231
- ob_start();
232
- the_content();
233
- $content = ob_get_clean();
234
-
235
- return apply_filters( 'tpg_content_full', $content, $post_id, $data );
236
- } else {
237
-
238
- $limit = isset( $data['excerpt_limit'] ) ? abs( $data['excerpt_limit'] ) : 0;
239
- $defaultExcerpt = get_the_excerpt( $post_id );
240
- $more = $data['excerpt_more_text'];
241
- $excerpt = preg_replace( '`\[[^\]]*\]`', '', $defaultExcerpt );
242
- $excerpt = strip_shortcodes( $excerpt );
243
- $excerpt = preg_replace( '`[[^]]*]`', '', $excerpt );
244
- $excerpt = str_replace( '', '', $excerpt );
245
- if ( $limit ) {
246
- $excerpt = wp_filter_nohtml_kses( $excerpt );
247
- if ( $type == "word" ) {
248
- $limit = $limit + 1;
249
- $rawExcerpt = $excerpt;
250
- $excerpt = explode( ' ', $excerpt, $limit );
251
- if ( count( $excerpt ) >= $limit ) {
252
- array_pop( $excerpt );
253
- $excerpt = implode( " ", $excerpt );
254
- } else {
255
- $excerpt = $rawExcerpt;
256
- }
257
- } else {
258
- if ( $limit > 0 && strlen( $excerpt ) > $limit ) {
259
- $excerpt = mb_substr( $excerpt, 0, $limit, "utf-8" );
260
- $excerpt = preg_replace( '/\W\w+\s*(\W*)$/', '$1', $excerpt );
261
- }
262
- }
263
- } else {
264
- $allowed_html = array(
265
- 'a' => array(
266
- 'href' => array(),
267
- 'title' => array()
268
- ),
269
- 'strong' => array(),
270
- 'b' => array(),
271
- 'br' => array( array() ),
272
- );
273
- $excerpt = nl2br( wp_kses( $excerpt, $allowed_html ) );
274
- }
275
- $excerpt = ( $more ? $excerpt . " " . $more : $excerpt );
276
-
277
-
278
- return apply_filters( 'tpg_get_the_excerpt', $excerpt, $post_id, $data, $defaultExcerpt );
279
- }
280
- }
281
-
282
-
283
- function rt_pagination( $pages = '', $range = 4 ) {
284
-
285
- $html = null;
286
- $showitems = ( $range * 2 ) + 1;
287
- global $paged;
288
- if ( empty( $paged ) ) {
289
- if ( get_query_var( 'paged' ) ) {
290
- $paged = get_query_var( 'paged' );
291
- } elseif ( get_query_var( 'page' ) ) {
292
- $paged = get_query_var( 'page' );
293
- } else {
294
- $paged = 1;
295
- }
296
- }
297
- if ( $pages == '' ) {
298
- global $wp_query;
299
- $pages = $wp_query->max_num_pages;
300
- if ( ! $pages ) {
301
- $pages = 1;
302
- }
303
- }
304
-
305
- if ( 1 != $pages ) {
306
-
307
- $html .= '<div class="rt-pagination">';
308
- $html .= '<ul class="pagination">';
309
-
310
- if ( $paged > 1 && $showitems < $pages ) {
311
- $html .= "<li><a href='" . get_pagenum_link( $paged - 1 ) . "' aria-label='Previous'><i class='fa fa-chevron-left' aria-hidden='true'></i></a></li>";
312
- }
313
-
314
- for ( $i = 1; $i <= $pages; $i ++ ) {
315
-
316
- if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
317
- $html .= ( $paged == $i ) ? "<li class='active'><span>" . $i . "</span></li>" : "<li><a href='" . get_pagenum_link( $i ) . "'>" . $i . "</a></li>";
318
-
319
- }
320
-
321
- }
322
-
323
- if ( $paged < $pages && $showitems < $pages ) {
324
- $html .= "<li><a href='" . get_pagenum_link( $paged + 1 ) . "' aria-label='Next'><i class='fa fa-chevron-right' aria-hidden='true'></i></a></li>";
325
- }
326
-
327
- $html .= "</ul>";
328
- $html .= "</div>";
329
- }
330
-
331
- return $html;
332
-
333
- }
334
-
335
- function get_pro_feature_list() {
336
- $html = "<ol>
337
- <li>Fully responsive and mobile friendly.</li>
338
- <li>55 Different Layouts</li>
339
- <li>Even and Masonry Grid.</li>
340
- <li>WooCommerce supported.</li>
341
- <li>Custom Post Type Supported</li>
342
- <li>Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)</li>
343
- <li>Order by Id, Title, Created date, Modified date and Menu order.</li>
344
- <li>Display image size (thumbnail, medium, large, full)</li>
345
- <li>Isotope filter for any taxonomy ie. categories, tags...</li>
346
- <li>Query Post with Relation.</li>
347
- <li>Fields Selection.</li>
348
- <li>All Text and Color control.</li>
349
- <li>Enable/Disable Pagination.</li>
350
- <li>AJAX Pagination (Load more and Load on Scrolling)</li>
351
- <li> and many more .......</li>
352
- </ol>";
353
-
354
- return $html;
355
- }
356
-
357
- }
358
 
359
  endif;
1
  <?php
2
 
3
+ if (!class_exists('rtTPGHelper')):
4
+
5
+ class rtTPGHelper
6
+ {
7
+ function verifyNonce() {
8
+ global $rtTPG;
9
+ $nonce = isset($_REQUEST[$this->nonceId()]) ? $_REQUEST[$this->nonceId()] : null;
10
+ $nonceText = $rtTPG->nonceText();
11
+ if (!wp_verify_nonce($nonce, $nonceText)) {
12
+ return false;
13
+ }
14
+
15
+ return true;
16
+ }
17
+
18
+ function nonceText() {
19
+ return "rttpg_nonce_secret";
20
+ }
21
+
22
+ function nonceId() {
23
+ return "rttpg_nonce";
24
+ }
25
+
26
+ function rtAllOptionFields() {
27
+ global $rtTPG;
28
+ $fields = array();
29
+ $fieldsA = array_merge(
30
+ $rtTPG->rtTPGCommonFilterFields(),
31
+ $rtTPG->rtTPGLayoutSettingFields(),
32
+ $rtTPG->rtTPGStyleFields()
33
+ );
34
+ foreach ($fieldsA as $field) {
35
+ $fields[] = $field;
36
+ }
37
+ array_push($fields, $rtTPG->rtTPGPostType());
38
+ array_push($fields, $rtTPG->rtTPAdvanceFilters());
39
+ array_push($fields, $rtTPG->itemFields());
40
+
41
+ return $fields;
42
+ }
43
+
44
+ function rt_get_all_term_by_taxonomy($taxonomy = null) {
45
+ $terms = array();
46
+ if ($taxonomy) {
47
+ $tList = get_terms(array($taxonomy), array('hide_empty' => 0));
48
+ if (is_array($tList) && !empty($tList) && empty($tList['errors'])) {
49
+ foreach ($tList as $term) {
50
+ $terms[$term->term_id] = $term->name;
51
+ }
52
+ }
53
+ }
54
+
55
+ return $terms;
56
+ }
57
+
58
+ function rt_get_taxonomy_for_isotope_filter($post_type = null) {
59
+ if (!$post_type) {
60
+ $post_type = get_post_meta(get_the_ID(), 'tpg_post_type', true);
61
+ }
62
+ if (!$post_type) {
63
+ $post_type = 'post';
64
+ }
65
+
66
+ return $this->rt_get_all_taxonomy_by_post_type($post_type);
67
+ }
68
+
69
+ function rt_get_all_taxonomy_by_post_type($post_type = null) {
70
+ $taxonomies = array();
71
+ if ($post_type && post_type_exists($post_type)) {
72
+ $taxObj = get_object_taxonomies($post_type, 'objects');
73
+ if (is_array($taxObj) && !empty($taxObj)) {
74
+ foreach ($taxObj as $tKey => $taxonomy) {
75
+ $taxonomies[$tKey] = $taxonomy->label;
76
+ }
77
+ }
78
+ }
79
+ if ($post_type == 'post') {
80
+ unset($taxonomies['post_format']);
81
+ }
82
+
83
+ return $taxonomies;
84
+ }
85
+
86
+ function rt_get_users() {
87
+ $users = array();
88
+ $u = get_users(apply_filters('tpg_author_arg', array()));
89
+ if (!empty($u)) {
90
+ foreach ($u as $user) {
91
+ $users[$user->ID] = $user->display_name;
92
+ }
93
+ }
94
+
95
+ return $users;
96
+ }
97
+
98
+ function getAllTPGShortCodeList() {
99
+ global $rtTPG;
100
+ $scList = null;
101
+ $scQ = get_posts(array(
102
+ 'post_type' => $rtTPG->post_type,
103
+ 'order_by' => 'title',
104
+ 'order' => 'ASC',
105
+ 'post_status' => 'publish',
106
+ 'posts_per_page' => -1
107
+ ));
108
+ if (!empty($scQ)) {
109
+ foreach ($scQ as $sc) {
110
+ $scList[$sc->ID] = $sc->post_title;
111
+ }
112
+ }
113
+
114
+ return $scList;
115
+ }
116
+
117
+ function rtFieldGenerator($fields = array(), $multi = false) {
118
+ $html = null;
119
+ if (is_array($fields) && !empty($fields)) {
120
+ $rtField = new rtTPGField();
121
+ if ($multi) {
122
+ foreach ($fields as $field) {
123
+ $html .= $rtField->Field($field);
124
+ }
125
+ } else {
126
+ $html .= $rtField->Field($fields);
127
+ }
128
+ }
129
+
130
+ return $html;
131
+ }
132
+
133
+ function rtFieldGeneratorBackup($fields = array(), $multi = false) {
134
+ $html = null;
135
+ if (is_array($fields) && !empty($fields)) {
136
+ $rtField = new rtTPGField();
137
+ if ($multi) {
138
+ $i = 0;
139
+ $trigger = 0;
140
+ foreach ($fields as $field) {
141
+ $html .= ($trigger == 0 ? "<div class='rt-row'>" : null);
142
+ $html .= $rtField->Field($field);
143
+ $i++;
144
+ $trigger++;
145
+ if ($trigger == 2 || count($fields) == $i) {
146
+ $html .= "</div>";
147
+ $trigger = 0;
148
+ }
149
+ }
150
+ } else {
151
+ $html .= "<div class='rt-row'>";
152
+ $html .= $rtField->Field($fields);
153
+ $html .= "</div>";
154
+ }
155
+ }
156
+
157
+ return $html;
158
+ }
159
+
160
+ function get_image_sizes() {
161
+ global $_wp_additional_image_sizes;
162
+
163
+ $sizes = array();
164
+
165
+ foreach (get_intermediate_image_sizes() as $_size) {
166
+ if (in_array($_size, array('thumbnail', 'medium', 'large'))) {
167
+ $sizes[$_size]['width'] = get_option("{$_size}_size_w");
168
+ $sizes[$_size]['height'] = get_option("{$_size}_size_h");
169
+ $sizes[$_size]['crop'] = (bool)get_option("{$_size}_crop");
170
+ } elseif (isset($_wp_additional_image_sizes[$_size])) {
171
+ $sizes[$_size] = array(
172
+ 'width' => $_wp_additional_image_sizes[$_size]['width'],
173
+ 'height' => $_wp_additional_image_sizes[$_size]['height'],
174
+ 'crop' => $_wp_additional_image_sizes[$_size]['crop'],
175
+ );
176
+ }
177
+ }
178
+
179
+ $imgSize = array();
180
+ foreach ($sizes as $key => $img) {
181
+ $imgSize[$key] = ucfirst($key) . " ({$img['width']}*{$img['height']})";
182
+ }
183
+
184
+ return $imgSize;
185
+ }
186
+
187
+ function getFeatureImageSrc($post_id = null, $fImgSize = 'medium', $mediaSource = 'feature_image') {
188
+ $imgSrc = null;
189
+ if ($mediaSource == 'feature_image') {
190
+ if ($aID = get_post_thumbnail_id($post_id)) {
191
+ $image = wp_get_attachment_image_src($aID, $fImgSize);
192
+ $imgSrc = $image[0];
193
+ }
194
+ } else if ($mediaSource == 'first_image') {
195
+ if ($img = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_the_content($post_id),
196
+ $matches)) {
197
+ $imgSrc = $matches[1][0];
198
+ }
199
+ }
200
+
201
+ return $imgSrc;
202
+ }
203
+
204
+ function get_the_title($post_id, $data = array()) {
205
+ $title = $originalTitle = get_the_title($post_id);
206
+ $limit = isset($data['title_limit']) ? abs($data['title_limit']) : 0;
207
+ $limit_type = isset($data['title_limit_type']) ? trim($data['title_limit_type']) : 'character';
208
+ if ($limit) {
209
+ if ($limit_type == "word") {
210
+ $limit = $limit + 1;
211
+ $title = explode(' ', $title, $limit);
212
+ if (count($title) >= $limit) {
213
+ array_pop($title);
214
+ $title = implode(" ", $title);
215
+ } else {
216
+ $title = $originalTitle;
217
+ }
218
+ } else {
219
+ if ($limit > 0 && strlen($title) > $limit) {
220
+ $title = mb_substr($title, 0, $limit, "utf-8");
221
+ $title = preg_replace('/\W\w+\s*(\W*)$/', '$1', $title);
222
+ }
223
+ }
224
+ }
225
+
226
+ return apply_filters('tpg_get_the_title', $title, $post_id, $data, $originalTitle);
227
+ }
228
+
229
+ function get_the_excerpt($post_id, $data = array()) {
230
+ $type = $data['excerpt_type'];
231
+ if ($type == 'full') {
232
+ ob_start();
233
+ the_content();
234
+ $content = ob_get_clean();
235
+
236
+ return apply_filters('tpg_content_full', $content, $post_id, $data);
237
+ } else {
238
+
239
+ $limit = isset($data['excerpt_limit']) ? abs($data['excerpt_limit']) : 0;
240
+ $defaultExcerpt = get_the_excerpt($post_id);
241
+ $more = $data['excerpt_more_text'];
242
+ $excerpt = preg_replace('`\[[^\]]*\]`', '', $defaultExcerpt);
243
+ $excerpt = strip_shortcodes($excerpt);
244
+ $excerpt = preg_replace('`[[^]]*]`', '', $excerpt);
245
+ $excerpt = str_replace('…', '', $excerpt);
246
+ if ($limit) {
247
+ $excerpt = wp_filter_nohtml_kses($excerpt);
248
+ if ($type == "word") {
249
+ $limit = $limit + 1;
250
+ $rawExcerpt = $excerpt;
251
+ $excerpt = explode(' ', $excerpt, $limit);
252
+ if (count($excerpt) >= $limit) {
253
+ array_pop($excerpt);
254
+ $excerpt = implode(" ", $excerpt);
255
+ } else {
256
+ $excerpt = $rawExcerpt;
257
+ }
258
+ } else {
259
+ if ($limit > 0 && strlen($excerpt) > $limit) {
260
+ $excerpt = mb_substr($excerpt, 0, $limit, "utf-8");
261
+ $excerpt = preg_replace('/\W\w+\s*(\W*)$/', '$1', $excerpt);
262
+ }
263
+ }
264
+ } else {
265
+ $allowed_html = array(
266
+ 'a' => array(
267
+ 'href' => array(),
268
+ 'title' => array()
269
+ ),
270
+ 'strong' => array(),
271
+ 'b' => array(),
272
+ 'br' => array(array()),
273
+ );
274
+ $excerpt = nl2br(wp_kses($excerpt, $allowed_html));
275
+ }
276
+ $excerpt = ($more ? $excerpt . " " . $more : $excerpt);
277
+
278
+
279
+ return apply_filters('tpg_get_the_excerpt', $excerpt, $post_id, $data, $defaultExcerpt);
280
+ }
281
+ }
282
+
283
+
284
+ function rt_pagination($pages = '', $range = 4) {
285
+
286
+ $html = null;
287
+ $showitems = ($range * 2) + 1;
288
+ global $paged;
289
+ if (empty($paged)) {
290
+ if (get_query_var('paged')) {
291
+ $paged = get_query_var('paged');
292
+ } elseif (get_query_var('page')) {
293
+ $paged = get_query_var('page');
294
+ } else {
295
+ $paged = 1;
296
+ }
297
+ }
298
+ if ($pages == '') {
299
+ global $wp_query;
300
+ $pages = $wp_query->max_num_pages;
301
+ if (!$pages) {
302
+ $pages = 1;
303
+ }
304
+ }
305
+
306
+ if (1 != $pages) {
307
+
308
+ $html .= '<div class="rt-pagination">';
309
+ $html .= '<ul class="pagination">';
310
+
311
+ if ($paged > 1 && $showitems < $pages) {
312
+ $html .= "<li><a href='" . get_pagenum_link($paged - 1) . "' aria-label='Previous'><i class='fa fa-chevron-left' aria-hidden='true'></i></a></li>";
313
+ }
314
+
315
+ for ($i = 1; $i <= $pages; $i++) {
316
+
317
+ if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
318
+ $html .= ($paged == $i) ? "<li class='active'><span>" . $i . "</span></li>" : "<li><a href='" . get_pagenum_link($i) . "'>" . $i . "</a></li>";
319
+
320
+ }
321
+
322
+ }
323
+
324
+ if ($paged < $pages && $showitems < $pages) {
325
+ $html .= "<li><a href='" . get_pagenum_link($paged + 1) . "' aria-label='Next'><i class='fa fa-chevron-right' aria-hidden='true'></i></a></li>";
326
+ }
327
+
328
+ $html .= "</ul>";
329
+ $html .= "</div>";
330
+ }
331
+
332
+ return $html;
333
+
334
+ }
335
+
336
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
 
338
  endif;
lib/classes/rtTPGMeta.php CHANGED
@@ -8,6 +8,7 @@ if (!class_exists('rtTPGMeta')):
8
  // actions
9
  add_action('admin_head', array($this, 'admin_head'));
10
  add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
 
11
  add_action('save_post', array($this, 'save_post'), 10, 2);
12
  add_filter('manage_edit-rttpg_columns', array($this, 'arrange_rttpg_columns'));
13
  add_action('manage_rttpg_posts_custom_column', array($this, 'manage_rttpg_columns'), 10, 2);
@@ -50,10 +51,7 @@ if (!class_exists('rtTPGMeta')):
50
  'jquery-ui-core',
51
  'rt-fontawsome',
52
  'rt-actual-height-js',
53
- 'jquery-ui-tabs',
54
  'wp-color-picker',
55
- 'ace_code_highlighter_js',
56
- 'ace_mode_js',
57
  'rt-select2-js',
58
  'rt-tpg',
59
  'rt-tpg-admin',
@@ -87,13 +85,6 @@ if (!class_exists('rtTPGMeta')):
87
  rtTPG()->post_type,
88
  'normal',
89
  'high');
90
- add_meta_box(
91
- 'rttpg_meta_marketing',
92
- __('Pro Features'),
93
- array($this, 'rttpg_meta_marketing_selection'),
94
- rtTPG()->post_type,
95
- 'side',
96
- 'default');
97
  add_meta_box(
98
  rtTPG()->post_type . '_sc_preview_meta',
99
  __('Layout Preview', 'the-post-grid'),
@@ -101,7 +92,49 @@ if (!class_exists('rtTPGMeta')):
101
  rtTPG()->post_type,
102
  'normal',
103
  'high');
104
- add_action('edit_form_after_title', array($this, 'tpg_sc_after_title'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
 
@@ -136,28 +169,28 @@ if (!class_exists('rtTPGMeta')):
136
  );
137
  wp_nonce_field(rtTPG()->nonceText(), rtTPG()->nonceId());
138
  $html = null;
139
- $html .= '<div id="sc-tabs" class="rt-setting-holder">';
140
  $html .= '<ul class="rt-tab-nav">
141
- <li><a href="#sc-post-post-source">' . __('Post Source', 'the-post-grid') . '</a></li>
142
  <li><a href="#sc-post-layout-settings">' . __('Layout Settings', 'the-post-grid') . '</a></li>
143
  <li><a href="#sc-field-selection">' . __('Field Selection', 'the-post-grid') . '</a></li>
144
  <li><a href="#sc-style">' . __('Style', 'the-post-grid') . '</a></li>
145
  </ul>';
146
 
147
 
148
- $html .= '<div id="sc-post-post-source" class="rt-tab-container">';
149
  $html .= rtTPG()->render('settings.post-source', $post, true);
150
  $html .= '</div>';
151
 
152
- $html .= '<div id="sc-post-layout-settings" class="rt-tab-container">';
153
  $html .= rtTPG()->render('settings.layout-settings', $post, true);
154
  $html .= '</div>';
155
 
156
- $html .= '<div id="sc-field-selection" class="rt-tab-container">';
157
  $html .= rtTPG()->render('settings.item-fields', $post, true);
158
  $html .= '</div>';
159
 
160
- $html .= '<div id="sc-style" class="rt-tab-container">';
161
  $html .= rtTPG()->render('settings.style', $post, true);
162
  $html .= '</div>';
163
 
8
  // actions
9
  add_action('admin_head', array($this, 'admin_head'));
10
  add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
11
+ add_action('edit_form_after_title', array($this, 'tpg_sc_after_title'));
12
  add_action('save_post', array($this, 'save_post'), 10, 2);
13
  add_filter('manage_edit-rttpg_columns', array($this, 'arrange_rttpg_columns'));
14
  add_action('manage_rttpg_posts_custom_column', array($this, 'manage_rttpg_columns'), 10, 2);
51
  'jquery-ui-core',
52
  'rt-fontawsome',
53
  'rt-actual-height-js',
 
54
  'wp-color-picker',
 
 
55
  'rt-select2-js',
56
  'rt-tpg',
57
  'rt-tpg-admin',
85
  rtTPG()->post_type,
86
  'normal',
87
  'high');
 
 
 
 
 
 
 
88
  add_meta_box(
89
  rtTPG()->post_type . '_sc_preview_meta',
90
  __('Layout Preview', 'the-post-grid'),
92
  rtTPG()->post_type,
93
  'normal',
94
  'high');
95
+
96
+ add_meta_box(
97
+ 'rt_plugin_sc_pro_information',
98
+ __('Documentation', 'the-post-grid'),
99
+ array($this, 'rt_plugin_sc_pro_information'),
100
+ rtTPG()->post_type,
101
+ 'side',
102
+ 'low'
103
+ );
104
+ }
105
+
106
+ function rt_plugin_sc_pro_information($post) {
107
+ $html = '';
108
+ if ($post === 'settings') {
109
+ $html .= '<div class="rt-document-box rt-update-pro-btn-wrap">
110
+ <a href="https://www.radiustheme.com/the-post-grid-pro-for-wordpress/" target="_blank" class="rt-update-pro-btn">' . __("Update Pro To Get More Features", "the-post-grid") . '</a>
111
+ </div>';
112
+ } else {
113
+ $html .= sprintf('<div class="rt-document-box"><div class="rt-box-icon"><i class="dashicons dashicons-megaphone"></i></div><div class="rt-box-content"><h3 class="rt-box-title">Pro Features</h3>%s</div></div>', rtTPG()->get_pro_feature_list());
114
+ }
115
+ $html .= sprintf('<div class="rt-document-box">
116
+ <div class="rt-box-icon"><i class="dashicons dashicons-media-document"></i></div>
117
+ <div class="rt-box-content">
118
+ <h3 class="rt-box-title">%1$s</h3>
119
+ <p>%2$s</p>
120
+ <a href="https://radiustheme.com/how-to-setup-configure-the-post-grid-free-version-for-wordpress/" target="_blank" class="rt-admin-btn">%1$s</a>
121
+ </div>
122
+ </div>',
123
+ __("Documentation", 'the-post-grid'),
124
+ __("Get started by spending some time with the documentation we included step by step process with screenshots with video.", 'the-post-grid')
125
+ );
126
+
127
+ $html .= '<div class="rt-document-box">
128
+ <div class="rt-box-icon"><i class="dashicons dashicons-sos"></i></div>
129
+ <div class="rt-box-content">
130
+ <h3 class="rt-box-title">Need Help?</h3>
131
+ <p>Stuck with something? Please create a
132
+ <a href="https://www.radiustheme.com/contact/">ticket here</a> or post on <a href="https://www.facebook.com/groups/234799147426640/">facebook group</a>. For emergency case join our <a href="https://www.radiustheme.com/">live chat</a>.</p>
133
+ <a href="https://www.radiustheme.com/contact/" target="_blank" class="rt-admin-btn">' . __("Get Support", "the-post-grid") . '</a>
134
+ </div>
135
+ </div>';
136
+
137
+ echo $html;
138
  }
139
 
140
 
169
  );
170
  wp_nonce_field(rtTPG()->nonceText(), rtTPG()->nonceId());
171
  $html = null;
172
+ $html .= '<div id="sc-tabs" class="rt-tab-container">';
173
  $html .= '<ul class="rt-tab-nav">
174
+ <li class="active"><a href="#sc-post-post-source">' . __('Post Source', 'the-post-grid') . '</a></li>
175
  <li><a href="#sc-post-layout-settings">' . __('Layout Settings', 'the-post-grid') . '</a></li>
176
  <li><a href="#sc-field-selection">' . __('Field Selection', 'the-post-grid') . '</a></li>
177
  <li><a href="#sc-style">' . __('Style', 'the-post-grid') . '</a></li>
178
  </ul>';
179
 
180
 
181
+ $html .= '<div id="sc-post-post-source" class="rt-tab-content" style="display: block">';
182
  $html .= rtTPG()->render('settings.post-source', $post, true);
183
  $html .= '</div>';
184
 
185
+ $html .= '<div id="sc-post-layout-settings" class="rt-tab-content">';
186
  $html .= rtTPG()->render('settings.layout-settings', $post, true);
187
  $html .= '</div>';
188
 
189
+ $html .= '<div id="sc-field-selection" class="rt-tab-content">';
190
  $html .= rtTPG()->render('settings.item-fields', $post, true);
191
  $html .= '</div>';
192
 
193
+ $html .= '<div id="sc-style" class="rt-tab-content">';
194
  $html .= rtTPG()->render('settings.style', $post, true);
195
  $html .= '</div>';
196
 
lib/classes/rtTPGOptions.php CHANGED
@@ -1,470 +1,513 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'rtTPGOptions' ) ):
4
 
5
- class rtTPGOptions {
 
6
 
7
- function rtPostTypes() {
8
- $post_types = get_post_types(
9
- array(
10
- '_builtin' => true
11
- )
12
- );
13
- $exclude = array( 'attachment', 'revision', 'nav_menu_item' );
14
- foreach ( $exclude as $ex ) {
15
- unset( $post_types[ $ex ] );
16
- }
17
 
18
- return $post_types;
19
- }
20
 
21
- function rtPostOrders() {
22
- return array(
23
- "ASC" => "Ascending",
24
- "DESC" => "Descending",
25
- );
26
- }
27
 
28
- function rtTermOperators() {
29
- return array(
30
- 'IN' => "IN — show posts which associate with one or more of selected terms",
31
- 'NOT IN' => "NOT IN — show posts which do not associate with any of selected terms",
32
- 'AND' => "AND — show posts which associate with all of selected terms",
33
- );
34
- }
35
 
36
- function rtTermRelations() {
37
- return array(
38
- 'AND' => "AND — show posts which match all settings",
39
- 'OR' => "OR — show posts which match one or more settings",
40
- );
41
- }
42
 
43
- function rtPostOrderBy() {
44
- return array(
45
- "ID" => "ID",
46
- "title" => "Title",
47
- "date" => "Created date",
48
- "modified" => "Modified date",
49
- "menu_order" => "Menu Order"
50
- );
51
- }
52
 
53
- function rtTPGSettingFields() {
54
- global $rtTPG;
55
- $settings = get_option( $rtTPG->options['settings'] );
56
 
57
- return array(
58
- 'custom_css' => array(
59
- 'type' => 'textarea',
60
- 'name' => 'custom_css',
61
- 'label' => 'Custom Css',
62
- 'holderClass' => 'rt-script-wrapper full',
63
- 'id' => 'custom-css',
64
- 'value' => isset( $settings['custom_css'] ) ? stripslashes( $settings['custom_css'] ) : null,
65
- ),
66
- "script_before_item_load" => array(
67
- 'name' => 'script_before_item_load',
68
- "label" => __( "Script before item load", 'the-post-grid' ),
69
- 'type' => 'textarea',
70
- 'holderClass' => 'rt-script-wrapper full',
71
- 'id' => 'script-before-item-load',
72
- 'value' => isset( $settings['script_before_item_load'] ) ? stripslashes( $settings['script_before_item_load'] ) : null
73
- ),
74
- "script_after_item_load" => array(
75
- 'name' => 'script_after_item_load',
76
- "label" => __( "Script After item load", 'the-post-grid' ),
77
- 'type' => 'textarea',
78
- 'holderClass' => 'rt-script-wrapper full',
79
- 'id' => 'script-after-item-load',
80
- 'value' => isset( $settings['script_after_item_load'] ) ? stripslashes( $settings['script_after_item_load'] ) : null
81
- ),
82
- "script_loaded" => array(
83
- 'name' => 'script_loaded',
84
- "label" => __( "After Loaded Script", 'the-post-grid' ),
85
- 'type' => 'textarea',
86
- 'holderClass' => 'rt-script-wrapper full',
87
- 'id' => 'script-loaded',
88
- 'value' => isset( $settings['script_loaded'] ) ? stripslashes( $settings['script_loaded'] ) : null
89
- )
90
- );
91
- }
92
 
93
- function rtTPGCommonFilterFields() {
94
- return array(
95
- 'post__in' => array(
96
- "name" => "post__in",
97
- "label" => "Include only",
98
- "type" => "text",
99
- "class" => "full",
100
- "description" => __( 'List of post IDs to show (comma-separated values, for example: 1,2,3)',
101
- 'the-post-grid' )
102
- ),
103
- 'post__not_in' => array(
104
- "name" => "post__not_in",
105
- "label" => "Exclude",
106
- "type" => "text",
107
- "class" => "full",
108
- "description" => __( 'List of post IDs to hide (comma-separated values, for example: 1,2,3)',
109
- 'the-post-grid' )
110
- ),
111
- 'limit' => array(
112
- "name" => "limit",
113
- "label" => "Limit",
114
- "type" => "number",
115
- "class" => "full",
116
- "description" => __( 'The number of posts to show. Set empty to show all found posts.',
117
- 'the-post-grid' )
118
- )
119
- );
120
- }
121
 
122
- function rtTPGPostType() {
123
- return array(
124
- "name" => "tpg_post_type",
125
- "label" => "Post Type",
126
- "type" => "select",
127
- "id" => "rc-sc-post-type",
128
- "class" => "rt-select2",
129
- "options" => $this->rtPostTypes()
130
- );
131
- }
132
 
133
- function rtTPAdvanceFilters() {
134
- return array(
135
- 'type' => "checkbox",
136
- 'name' => "post_filter",
137
- 'label' => "Advanced filters",
138
- 'id' => "post_filter",
139
- "alignment" => "vertical",
140
- "multiple" => true,
141
- "options" => array(
142
- 'tpg_taxonomy' => "Taxonomy",
143
- 'order' => "Order",
144
- 'author' => "Author",
145
- 'tpg_post_status' => "Status",
146
- 's' => "Search"
147
- ),
148
- );
149
- }
150
 
151
- function rtTPGPostStatus() {
152
- return array(
153
- 'publish' => 'Publish',
154
- 'pending' => 'Pending',
155
- 'draft' => 'Draft',
156
- 'auto-draft' => 'Auto draft',
157
- 'future' => 'Future',
158
- 'private' => 'Private',
159
- 'inherit' => 'Inherit',
160
- 'trash' => 'Trash',
161
- );
162
- }
163
 
164
- function rtTPGLayoutSettingFields() {
165
- global $rtTPG;
166
 
167
- return array(
168
- 'layout' => array(
169
- "type" => "select",
170
- "name" => "layout",
171
- "label" => "Layout",
172
- "id" => "rt-tpg-sc-layout",
173
- "class" => "rt-select2",
174
- "options" => $this->rtTPGLayouts()
175
- ),
176
- 'isotope-filtering' => array(
177
- "type" => "select",
178
- "name" => "isotope_filter",
179
- "label" => "Isotope Filter",
180
- 'holderClass' => "sc-isotope-filter tpg-hidden",
181
- "id" => "rt-tpg-sc-isotope-filter",
182
- "class" => "rt-select2",
183
- "options" => $rtTPG->rt_get_taxonomy_for_isotope_filter()
184
- ),
185
- 'tpg_show_all_text' => array(
186
- "type" => "text",
187
- "name" => "tpg_show_all_text",
188
- 'holderClass' => "sc-isotope-filter tpg-hidden",
189
- "label" => esc_html__( "Show all text", 'the-post-grid' ),
190
- "default" => esc_html__( "Show all", 'the-post-grid' )
191
- ),
192
- 'tgp_layout2_image_column' => array(
193
- 'type' => 'select',
194
- "name" => "tgp_layout2_image_column",
195
- "id" => "tgp_layout2_image_column",
196
- 'label' => __( 'Image column', 'the-post-grid' ),
197
- 'class' => 'rt-select2',
198
- 'holderClass' => "holder-layout2-image-column tpg-hidden",
199
- 'default' => 4,
200
- 'options' => $this->rtTPGColumns(),
201
- "description" => "Content column will calculate automatically"
202
- ),
203
- 'column' => array(
204
- "type" => "select",
205
- "name" => "column",
206
- "label" => "Column",
207
- "id" => "rt-column",
208
- "class" => "rt-select2",
209
- "default" => 4,
210
- "options" => $this->rtTPGColumns()
211
- ),
212
- 'pagination' => array(
213
- "type" => "checkbox",
214
- "name" => "pagination",
215
- "label" => "Pagination",
216
- 'holderClass' => "pagination",
217
- "id" => "rt-tpg-pagination",
218
- "option" => 'Enable'
219
- ),
220
- 'posts_per_page' => array(
221
- "type" => "number",
222
- "name" => "posts_per_page",
223
- "label" => "Display per page",
224
- 'holderClass' => "posts-per-page tpg-hidden",
225
- "id" => "posts-per-page",
226
- "default" => 5,
227
- "description" => __( "If value of Limit setting is not blank (empty), this value should be smaller than Limit value.",
228
- 'the-post-grid' )
229
- ),
230
- 'featured_image' => array(
231
- "type" => "checkbox",
232
- "name" => "featured_image",
233
- "label" => "Feature Image",
234
- "id" => "rt-feature-image",
235
- "option" => 'Disable'
236
- ),
237
- 'featured_image_size' => array(
238
- "type" => "select",
239
- "name" => "featured_image_size",
240
- "label" => "Feature Image Size",
241
- "id" => "featured-image-size",
242
- 'holderClass' => "feature-image-options tpg-hidden",
243
- "class" => "rt-select2",
244
- "options" => $rtTPG->get_image_sizes()
245
- ),
246
- 'media_source' => array(
247
- "type" => "radio",
248
- "name" => "media_source",
249
- "label" => "Media Source",
250
- "id" => "media-source",
251
- 'holderClass' => "feature-image-options tpg-hidden",
252
- "default" => 'feature_image',
253
- "alignment" => "vertical",
254
- "options" => $this->rtMediaSource()
255
- ),
256
- 'tpg_title_limit' => array(
257
- "name" => "tpg_title_limit",
258
- "id" => "tpg-title-limit",
259
- "type" => "number",
260
- "label" => esc_html__( "Title limit", 'the-post-grid' ),
261
- "description" => esc_html__( "Title limit only integer number is allowed, Leave it blank for full title.", 'the-post-grid' )
262
- ),
263
- 'tpg_title_limit_type' => array(
264
- "name" => "tpg_title_limit_type",
265
- "id" => "tpg-title-limit-type",
266
- "type" => "radio",
267
- "label" => esc_html__( "Title limit type", 'the-post-grid' ),
268
- "alignment" => "vertical",
269
- "default" => 'character',
270
- "options" => $this->get_limit_type(),
271
- ),
272
- 'excerpt_limit' => array(
273
- "type" => "number",
274
- "name" => "excerpt_limit",
275
- "label" => esc_html__( "Excerpt limit", 'the-post-grid' ),
276
- "id" => "excerpt-limit",
277
- "description" => __( "Excerpt limit only integer number is allowed, Leave it blank for full excerpt. Note: This will remove all html tag",
278
- 'the-post-grid' )
279
- ),
280
- 'tgp_excerpt_type' => array(
281
- "type" => "radio",
282
- "label" => esc_html__( "Excerpt Type", 'the-post-grid' ),
283
- "name" => "tgp_excerpt_type",
284
- "id" => "tgp_excerpt_type",
285
- "alignment" => "vertical",
286
- "default" => 'character',
287
- "options" => $this->get_limit_type( 'content' ),
288
- ),
289
- 'tgp_excerpt_more_text' => array(
290
- "type" => "text",
291
- "label" => esc_html__( "Excerpt more text", 'the-post-grid' ),
292
- "name" => "tgp_excerpt_more_text",
293
- "id" => "tgp_excerpt_more_text",
294
- "default" => "..."
295
- ),
296
- 'tgp_read_more_text' => array(
297
- "type" => "text",
298
- "label" => esc_html__( "Read more text", 'the-post-grid' ),
299
- "name" => "tgp_read_more_text",
300
- "id" => "tgp_read_more_text",
301
- ),
302
- 'tpg_overlay' => array(
303
- "type" => "checkbox",
304
- "name" => "tpg_overlay",
305
- "label" => esc_html__( "Overlay", 'the-post-grid' ),
306
- "id" => "tpg_overlay",
307
- "option" => 'Enable'
308
- ),
309
- 'title_tag' => array(
310
- 'type' => 'select',
311
- 'name' => 'title_tag',
312
- 'label' => esc_html__( 'Title tag', 'the-post-grid' ),
313
- 'class' => 'rt-select2',
314
- 'id' => 'title-tag',
315
- 'options' => $this->getTitleTags(),
316
- 'default' => 'h2'
317
- ),
318
- );
319
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
 
321
- function get_limit_type( $content = null ) {
322
- $types = array(
323
- 'character' => __( "Character", "the-post-grid" ),
324
- 'word' => __( "Word", "the-post-grid" )
325
- );
326
- if ( $content === 'content' ) {
327
- $types['full'] = __( "Full Content", "the-post-grid" );
328
- }
329
 
330
- return apply_filters( 'tpg_limit_type', $types, $content );
331
- }
332
 
333
- function rtTPGStyleFields() {
334
 
335
- return array(
336
- 'parent_class' => array(
337
- "name" => "parent_class",
338
- "type" => "text",
339
- "label" => "Parent class",
340
- "class" => "medium-text",
341
- "description" => "Parent class for adding custom css"
342
- ),
343
- 'primary_color' => array(
344
- "type" => "text",
345
- "name" => "primary_color",
346
- "label" => "Primary Color",
347
- "id" => "primary-color",
348
- "class" => "rt-color",
349
- "default" => "#0367bf"
350
- ),
351
- 'button_bg_color' => array(
352
- "type" => "text",
353
- "name" => "button_bg_color",
354
- "label" => "Button background color",
355
- "id" => "button-bg-color",
356
- "class" => "rt-color"
357
- ),
358
- 'button_hover_bg_color' => array(
359
- "type" => "text",
360
- "name" => "button_hover_bg_color",
361
- "label" => "Button hover background color",
362
- "id" => "button-hover-bg-color",
363
- "class" => "rt-color"
364
- ),
365
- 'button_active_bg_color' => array(
366
- "type" => "text",
367
- "name" => "button_active_bg_color",
368
- "label" => "Button active background color",
369
- "id" => "button-active-bg-color",
370
- "class" => "rt-color"
371
- ),
372
- 'button_text_bg_color' => array(
373
- "type" => "text",
374
- "name" => "button_text_color",
375
- "label" => "Button text color",
376
- "id" => "button-text-color",
377
- "class" => "rt-color"
378
- ),
379
- 'title_color' => array(
380
- "type" => "text",
381
- "name" => "title_color",
382
- "label" => esc_html__( "Title color", "the-post-grid" ),
383
- "id" => "title_color",
384
- "class" => "rt-color"
385
- ),
386
- 'title_hover_color' => array(
387
- "type" => "text",
388
- "name" => "title_hover_color",
389
- "label" => esc_html__( "Title hover color", "the-post-grid" ),
390
- "id" => "title_hover_color",
391
- "class" => "rt-color"
392
- ),
393
- 'tpg_read_more_button_border_radius' => array(
394
- "type" => "number",
395
- "name" => "tpg_read_more_button_border_radius",
396
- "id" => "tpg-read-more-button-border-radius",
397
- "class" => "small-text",
398
- "label" => esc_html__( "Read more button border radius", "the-post-grid" ),
399
- "description" => esc_html__( "Leave it blank for default", 'the-post-grid' )
400
- )
401
- );
402
 
403
- }
404
 
405
- function getTitleTags() {
406
- return array(
407
- 'h2' => "H2",
408
- 'h3' => "H3",
409
- 'h4' => "H4"
410
- );
411
- }
412
 
413
- function itemFields() {
414
- return array(
415
- "type" => "checkbox",
416
- "name" => "item_fields",
417
- "label" => "Field selection",
418
- "id" => "item-fields",
419
- "multiple" => true,
420
- "alignment" => "vertical",
421
- "default" => array_keys( $this->rtTPGItemFields() ),
422
- "options" => $this->rtTPGItemFields()
423
- );
424
- }
425
 
426
- function rtMediaSource() {
427
- return array(
428
- "feature_image" => __( "Feature Image", 'the-post-grid' ),
429
- "first_image" => __( "First Image from content", 'the-post-grid' )
430
- );
431
- }
432
 
433
- function rtTPGColumns() {
434
- return array(
435
- 1 => "Column 1",
436
- 2 => "Column 2",
437
- 3 => "Column 3",
438
- 4 => "Column 4",
439
- 5 => "Column 5",
440
- 6 => "Column 6"
441
- );
442
- }
443
 
444
- function rtTPGLayouts() {
445
- $layouts = array(
446
- 'layout1' => "Layout 1",
447
- 'layout2' => "Layout 2",
448
- 'layout3' => "Layout 3",
449
- 'isotope1' => "Isotope Layout"
450
- );
451
 
452
- return apply_filters( 'tpg_layouts', $layouts );
453
- }
454
 
455
- function rtTPGItemFields() {
456
- return array(
457
- 'title' => __( "Title", 'the-post-grid' ),
458
- 'excerpt' => __( "Excerpt", 'the-post-grid' ),
459
- 'read_more' => __( "Read More", 'the-post-grid' ),
460
- 'post_date' => __( "Post Date", 'the-post-grid' ),
461
- 'author' => __( "Author", 'the-post-grid' ),
462
- 'categories' => __( "Categories", 'the-post-grid' ),
463
- 'tags' => __( "Tags", 'the-post-grid' ),
464
- 'comment_count' => __( "Comment Count", 'the-post-grid' )
465
- );
466
- }
467
 
468
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
 
470
  endif;
1
  <?php
2
 
3
+ if (!class_exists('rtTPGOptions')):
4
 
5
+ class rtTPGOptions
6
+ {
7
 
8
+ function rtPostTypes() {
9
+ $post_types = get_post_types(
10
+ array(
11
+ '_builtin' => true
12
+ )
13
+ );
14
+ $exclude = array('attachment', 'revision', 'nav_menu_item');
15
+ foreach ($exclude as $ex) {
16
+ unset($post_types[$ex]);
17
+ }
18
 
19
+ return $post_types;
20
+ }
21
 
22
+ function rtPostOrders() {
23
+ return array(
24
+ "ASC" => "Ascending",
25
+ "DESC" => "Descending",
26
+ );
27
+ }
28
 
29
+ function rtTermOperators() {
30
+ return array(
31
+ 'IN' => "IN — show posts which associate with one or more of selected terms",
32
+ 'NOT IN' => "NOT IN — show posts which do not associate with any of selected terms",
33
+ 'AND' => "AND — show posts which associate with all of selected terms",
34
+ );
35
+ }
36
 
37
+ function rtTermRelations() {
38
+ return array(
39
+ 'AND' => "AND — show posts which match all settings",
40
+ 'OR' => "OR — show posts which match one or more settings",
41
+ );
42
+ }
43
 
44
+ function rtPostOrderBy() {
45
+ return array(
46
+ "ID" => "ID",
47
+ "title" => "Title",
48
+ "date" => "Created date",
49
+ "modified" => "Modified date",
50
+ "menu_order" => "Menu Order"
51
+ );
52
+ }
53
 
54
+ function rtTPGSettingFields() {
55
+ global $rtTPG;
56
+ $settings = get_option($rtTPG->options['settings']);
57
 
58
+ return array(
59
+ 'custom_css' => array(
60
+ 'type' => 'textarea',
61
+ 'name' => 'custom_css',
62
+ 'label' => 'Custom Css',
63
+ 'holderClass' => 'rt-script-wrapper full',
64
+ 'id' => 'custom-css',
65
+ 'value' => isset($settings['custom_css']) ? stripslashes($settings['custom_css']) : null,
66
+ ),
67
+ "script_before_item_load" => array(
68
+ 'name' => 'script_before_item_load',
69
+ "label" => __("Script before item load", 'the-post-grid'),
70
+ 'type' => 'textarea',
71
+ 'holderClass' => 'rt-script-wrapper full',
72
+ 'id' => 'script-before-item-load',
73
+ 'value' => isset($settings['script_before_item_load']) ? stripslashes($settings['script_before_item_load']) : null
74
+ ),
75
+ "script_after_item_load" => array(
76
+ 'name' => 'script_after_item_load',
77
+ "label" => __("Script After item load", 'the-post-grid'),
78
+ 'type' => 'textarea',
79
+ 'holderClass' => 'rt-script-wrapper full',
80
+ 'id' => 'script-after-item-load',
81
+ 'value' => isset($settings['script_after_item_load']) ? stripslashes($settings['script_after_item_load']) : null
82
+ ),
83
+ "script_loaded" => array(
84
+ 'name' => 'script_loaded',
85
+ "label" => __("After Loaded Script", 'the-post-grid'),
86
+ 'type' => 'textarea',
87
+ 'holderClass' => 'rt-script-wrapper full',
88
+ 'id' => 'script-loaded',
89
+ 'value' => isset($settings['script_loaded']) ? stripslashes($settings['script_loaded']) : null
90
+ )
91
+ );
92
+ }
93
 
94
+ function rtTPGCommonFilterFields() {
95
+ return array(
96
+ 'post__in' => array(
97
+ "name" => "post__in",
98
+ "label" => "Include only",
99
+ "type" => "text",
100
+ "class" => "full",
101
+ "description" => __('List of post IDs to show (comma-separated values, for example: 1,2,3)',
102
+ 'the-post-grid')
103
+ ),
104
+ 'post__not_in' => array(
105
+ "name" => "post__not_in",
106
+ "label" => "Exclude",
107
+ "type" => "text",
108
+ "class" => "full",
109
+ "description" => __('List of post IDs to hide (comma-separated values, for example: 1,2,3)',
110
+ 'the-post-grid')
111
+ ),
112
+ 'limit' => array(
113
+ "name" => "limit",
114
+ "label" => "Limit",
115
+ "type" => "number",
116
+ "class" => "full",
117
+ "description" => __('The number of posts to show. Set empty to show all found posts.',
118
+ 'the-post-grid')
119
+ )
120
+ );
121
+ }
122
 
123
+ function rtTPGPostType() {
124
+ return array(
125
+ "name" => "tpg_post_type",
126
+ "label" => "Post Type",
127
+ "type" => "select",
128
+ "id" => "rc-sc-post-type",
129
+ "class" => "rt-select2",
130
+ "options" => $this->rtPostTypes()
131
+ );
132
+ }
133
 
134
+ function rtTPAdvanceFilters() {
135
+ return array(
136
+ 'type' => "checkbox",
137
+ 'name' => "post_filter",
138
+ 'label' => "Advanced filters",
139
+ 'id' => "post_filter",
140
+ "alignment" => "vertical",
141
+ "multiple" => true,
142
+ "options" => array(
143
+ 'tpg_taxonomy' => "Taxonomy",
144
+ 'order' => "Order",
145
+ 'author' => "Author",
146
+ 'tpg_post_status' => "Status",
147
+ 's' => "Search"
148
+ ),
149
+ );
150
+ }
151
 
152
+ function rtTPGPostStatus() {
153
+ return array(
154
+ 'publish' => 'Publish',
155
+ 'pending' => 'Pending',
156
+ 'draft' => 'Draft',
157
+ 'auto-draft' => 'Auto draft',
158
+ 'future' => 'Future',
159
+ 'private' => 'Private',
160
+ 'inherit' => 'Inherit',
161
+ 'trash' => 'Trash',
162
+ );
163
+ }
164
 
165
+ function rtTPGLayoutSettingFields() {
166
+ global $rtTPG;
167
 
168
+ return array(
169
+ 'layout' => array(
170
+ "type" => "select",
171
+ "name" => "layout",
172
+ "label" => "Layout",
173
+ "id" => "rt-tpg-sc-layout",
174
+ "class" => "rt-select2",
175
+ "options" => $this->rtTPGLayouts()
176
+ ),
177
+ 'isotope-filtering' => array(
178
+ "type" => "select",
179
+ "name" => "isotope_filter",
180
+ "label" => "Isotope Filter",
181
+ 'holderClass' => "sc-isotope-filter tpg-hidden",
182
+ "id" => "rt-tpg-sc-isotope-filter",
183
+ "class" => "rt-select2",
184
+ "options" => $rtTPG->rt_get_taxonomy_for_isotope_filter()
185
+ ),
186
+ 'tpg_show_all_text' => array(
187
+ "type" => "text",
188
+ "name" => "tpg_show_all_text",
189
+ 'holderClass' => "sc-isotope-filter tpg-hidden",
190
+ "label" => esc_html__("Show all text", 'the-post-grid'),
191
+ "default" => esc_html__("Show all", 'the-post-grid')
192
+ ),
193
+ 'tgp_layout2_image_column' => array(
194
+ 'type' => 'select',
195
+ "name" => "tgp_layout2_image_column",
196
+ "id" => "tgp_layout2_image_column",
197
+ 'label' => __('Image column', 'the-post-grid'),
198
+ 'class' => 'rt-select2',
199
+ 'holderClass' => "holder-layout2-image-column tpg-hidden",
200
+ 'default' => 4,
201
+ 'options' => $this->rtTPGColumns(),
202
+ "description" => "Content column will calculate automatically"
203
+ ),
204
+ 'column' => array(
205
+ "type" => "select",
206
+ "name" => "column",
207
+ "label" => "Column",
208
+ "id" => "rt-column",
209
+ "class" => "rt-select2",
210
+ "default" => 4,
211
+ "options" => $this->rtTPGColumns()
212
+ ),
213
+ 'pagination' => array(
214
+ "type" => "checkbox",
215
+ "name" => "pagination",
216
+ "label" => "Pagination",
217
+ 'holderClass' => "pagination",
218
+ "id" => "rt-tpg-pagination",
219
+ "option" => 'Enable'
220
+ ),
221
+ 'posts_per_page' => array(
222
+ "type" => "number",
223
+ "name" => "posts_per_page",
224
+ "label" => "Display per page",
225
+ 'holderClass' => "posts-per-page tpg-hidden",
226
+ "id" => "posts-per-page",
227
+ "default" => 5,
228
+ "description" => __("If value of Limit setting is not blank (empty), this value should be smaller than Limit value.",
229
+ 'the-post-grid')
230
+ ),
231
+ 'featured_image' => array(
232
+ "type" => "checkbox",
233
+ "name" => "featured_image",
234
+ "label" => "Feature Image",
235
+ "id" => "rt-feature-image",
236
+ "option" => 'Disable'
237
+ ),
238
+ 'featured_image_size' => array(
239
+ "type" => "select",
240
+ "name" => "featured_image_size",
241
+ "label" => "Feature Image Size",
242
+ "id" => "featured-image-size",
243
+ 'holderClass' => "feature-image-options tpg-hidden",
244
+ "class" => "rt-select2",
245
+ "options" => $rtTPG->get_image_sizes()
246
+ ),
247
+ 'media_source' => array(
248
+ "type" => "radio",
249
+ "name" => "media_source",
250
+ "label" => "Media Source",
251
+ "id" => "media-source",
252
+ 'holderClass' => "feature-image-options tpg-hidden",
253
+ "default" => 'feature_image',
254
+ "alignment" => "vertical",
255
+ "options" => $this->rtMediaSource()
256
+ ),
257
+ 'tpg_title_limit' => array(
258
+ "name" => "tpg_title_limit",
259
+ "id" => "tpg-title-limit",
260
+ "type" => "number",
261
+ "label" => esc_html__("Title limit", 'the-post-grid'),
262
+ "description" => esc_html__("Title limit only integer number is allowed, Leave it blank for full title.", 'the-post-grid')
263
+ ),
264
+ 'tpg_title_limit_type' => array(
265
+ "name" => "tpg_title_limit_type",
266
+ "id" => "tpg-title-limit-type",
267
+ "type" => "radio",
268
+ "label" => esc_html__("Title limit type", 'the-post-grid'),
269
+ "alignment" => "vertical",
270
+ "default" => 'character',
271
+ "options" => $this->get_limit_type(),
272
+ ),
273
+ 'excerpt_limit' => array(
274
+ "type" => "number",
275
+ "name" => "excerpt_limit",
276
+ "label" => esc_html__("Excerpt limit", 'the-post-grid'),
277
+ "id" => "excerpt-limit",
278
+ "description" => __("Excerpt limit only integer number is allowed, Leave it blank for full excerpt. Note: This will remove all html tag",
279
+ 'the-post-grid')
280
+ ),
281
+ 'tgp_excerpt_type' => array(
282
+ "type" => "radio",
283
+ "label" => esc_html__("Excerpt Type", 'the-post-grid'),
284
+ "name" => "tgp_excerpt_type",
285
+ "id" => "tgp_excerpt_type",
286
+ "alignment" => "vertical",
287
+ "default" => 'character',
288
+ "options" => $this->get_limit_type('content'),
289
+ ),
290
+ 'tgp_excerpt_more_text' => array(
291
+ "type" => "text",
292
+ "label" => esc_html__("Excerpt more text", 'the-post-grid'),
293
+ "name" => "tgp_excerpt_more_text",
294
+ "id" => "tgp_excerpt_more_text",
295
+ "default" => "..."
296
+ ),
297
+ 'tgp_read_more_text' => array(
298
+ "type" => "text",
299
+ "label" => esc_html__("Read more text", 'the-post-grid'),
300
+ "name" => "tgp_read_more_text",
301
+ "id" => "tgp_read_more_text",
302
+ ),
303
+ 'tpg_overlay' => array(
304
+ "type" => "checkbox",
305
+ "name" => "tpg_overlay",
306
+ "label" => esc_html__("Overlay", 'the-post-grid'),
307
+ "id" => "tpg_overlay",
308
+ "option" => 'Enable'
309
+ ),
310
+ 'title_tag' => array(
311
+ 'type' => 'select',
312
+ 'name' => 'title_tag',
313
+ 'label' => esc_html__('Title tag', 'the-post-grid'),
314
+ 'class' => 'rt-select2',
315
+ 'id' => 'title-tag',
316
+ 'options' => $this->getTitleTags(),
317
+ 'default' => 'h2'
318
+ ),
319
+ 'link_to_detail_page' => array(
320
+ "type" => "radio",
321
+ 'name' => 'link_to_detail_page',
322
+ "label" => esc_html__("Link To Detail Page", 'the-post-grid'),
323
+ "alignment" => "vertical",
324
+ "default" => 'yes',
325
+ "options" => array(
326
+ 'yes' => 'Yes',
327
+ 'no' => 'No'
328
+ )
329
+ ),
330
+ 'link_target' => array(
331
+ "type" => "radio",
332
+ "name" => "link_target",
333
+ "label" => esc_html__("Link Target", 'the-post-grid'),
334
+ 'holderClass' => "tpg-link-target tpg-hidden",
335
+ "alignment" => 'vertical',
336
+ "options" => array(
337
+ '' => 'Same Window',
338
+ '_blank' => 'New Window'
339
+ )
340
+ ),
341
+ );
342
+ }
343
 
344
+ function get_limit_type($content = null) {
345
+ $types = array(
346
+ 'character' => __("Character", "the-post-grid"),
347
+ 'word' => __("Word", "the-post-grid")
348
+ );
349
+ if ($content === 'content') {
350
+ $types['full'] = __("Full Content", "the-post-grid");
351
+ }
352
 
353
+ return apply_filters('tpg_limit_type', $types, $content);
354
+ }
355
 
356
+ function rtTPGStyleFields() {
357
 
358
+ return array(
359
+ 'parent_class' => array(
360
+ "name" => "parent_class",
361
+ "type" => "text",
362
+ "label" => "Parent class",
363
+ "class" => "medium-text",
364
+ "description" => "Parent class for adding custom css"
365
+ ),
366
+ 'primary_color' => array(
367
+ "type" => "text",
368
+ "name" => "primary_color",
369
+ "label" => "Primary Color",
370
+ "id" => "primary-color",
371
+ "class" => "rt-color",
372
+ "default" => "#0367bf"
373
+ ),
374
+ 'button_bg_color' => array(
375
+ "type" => "text",
376
+ "name" => "button_bg_color",
377
+ "label" => "Button background color",
378
+ "id" => "button-bg-color",
379
+ "class" => "rt-color"
380
+ ),
381
+ 'button_hover_bg_color' => array(
382
+ "type" => "text",
383
+ "name" => "button_hover_bg_color",
384
+ "label" => "Button hover background color",
385
+ "id" => "button-hover-bg-color",
386
+ "class" => "rt-color"
387
+ ),
388
+ 'button_active_bg_color' => array(
389
+ "type" => "text",
390
+ "name" => "button_active_bg_color",
391
+ "label" => "Button active background color",
392
+ "id" => "button-active-bg-color",
393
+ "class" => "rt-color"
394
+ ),
395
+ 'button_text_bg_color' => array(
396
+ "type" => "text",
397
+ "name" => "button_text_color",
398
+ "label" => "Button text color",
399
+ "id" => "button-text-color",
400
+ "class" => "rt-color"
401
+ ),
402
+ 'title_color' => array(
403
+ "type" => "text",
404
+ "name" => "title_color",
405
+ "label" => esc_html__("Title color", "the-post-grid"),
406
+ "id" => "title_color",
407
+ "class" => "rt-color"
408
+ ),
409
+ 'title_hover_color' => array(
410
+ "type" => "text",
411
+ "name" => "title_hover_color",
412
+ "label" => esc_html__("Title hover color", "the-post-grid"),
413
+ "id" => "title_hover_color",
414
+ "class" => "rt-color"
415
+ ),
416
+ 'tpg_read_more_button_border_radius' => array(
417
+ "type" => "number",
418
+ "name" => "tpg_read_more_button_border_radius",
419
+ "id" => "tpg-read-more-button-border-radius",
420
+ "class" => "small-text",
421
+ "label" => esc_html__("Read more button border radius", "the-post-grid"),
422
+ "description" => esc_html__("Leave it blank for default", 'the-post-grid')
423
+ )
424
+ );
425
 
426
+ }
427
 
428
+ function getTitleTags() {
429
+ return array(
430
+ 'h2' => "H2",
431
+ 'h3' => "H3",
432
+ 'h4' => "H4"
433
+ );
434
+ }
435
 
436
+ function itemFields() {
437
+ return array(
438
+ "type" => "checkbox",
439
+ "name" => "item_fields",
440
+ "label" => "Field selection",
441
+ "id" => "item-fields",
442
+ "multiple" => true,
443
+ "alignment" => "vertical",
444
+ "default" => array_keys($this->rtTPGItemFields()),
445
+ "options" => $this->rtTPGItemFields()
446
+ );
447
+ }
448
 
449
+ function rtMediaSource() {
450
+ return array(
451
+ "feature_image" => __("Feature Image", 'the-post-grid'),
452
+ "first_image" => __("First Image from content", 'the-post-grid')
453
+ );
454
+ }
455
 
456
+ function rtTPGColumns() {
457
+ return array(
458
+ 1 => "Column 1",
459
+ 2 => "Column 2",
460
+ 3 => "Column 3",
461
+ 4 => "Column 4",
462
+ 5 => "Column 5",
463
+ 6 => "Column 6"
464
+ );
465
+ }
466
 
467
+ function rtTPGLayouts() {
468
+ $layouts = array(
469
+ 'layout1' => "Layout 1",
470
+ 'layout2' => "Layout 2",
471
+ 'layout3' => "Layout 3",
472
+ 'isotope1' => "Isotope Layout"
473
+ );
474
 
475
+ return apply_filters('tpg_layouts', $layouts);
476
+ }
477
 
478
+ function rtTPGItemFields() {
479
+ return array(
480
+ 'title' => __("Title", 'the-post-grid'),
481
+ 'excerpt' => __("Excerpt", 'the-post-grid'),
482
+ 'read_more' => __("Read More", 'the-post-grid'),
483
+ 'post_date' => __("Post Date", 'the-post-grid'),
484
+ 'author' => __("Author", 'the-post-grid'),
485
+ 'categories' => __("Categories", 'the-post-grid'),
486
+ 'tags' => __("Tags", 'the-post-grid'),
487
+ 'comment_count' => __("Comment Count", 'the-post-grid')
488
+ );
489
+ }
490
 
491
+ function get_pro_feature_list() {
492
+ return '<ol>
493
+ <li>Fully responsive and mobile friendly.</li>
494
+ <li>55 Different Layouts</li>
495
+ <li>Even and Masonry Grid.</li>
496
+ <li>WooCommerce supported.</li>
497
+ <li>Custom Post Type Supported</li>
498
+ <li>Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)</li>
499
+ <li>Order by Id, Title, Created date, Modified date and Menu order.</li>
500
+ <li>Display image size (thumbnail, medium, large, full)</li>
501
+ <li>Isotope filter for any taxonomy ie. categories, tags...</li>
502
+ <li>Query Post with Relation.</li>
503
+ <li>Fields Selection.</li>
504
+ <li>All Text and Color control.</li>
505
+ <li>Enable/Disable Pagination.</li>
506
+ <li>AJAX Pagination (Load more and Load on Scrolling)</li>
507
+ </ol>
508
+ <a href="https://www.radiustheme.com/the-post-grid-pro-for-wordpress/" class="rt-admin-btn" target="_blank">' . __("Get Pro Version", "the-post-grid") . '</a>';
509
+ }
510
+
511
+ }
512
 
513
  endif;
lib/classes/rtTPGShortCode.php CHANGED
@@ -1,481 +1,487 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'rtTPGShortCode' ) ):
4
-
5
- class rtTPGShortCode {
6
-
7
- private $scA = array();
8
-
9
- function __construct() {
10
- add_shortcode( 'the-post-grid', array( $this, 'the_post_grid_short_code' ) );
11
- add_action( 'wp_ajax_tpgPreviewAjaxCall', array( $this, 'the_post_grid_short_code' ) );
12
- }
13
-
14
- function register_sc_scripts() {
15
- $iso = false;
16
- foreach ( $this->scA as $sc ) {
17
- if ( isset( $sc ) && is_array( $sc ) ) {
18
- if ( $sc['isIsotope'] ) {
19
- $iso = true;
20
- }
21
- }
22
- }
23
- if ( count( $this->scA ) ) {
24
- if ( $iso ) {
25
- wp_enqueue_script( 'rt-isotope-js' );
26
- }
27
- wp_enqueue_style( 'rt-fontawsome' );
28
- wp_enqueue_script( 'rt-actual-height-js' );
29
- wp_enqueue_script( 'rt-tpg' );
30
- $nonce = wp_create_nonce( rtTPG()->nonceText() );
31
- wp_localize_script( 'rt-tpg', 'rttpg',
32
- array(
33
- 'nonceID' => rtTPG()->nonceId(),
34
- 'nonce' => $nonce,
35
- 'ajaxurl' => admin_url( 'admin-ajax.php' )
36
- ) );
37
- }
38
- }
39
-
40
- function the_post_grid_short_code( $atts = array(), $content = null ) {
41
- $error = true;
42
- $html = $msg = null;
43
- $preview = isset( $_REQUEST['sc_id'] ) ? absint( $_REQUEST['sc_id'] ) : 0;
44
- $arg = array();
45
- $atts = shortcode_atts( array(
46
- 'id' => null
47
- ), $atts, 'the-post-grid' );
48
- $scID = $atts['id'];
49
- if ( ( ! $preview && $scID && ! is_null( get_post( $scID ) ) ) || ( $preview && rtTPG()->verifyNonce() ) ) {
50
- $rand = mt_rand();
51
- $layoutID = "rt-tpg-container-" . $rand;
52
- $pagination = false;
53
-
54
- if ( $preview ) {
55
- $error = false;
56
- $scMeta = $_REQUEST;
57
- $layout = isset( $scMeta['layout'] ) ? $scMeta['layout'] : 'layout1';
58
- $col = isset( $scMeta['column'] ) ? intval( $scMeta['column'] ) : 4;
59
-
60
- $fImg = isset( $scMeta['featured_image'] ) ? true : false;
61
- $fImgSize = isset( $scMeta['featured_image_size'] ) ? $scMeta['featured_image_size'] : "medium";
62
- $mediaSource = isset( $scMeta['media_source'] ) ? $scMeta['media_source'] : "feature_image";
63
- $arg['excerpt_type'] = isset( $scMeta['tgp_excerpt_type'] ) ? $scMeta['tgp_excerpt_type'] : 'character';
64
- $arg['excerpt_limit'] = isset( $scMeta['excerpt_limit'] ) ? absint( $scMeta['excerpt_limit'] ) : 0;
65
- $arg['excerpt_more_text'] = isset( $scMeta['tgp_excerpt_more_text'] ) ? $scMeta['tgp_excerpt_more_text'] : null;
66
- $arg['title_limit_type'] = isset( $scMeta['tpg_title_limit_type'] ) ? $scMeta['tpg_title_limit_type'] : 'character';
67
- $arg['title_limit'] = isset( $scMeta['tpg_title_limit'] ) ? absint( $scMeta['tpg_title_limit'] ) : 0;
68
- $arg['read_more_text'] = isset( $scMeta['tgp_read_more_text'] ) && ! empty( $scMeta['tgp_read_more_text'] ) ? $scMeta['tgp_read_more_text'] : __( 'Read More',
69
- 'the-post-grid' );
70
- $arg['show_all_text'] = isset( $scMeta['tpg_show_all_text'] ) && ! empty( $scMeta['tpg_show_all_text'] ) ? $scMeta['tpg_show_all_text'] : __( 'Show all',
71
- 'the-post-grid-pro' );
72
- $postType = isset( $scMeta['tpg_post_type'] ) ? $scMeta['tpg_post_type'] : null;
73
- $post__in = isset( $scMeta['post__in'] ) ? $scMeta['post__in'] : null;
74
- $post__not_in = isset( $scMeta['post__not_in'] ) ? $scMeta['post__not_in'] : null;
75
- $limit = isset( $scMeta['limit'] ) && ! empty( $scMeta['limit'] ) ? ( $scMeta['limit'] == - 1 ? 10000000 : (int) $scMeta['limit'] ) : 10000000;
76
- $pagination = isset( $scMeta['pagination'] ) ? $scMeta['pagination'] : false;
77
- $posts_per_page = isset( $scMeta['posts_per_page'] ) ? intval( $scMeta['posts_per_page'] ) : $limit;
78
- $order_by = isset( $scMeta['order_by'] ) ? $scMeta['order_by'] : null;
79
- $order = isset( $scMeta['order'] ) ? $scMeta['order'] : null;
80
- $s = isset( $scMeta['s'] ) ? $scMeta['s'] : null;
81
- $isotope_filter = isset( $scMeta['isotope_filter'] ) ? $scMeta['isotope_filter'] : null;
82
-
83
- } else {
84
- $scMeta = get_post_meta( $scID );
85
- $scMeta['sc_id'] = $scID;
86
- $layout = isset( $scMeta['layout'][0] ) ? $scMeta['layout'][0] : 'layout1';
87
- $col = isset( $scMeta['column'][0] ) ? intval( $scMeta['column'][0] ) : 4;
88
-
89
- $fImg = isset( $scMeta['featured_image'][0] ) ? true : false;
90
- $fImgSize = isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : "medium";
91
- $mediaSource = isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : "feature_image";
92
- $arg['excerpt_type'] = isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character';
93
- $arg['excerpt_limit'] = isset( $scMeta['excerpt_limit'][0] ) ? absint( $scMeta['excerpt_limit'][0] ) : 0;
94
- $arg['excerpt_more_text'] = isset( $scMeta['tgp_excerpt_more_text'][0] ) ? $scMeta['tgp_excerpt_more_text'][0] : null;
95
- $arg['title_limit_type'] = isset( $scMeta['tpg_title_limit_type'][0] ) ? $scMeta['tpg_title_limit_type'][0] : 'character';
96
- $arg['title_limit'] = isset( $scMeta['tpg_title_limit'][0] ) ? absint( $scMeta['tpg_title_limit'][0] ) : 0;
97
- $arg['read_more_text'] = isset( $scMeta['tgp_read_more_text'][0] ) && ! empty( $scMeta['tgp_read_more_text'][0] ) ? $scMeta['tgp_read_more_text'][0] : __( 'Read More',
98
- 'the-post-grid' );
99
- $arg['show_all_text'] = ( ! empty( $scMeta['tpg_show_all_text'][0] ) ? $scMeta['tpg_show_all_text'][0] : __( 'Show all',
100
- 'the-post-grid-pro' ) );
101
-
102
- $postType = isset( $scMeta['tpg_post_type'][0] ) ? $scMeta['tpg_post_type'][0] : null;
103
- $post__in = isset( $scMeta['post__in'][0] ) ? $scMeta['post__in'][0] : null;
104
- $post__not_in = isset( $scMeta['post__not_in'][0] ) ? $scMeta['post__not_in'][0] : null;
105
- $limit = isset( $scMeta['limit'][0] ) && ! empty( $scMeta['limit'][0] ) ? ( $scMeta['limit'][0] == - 1 ? 10000000 : (int) $scMeta['limit'][0] ) : 10000000;
106
- $pagination = isset( $scMeta['pagination'][0] ) ? $scMeta['pagination'][0] : false;
107
- $posts_per_page = isset( $scMeta['posts_per_page'][0] ) ? intval( $scMeta['posts_per_page'][0] ) : $limit;
108
- $order_by = isset( $scMeta['order_by'][0] ) ? $scMeta['order_by'][0] : null;
109
- $order = isset( $scMeta['order'][0] ) ? $scMeta['order'][0] : null;
110
- $s = isset( $scMeta['s'][0] ) ? $scMeta['s'][0] : null;
111
- $isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
112
-
113
- }
114
- if ( ! in_array( $layout, array_keys( rtTPG()->rtTPGLayouts() ) ) ) {
115
- $layout = 'layout1';
116
- }
117
- if ( ! in_array( $col, array_keys( rtTPG()->rtTPGColumns() ) ) ) {
118
- $col = 4;
119
- }
120
-
121
- $isIsotope = preg_match( '/isotope/', $layout );
122
-
123
- /* Argument create */
124
- $args = array();
125
- $itemIdsArgs = array();
126
- if ( $postType ) {
127
- $args['post_type'] = $itemIdsArgs['post_type'] = $postType;
128
- }
129
-
130
- // Common filter
131
- /* post__in */
132
- if ( $post__in ) {
133
- $post__in = explode( ',', $post__in );
134
- $args['post__in'] = $itemIdsArgs['post__in'] = $post__in;
135
- }
136
- /* post__not_in */
137
- if ( $post__not_in ) {
138
- $post__not_in = explode( ',', $post__not_in );
139
- $args['post__not_in'] = $itemIdsArgs['post__not_in'] = $post__not_in;
140
- }
141
-
142
- /* LIMIT */
143
- $args['posts_per_page'] = $itemIdsArgs['posts_per_page'] = $limit;
144
- if ( ! $isIsotope && $pagination ) {
145
- if ( $posts_per_page > $limit ) {
146
- $posts_per_page = $limit;
147
- }
148
- // Set 'posts_per_page' parameter
149
- $args['posts_per_page'] = $posts_per_page;
150
- if ( get_query_var( 'paged' ) ) {
151
- $paged = get_query_var( 'paged' );
152
- } elseif ( get_query_var( 'page' ) ) {
153
- $paged = get_query_var( 'page' );
154
- } else {
155
- $paged = 1;
156
- }
157
- $offset = $posts_per_page * ( (int) $paged - 1 );
158
- $args['paged'] = $paged;
159
-
160
- // Update posts_per_page
161
- if ( intval( $args['posts_per_page'] ) > $limit - $offset ) {
162
- $args['posts_per_page'] = $limit - $offset;
163
- }
164
-
165
-
166
- }
167
-
168
- // Advance Filter
169
- $adv_filter = isset( $scMeta['post_filter'] ) ? $scMeta['post_filter'] : array();
170
-
171
- // Taxonomy
172
- $taxQ = array();
173
- if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $scMeta['tpg_taxonomy'] ) ) {
174
-
175
- if ( is_array( $scMeta['tpg_taxonomy'] ) && ! empty( $scMeta['tpg_taxonomy'] ) ) {
176
- foreach ( $scMeta['tpg_taxonomy'] as $taxonomy ) {
177
- $terms = ( isset( $scMeta[ 'term_' . $taxonomy ] ) ? $scMeta[ 'term_' . $taxonomy ] : array() );
178
- if ( is_array( $terms ) && ! empty( $terms ) ) {
179
- $operator = isset( $scMeta[ 'term_operator_' . $taxonomy ][0] ) ? $scMeta[ 'term_operator_' . $taxonomy ][0] : "IN";
180
- if ( $preview ) {
181
- $operator = isset( $scMeta[ 'term_operator_' . $taxonomy ] ) ? $scMeta[ 'term_operator_' . $taxonomy ] : "IN";
182
- }
183
- $taxQ[] = array(
184
- 'taxonomy' => $taxonomy,
185
- 'field' => 'term_id',
186
- 'terms' => $terms,
187
- 'operator' => $operator,
188
- );
189
- }
190
- }
191
- }
192
- if ( count( $taxQ ) >= 2 ) {
193
- $relation = isset( $scMeta['taxonomy_relation'][0] ) ? $scMeta['taxonomy_relation'][0] : "AND";
194
- if ( $preview ) {
195
- $relation = isset( $scMeta['taxonomy_relation'] ) ? $scMeta['taxonomy_relation'] : "AND";
196
- }
197
- $taxQ['relation'] = $relation;
198
- }
199
- }
200
-
201
- if ( ! empty( $taxQ ) ) {
202
- $args['tax_query'] = $itemIdsArgs['tax_query'] = $taxQ;
203
- }
204
-
205
- // Order
206
- if ( in_array( 'order', $adv_filter ) ) {
207
- if ( $order ) {
208
- $args['order'] = $itemIdsArgs['order'] = $order;
209
- }
210
- if ( $order_by ) {
211
- $args['orderby'] = $itemIdsArgs['orderby'] = $order_by;
212
- }
213
- }
214
- // Status
215
- if ( in_array( 'tpg_post_status', $adv_filter ) ) {
216
- $post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : array() );
217
- if ( ! empty( $post_status ) ) {
218
- $args['post_status'] = $itemIdsArgs['post_status'] = $post_status;
219
- } else {
220
- $args['post_status'] = $itemIdsArgs['post_status'] = 'publish';
221
- }
222
- }
223
- // Author
224
- $author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : array() );
225
- if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
226
- $args['author__in'] = $itemIdsArgs['author__in'] = $author;
227
- }
228
- // Search
229
- if ( in_array( 's', $adv_filter ) && $s ) {
230
- $args['s'] = $itemIdsArgs['s'] = $s;
231
- }
232
-
233
- // Validation
234
-
235
- if ( ( $layout == 'layout2' ) || ( $layout == 'layout3' ) ) {
236
- $iCol = isset( $scMeta['tgp_layout2_image_column'][0] ) ? absint( $scMeta['tgp_layout2_image_column'][0] ) : 4;
237
- if ( $preview ) {
238
- $iCol = isset( $scMeta['tgp_layout2_image_column'] ) ? absint( $scMeta['tgp_layout2_image_column'] ) : 4;
239
- }
240
- $iCol = $iCol > 12 ? 4 : $iCol;
241
- $cCol = 12 - $iCol;
242
- $arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
243
- $arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
244
- }
245
- $col = $col == 5 ? "24" : round( 12 / $col );
246
- if ( ( $layout == 'layout2' ) || ( $layout == 'layout3' ) ) {
247
- $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-12 rt-col-xs-12";
248
- } else {
249
- $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-6 rt-col-xs-12";
250
- }
251
-
252
-
253
- $arg['class'] = 'rt-equal-height';
254
- if ( $isIsotope ) {
255
- $arg['class'] .= ' isotope-item';
256
- }
257
-
258
- $arg['overlay'] = empty( $scMeta['tpg_overlay'][0] ) ? false : true;
259
- $parentClass = ( ! empty( $scMeta['parent_class'][0] ) ? trim( $scMeta['parent_class'][0] ) : null );
260
- $arg['items'] = isset( $scMeta['item_fields'] ) ? ( $scMeta['item_fields'] ? $scMeta['item_fields'] : array() ) : array();
261
- $arg['title_tag'] = ( ! empty( $scMeta['title_tag'][0] ) && in_array( $scMeta['title_tag'][0], array_keys( rtTPG()->getTitleTags() ) ) ) ? esc_attr( $scMeta['title_tag'][0] ) : 'h2';
262
- $postQuery = new WP_Query( apply_filters( 'tpg_sc_query_args', $args, $scMeta ) );
263
- // Start layout
264
- $html .= "<div class='container-fluid rt-tpg-container rt-tpg-container-{$scMeta['sc_id']} {$parentClass}' data-sc-id='{$scMeta['sc_id']}' id='{$layoutID}'>";
265
- $extClass = null;
266
- if ( $isIsotope ) {
267
- $extClass = ' tpg-isotope';
268
- }
269
- // Set readmore false if excerpt type = full content
270
- if ( isset( $arg['excerpt_type'] ) && $arg['excerpt_type'] === 'full' && ($key = array_search('read_more', $arg['items'])) !== false ) {
271
- unset( $arg['items'][$key] );
272
- }
273
-
274
- $html .= "<div class='rt-row rt-content-loader {$layout}{$extClass}'>";
275
- if ( $postQuery->have_posts() ) {
276
- $html .= $this->layoutStyle( $layoutID, $scMeta, $preview );
277
-
278
- if ( $isIsotope ) {
279
- $selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : array() );
280
- $terms = get_terms( $isotope_filter, array(
281
- 'orderby' => 'name',
282
- 'order' => 'ASC',
283
- 'hide_empty' => false,
284
- 'include' => $selectedTerms
285
- ) );
286
-
287
- $html .= '<div id="iso-button-' . $rand . '" class="iso-button-' . $scMeta['sc_id'] . ' rt-tpg-isotope-buttons filter-button-group option-set">
 
 
 
 
 
 
288
  <button data-filter="*" class="selected">' . $arg['show_all_text'] . '</button>';
289
- if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
290
- foreach ( $terms as $term ) {
291
- $html .= "<button data-filter='.iso_{$term->term_id}'>" . $term->name . "</button>";
292
- }
293
- }
294
- $html .= '</div>';
295
-
296
- $html .= '<div class="rt-tpg-isotope iso-tpg-' . $scMeta['sc_id'] . '" id="iso-tpg-' . $rand . '">';
297
- }
298
-
299
-
300
- while ( $postQuery->have_posts() ) {
301
- $postQuery->the_post();
302
- $pID = get_the_ID();
303
- $arg['pID'] = $pID;
304
- $arg['title'] = rtTPG()->get_the_title( $pID, $arg );
305
- $arg['pLink'] = get_permalink();
306
- $arg['author'] = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '">' . get_the_author() . '</a>';
307
- $cc = wp_count_comments( $pID );
308
- $arg['date'] = get_the_date();
309
- $arg['excerpt'] = rtTPG()->get_the_excerpt( $pID, $arg );
310
- $arg['categories'] = get_the_term_list( $pID, 'category', null, ', ' );
311
- $arg['tags'] = get_the_term_list( $pID, 'post_tag', null, ', ' );
312
- if ( $isIsotope ) {
313
- $termAs = wp_get_post_terms( $pID, $isotope_filter, array( "fields" => "all" ) );
314
- $isoFilter = null;
315
- if ( ! empty( $termAs ) ) {
316
- foreach ( $termAs as $term ) {
317
- $isoFilter .= " iso_" . $term->term_id;
318
- }
319
- }
320
- $arg['isoFilter'] = $isoFilter;
321
- }
322
- $deptClass = null;
323
- if ( ! empty( $deptAs ) ) {
324
- foreach ( $deptAs as $dept ) {
325
- $deptClass .= " " . $dept->slug;
326
- }
327
- }
328
- if ( comments_open() ) {
329
- $arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$cc->total_comments} </a>";
330
- } else {
331
- $arg['comment'] = "{$cc->total_comments}";
332
- }
333
- $imgSrc = null;
334
-
335
- $arg['imgSrc'] = ! $fImg ? rtTPG()->getFeatureImageSrc( $pID, $fImgSize, $mediaSource ) : null;
336
-
337
- $html .= rtTPG()->render( 'layouts/' . $layout, $arg, true );
338
- }
339
-
340
- if ( $isIsotope ) {
341
- $html .= '</div>'; // End isotope item holder
342
- }
343
-
344
- } else {
345
- $html .= sprintf( '<p>%s</p>',
346
- apply_filters( 'tpg_not_found_text', __( 'No post found', 'the-post-grid' ), $args, $scMeta )
347
- );
348
- }
349
- $html .= "</div>"; // End row
350
- if ( $pagination && ! $isIsotope ) {
351
- $found = 0;
352
- if ( $postQuery->found_posts > $limit ) {
353
- $found = $limit;
354
- } else {
355
- $found = $postQuery->found_posts;
356
- }
357
- $max_num_pages = ceil( $found / $posts_per_page );
358
- $html .= rtTPG()->rt_pagination( $max_num_pages, $args['posts_per_page'] );
359
- }
360
- $html .= "</div>"; // container rt-tpg
361
-
362
- wp_reset_postdata();
363
- if ( ! $preview ) {
364
- $scriptGenerator = array();
365
- $scriptGenerator['layout'] = $layoutID;
366
- $scriptGenerator['rand'] = $rand;
367
- $scriptGenerator['scMeta'] = $scMeta;
368
- $scriptGenerator['isIsotope'] = $isIsotope;
369
- $this->scA[] = $scriptGenerator;
370
- add_action( 'wp_footer', array( $this, 'register_sc_scripts' ) );
371
- }
372
- } else {
373
- if ( $preview ) {
374
- $msg = __( 'Session Error !!', 'the-post-grid' );
375
- } else {
376
- $html .= "<p>" . __( "No shortCode found", 'the-post-grid' ) . "</p>";
377
- }
378
- }
379
- if ( $preview ) {
380
- wp_send_json( array(
381
- 'error' => $error,
382
- 'msg' => $msg,
383
- 'data' => $html
384
- ) );
385
- die();
386
- }
387
-
388
- return $html;
389
- }
390
-
391
- function layoutStyle( $layout, $scMeta, $preview = false ) {
392
- if ( $preview ) {
393
- $primaryColor = ( ! empty( $scMeta['primary_color'] ) ? $scMeta['primary_color'] : null );
394
- $button_bg_color = ( ! empty( $scMeta['button_bg_color'] ) ? $scMeta['button_bg_color'] : null );
395
- $button_hover_bg_color = ( ! empty( $scMeta['button_hover_bg_color'] ) ? $scMeta['button_hover_bg_color'] : null );
396
- $button_active_bg_color = ( ! empty( $scMeta['button_active_bg_color'] ) ? $scMeta['button_active_bg_color'] : null );
397
- $button_text_color = ( ! empty( $scMeta['button_text_color'] ) ? $scMeta['button_text_color'] : null );
398
- $title_color = isset( $scMeta['title_color'] ) && ! empty( $scMeta['title_color'] ) ? $scMeta['title_color'] : null;
399
- $title_hover_color = isset( $scMeta['title_hover_color'] ) && ! empty( $scMeta['title_hover_color'] ) ? $scMeta['title_hover_color'] : null;
400
- $read_more_button_border_radius = isset( $scMeta['tpg_read_more_button_border_radius'] ) ? $scMeta['tpg_read_more_button_border_radius'] : '';
401
-
402
- } else {
403
-
404
- $primaryColor = ( ! empty( $scMeta['primary_color'][0] ) ? $scMeta['primary_color'][0] : null );
405
- $button_bg_color = ( ! empty( $scMeta['button_bg_color'][0] ) ? $scMeta['button_bg_color'][0] : null );
406
- $button_hover_bg_color = ( ! empty( $scMeta['button_hover_bg_color'][0] ) ? $scMeta['button_hover_bg_color'][0] : null );
407
- $button_active_bg_color = ( ! empty( $scMeta['button_active_bg_color'][0] ) ? $scMeta['button_active_bg_color'][0] : null );
408
- $button_text_color = ( ! empty( $scMeta['button_text_color'][0] ) ? $scMeta['button_text_color'][0] : null );
409
- $title_color = isset( $scMeta['title_color'][0] ) && ! empty( $scMeta['title_color'][0] ) ? $scMeta['title_color'][0] : null;
410
- $title_hover_color = isset( $scMeta['title_hover_color'][0] ) && ! empty( $scMeta['title_hover_color'][0] ) ? $scMeta['title_hover_color'][0] : null;
411
- $read_more_button_border_radius = isset( $scMeta['tpg_read_more_button_border_radius'][0] ) ? $scMeta['tpg_read_more_button_border_radius'][0] : '';
412
-
413
- }
414
- $css = null;
415
- $css .= "<style type='text/css' media='all'>";
416
- // Variable
417
- if ( $primaryColor ) {
418
- $css .= "#{$layout} .rt-detail i,
419
  #{$layout} .rt-detail .post-meta-user a,
420
  #{$layout} .rt-detail .post-meta-category a{";
421
- $css .= "color:" . $primaryColor . ";";
422
- $css .= "}";
423
- $css .= "body .rt-tpg-container .rt-tpg-isotope-buttons .selected{";
424
- $css .= "background-color:" . $primaryColor . ";";
425
- $css .= "}";
426
- }
427
- if ( $button_bg_color ) {
428
- $css .= "#{$layout} .pagination li a,
429
  #{$layout} .rt-tpg-isotope-buttons button,
430
  #{$layout} .rt-detail .read-more a{";
431
- $css .= "background-color:" . $button_bg_color . ";";
432
- $css .= "}";
433
- }
434
- if ( $button_hover_bg_color ) {
435
- $css .= "#{$layout} .pagination li a:hover,
436
  #{$layout} .rt-tpg-isotope-buttons button:hover,
437
  #{$layout} .rt-detail .read-more a:hover{";
438
- $css .= "background-color:" . $button_hover_bg_color . ";";
439
- $css .= "}";
440
- }
441
- if ( $button_active_bg_color ) {
442
- $css .= "#{$layout} .pagination li.active span,
443
  #{$layout} .rt-tpg-isotope-buttons button.selected{";
444
- $css .= "background-color:" . $button_active_bg_color . ";";
445
- $css .= "}";
446
- }
447
- if ( $button_text_color ) {
448
- $css .= "#{$layout} .pagination li a,
449
  #{$layout} .rt-tpg-isotope-buttons button,
450
  #{$layout} .rt-detail .read-more a{";
451
- $css .= "color:" . $button_text_color . ";";
452
- $css .= "}";
453
- }
454
- if ( $title_color ) {
455
- $css .= "#{$layout} .rt-detail h2.entry-title a,
456
  #{$layout} .rt-detail h3.entry-title a,
457
  #{$layout} .rt-detail h4.entry-title a{";
458
- $css .= "color:" . $title_color . ";";
459
- $css .= "}";
460
- }
461
- if ( $title_hover_color ) {
462
- $css .= "#{$layout} .rt-detail h2.entry-title a:hover,
463
  #{$layout} .rt-detail h3.entry-title a:hover,
464
  #{$layout} .rt-detail h4.entry-title a:hover{";
465
- $css .= "color:" . $title_hover_color . ";";
466
- $css .= "}";
467
- }
468
-
469
- // Read more button Position
470
- if ( isset( $read_more_button_border_radius ) || trim( $read_more_button_border_radius ) !== '' ) {
471
- $css .= "#{$layout} .read-more a{";
472
- $css .= "border-radius:" . $read_more_button_border_radius . "px;";
473
- $css .= "}";
474
- }
475
-
476
- $css .= "</style>";
477
-
478
- return $css;
479
- }
480
- }
481
  endif;
1
  <?php
2
 
3
+ if (!class_exists('rtTPGShortCode')):
4
+
5
+ class rtTPGShortCode
6
+ {
7
+
8
+ private $scA = array();
9
+
10
+ function __construct() {
11
+ add_shortcode('the-post-grid', array($this, 'the_post_grid_short_code'));
12
+ add_action('wp_ajax_tpgPreviewAjaxCall', array($this, 'the_post_grid_short_code'));
13
+ }
14
+
15
+ function register_sc_scripts() {
16
+ $iso = false;
17
+ foreach ($this->scA as $sc) {
18
+ if (isset($sc) && is_array($sc)) {
19
+ if ($sc['isIsotope']) {
20
+ $iso = true;
21
+ }
22
+ }
23
+ }
24
+ if (count($this->scA)) {
25
+ if ($iso) {
26
+ wp_enqueue_script('rt-isotope-js');
27
+ }
28
+ wp_enqueue_style('rt-fontawsome');
29
+ wp_enqueue_script('rt-actual-height-js');
30
+ wp_enqueue_script('rt-tpg');
31
+ $nonce = wp_create_nonce(rtTPG()->nonceText());
32
+ wp_localize_script('rt-tpg', 'rttpg',
33
+ array(
34
+ 'nonceID' => rtTPG()->nonceId(),
35
+ 'nonce' => $nonce,
36
+ 'ajaxurl' => admin_url('admin-ajax.php')
37
+ ));
38
+ }
39
+ }
40
+
41
+ function the_post_grid_short_code($atts = array(), $content = null) {
42
+ $error = true;
43
+ $html = $msg = null;
44
+ $preview = isset($_REQUEST['sc_id']) ? absint($_REQUEST['sc_id']) : 0;
45
+ $arg = array();
46
+ $atts = shortcode_atts(array(
47
+ 'id' => null
48
+ ), $atts, 'the-post-grid');
49
+ $scID = $atts['id'];
50
+ if ((!$preview && $scID && !is_null(get_post($scID))) || ($preview && rtTPG()->verifyNonce())) {
51
+ $rand = mt_rand();
52
+ $layoutID = "rt-tpg-container-" . $rand;
53
+ $pagination = false;
54
+
55
+ if ($preview) {
56
+ $error = false;
57
+ $scMeta = $_REQUEST;
58
+ $layout = isset($scMeta['layout']) ? $scMeta['layout'] : 'layout1';
59
+ $col = isset($scMeta['column']) ? intval($scMeta['column']) : 4;
60
+
61
+ $fImg = isset($scMeta['featured_image']) ? true : false;
62
+ $fImgSize = isset($scMeta['featured_image_size']) ? $scMeta['featured_image_size'] : "medium";
63
+ $mediaSource = isset($scMeta['media_source']) ? $scMeta['media_source'] : "feature_image";
64
+ $arg['excerpt_type'] = isset($scMeta['tgp_excerpt_type']) ? $scMeta['tgp_excerpt_type'] : 'character';
65
+ $arg['excerpt_limit'] = isset($scMeta['excerpt_limit']) ? absint($scMeta['excerpt_limit']) : 0;
66
+ $arg['excerpt_more_text'] = isset($scMeta['tgp_excerpt_more_text']) ? $scMeta['tgp_excerpt_more_text'] : null;
67
+ $arg['title_limit_type'] = isset($scMeta['tpg_title_limit_type']) ? $scMeta['tpg_title_limit_type'] : 'character';
68
+ $arg['title_limit'] = isset($scMeta['tpg_title_limit']) ? absint($scMeta['tpg_title_limit']) : 0;
69
+ $arg['read_more_text'] = isset($scMeta['tgp_read_more_text']) && !empty($scMeta['tgp_read_more_text']) ? $scMeta['tgp_read_more_text'] : __('Read More',
70
+ 'the-post-grid');
71
+ $arg['show_all_text'] = isset($scMeta['tpg_show_all_text']) && !empty($scMeta['tpg_show_all_text']) ? $scMeta['tpg_show_all_text'] : __('Show all',
72
+ 'the-post-grid-pro');
73
+ $postType = isset($scMeta['tpg_post_type']) ? $scMeta['tpg_post_type'] : null;
74
+ $post__in = isset($scMeta['post__in']) ? $scMeta['post__in'] : null;
75
+ $post__not_in = isset($scMeta['post__not_in']) ? $scMeta['post__not_in'] : null;
76
+ $limit = isset($scMeta['limit']) && !empty($scMeta['limit']) ? ($scMeta['limit'] == -1 ? 10000000 : (int)$scMeta['limit']) : 10000000;
77
+ $pagination = isset($scMeta['pagination']) ? $scMeta['pagination'] : false;
78
+ $posts_per_page = isset($scMeta['posts_per_page']) ? intval($scMeta['posts_per_page']) : $limit;
79
+ $order_by = isset($scMeta['order_by']) ? $scMeta['order_by'] : null;
80
+ $order = isset($scMeta['order']) ? $scMeta['order'] : null;
81
+ $s = isset($scMeta['s']) ? $scMeta['s'] : null;
82
+ $isotope_filter = isset($scMeta['isotope_filter']) ? $scMeta['isotope_filter'] : null;
83
+ $link = empty($scMeta['link_to_detail_page']) || (!empty($scMeta['link_to_detail_page']) && $scMeta['link_to_detail_page'] === "yes") ? true :false;
84
+ $link_target = !empty($scMeta['link_target']) ? $scMeta['link_target'] : null;
85
+ } else {
86
+ $scMeta = get_post_meta($scID);
87
+ $scMeta['sc_id'] = $scID;
88
+ $layout = isset($scMeta['layout'][0]) ? $scMeta['layout'][0] : 'layout1';
89
+ $col = isset($scMeta['column'][0]) ? intval($scMeta['column'][0]) : 4;
90
+
91
+ $fImg = isset($scMeta['featured_image'][0]) ? true : false;
92
+ $fImgSize = isset($scMeta['featured_image_size'][0]) ? $scMeta['featured_image_size'][0] : "medium";
93
+ $mediaSource = isset($scMeta['media_source'][0]) ? $scMeta['media_source'][0] : "feature_image";
94
+ $arg['excerpt_type'] = isset($scMeta['tgp_excerpt_type'][0]) ? $scMeta['tgp_excerpt_type'][0] : 'character';
95
+ $arg['excerpt_limit'] = isset($scMeta['excerpt_limit'][0]) ? absint($scMeta['excerpt_limit'][0]) : 0;
96
+ $arg['excerpt_more_text'] = isset($scMeta['tgp_excerpt_more_text'][0]) ? $scMeta['tgp_excerpt_more_text'][0] : null;
97
+ $arg['title_limit_type'] = isset($scMeta['tpg_title_limit_type'][0]) ? $scMeta['tpg_title_limit_type'][0] : 'character';
98
+ $arg['title_limit'] = isset($scMeta['tpg_title_limit'][0]) ? absint($scMeta['tpg_title_limit'][0]) : 0;
99
+ $arg['read_more_text'] = isset($scMeta['tgp_read_more_text'][0]) && !empty($scMeta['tgp_read_more_text'][0]) ? $scMeta['tgp_read_more_text'][0] : __('Read More',
100
+ 'the-post-grid');
101
+ $arg['show_all_text'] = (!empty($scMeta['tpg_show_all_text'][0]) ? $scMeta['tpg_show_all_text'][0] : __('Show all',
102
+ 'the-post-grid-pro'));
103
+
104
+ $postType = isset($scMeta['tpg_post_type'][0]) ? $scMeta['tpg_post_type'][0] : null;
105
+ $post__in = isset($scMeta['post__in'][0]) ? $scMeta['post__in'][0] : null;
106
+ $post__not_in = isset($scMeta['post__not_in'][0]) ? $scMeta['post__not_in'][0] : null;
107
+ $limit = isset($scMeta['limit'][0]) && !empty($scMeta['limit'][0]) ? ($scMeta['limit'][0] == -1 ? 10000000 : (int)$scMeta['limit'][0]) : 10000000;
108
+ $pagination = isset($scMeta['pagination'][0]) ? $scMeta['pagination'][0] : false;
109
+ $posts_per_page = isset($scMeta['posts_per_page'][0]) ? intval($scMeta['posts_per_page'][0]) : $limit;
110
+ $order_by = isset($scMeta['order_by'][0]) ? $scMeta['order_by'][0] : null;
111
+ $order = isset($scMeta['order'][0]) ? $scMeta['order'][0] : null;
112
+ $s = isset($scMeta['s'][0]) ? $scMeta['s'][0] : null;
113
+ $isotope_filter = isset($scMeta['isotope_filter'][0]) ? $scMeta['isotope_filter'][0] : null;
114
+ $link = empty($scMeta['link_to_detail_page'][0]) || (!empty($scMeta['link_to_detail_page'][0]) && $scMeta['link_to_detail_page'][0] === "yes") ? true :false;
115
+ $link_target = !empty($scMeta['link_target'][0]) ? $scMeta['link_target'][0] : null;
116
+
117
+ }
118
+ if (!in_array($layout, array_keys(rtTPG()->rtTPGLayouts()))) {
119
+ $layout = 'layout1';
120
+ }
121
+ if (!in_array($col, array_keys(rtTPG()->rtTPGColumns()))) {
122
+ $col = 4;
123
+ }
124
+
125
+ $isIsotope = preg_match('/isotope/', $layout);
126
+
127
+ /* Argument create */
128
+ $args = array();
129
+ $itemIdsArgs = array();
130
+ if ($postType) {
131
+ $args['post_type'] = $itemIdsArgs['post_type'] = $postType;
132
+ }
133
+
134
+ // Common filter
135
+ /* post__in */
136
+ if ($post__in) {
137
+ $post__in = explode(',', $post__in);
138
+ $args['post__in'] = $itemIdsArgs['post__in'] = $post__in;
139
+ }
140
+ /* post__not_in */
141
+ if ($post__not_in) {
142
+ $post__not_in = explode(',', $post__not_in);
143
+ $args['post__not_in'] = $itemIdsArgs['post__not_in'] = $post__not_in;
144
+ }
145
+
146
+ /* LIMIT */
147
+ $args['posts_per_page'] = $itemIdsArgs['posts_per_page'] = $limit;
148
+ if (!$isIsotope && $pagination) {
149
+ if ($posts_per_page > $limit) {
150
+ $posts_per_page = $limit;
151
+ }
152
+ // Set 'posts_per_page' parameter
153
+ $args['posts_per_page'] = $posts_per_page;
154
+ if (get_query_var('paged')) {
155
+ $paged = get_query_var('paged');
156
+ } elseif (get_query_var('page')) {
157
+ $paged = get_query_var('page');
158
+ } else {
159
+ $paged = 1;
160
+ }
161
+ $offset = $posts_per_page * ((int)$paged - 1);
162
+ $args['paged'] = $paged;
163
+
164
+ // Update posts_per_page
165
+ if (intval($args['posts_per_page']) > $limit - $offset) {
166
+ $args['posts_per_page'] = $limit - $offset;
167
+ }
168
+
169
+
170
+ }
171
+
172
+ // Advance Filter
173
+ $adv_filter = isset($scMeta['post_filter']) ? $scMeta['post_filter'] : array();
174
+
175
+ // Taxonomy
176
+ $taxQ = array();
177
+ if (in_array('tpg_taxonomy', $adv_filter) && isset($scMeta['tpg_taxonomy'])) {
178
+
179
+ if (is_array($scMeta['tpg_taxonomy']) && !empty($scMeta['tpg_taxonomy'])) {
180
+ foreach ($scMeta['tpg_taxonomy'] as $taxonomy) {
181
+ $terms = (isset($scMeta['term_' . $taxonomy]) ? $scMeta['term_' . $taxonomy] : array());
182
+ if (is_array($terms) && !empty($terms)) {
183
+ $operator = isset($scMeta['term_operator_' . $taxonomy][0]) ? $scMeta['term_operator_' . $taxonomy][0] : "IN";
184
+ if ($preview) {
185
+ $operator = isset($scMeta['term_operator_' . $taxonomy]) ? $scMeta['term_operator_' . $taxonomy] : "IN";
186
+ }
187
+ $taxQ[] = array(
188
+ 'taxonomy' => $taxonomy,
189
+ 'field' => 'term_id',
190
+ 'terms' => $terms,
191
+ 'operator' => $operator,
192
+ );
193
+ }
194
+ }
195
+ }
196
+ if (count($taxQ) >= 2) {
197
+ $relation = isset($scMeta['taxonomy_relation'][0]) ? $scMeta['taxonomy_relation'][0] : "AND";
198
+ if ($preview) {
199
+ $relation = isset($scMeta['taxonomy_relation']) ? $scMeta['taxonomy_relation'] : "AND";
200
+ }
201
+ $taxQ['relation'] = $relation;
202
+ }
203
+ }
204
+
205
+ if (!empty($taxQ)) {
206
+ $args['tax_query'] = $itemIdsArgs['tax_query'] = $taxQ;
207
+ }
208
+
209
+ // Order
210
+ if (in_array('order', $adv_filter)) {
211
+ if ($order) {
212
+ $args['order'] = $itemIdsArgs['order'] = $order;
213
+ }
214
+ if ($order_by) {
215
+ $args['orderby'] = $itemIdsArgs['orderby'] = $order_by;
216
+ }
217
+ }
218
+ // Status
219
+ if (in_array('tpg_post_status', $adv_filter)) {
220
+ $post_status = (isset($scMeta['tpg_post_status']) ? $scMeta['tpg_post_status'] : array());
221
+ if (!empty($post_status)) {
222
+ $args['post_status'] = $itemIdsArgs['post_status'] = $post_status;
223
+ } else {
224
+ $args['post_status'] = $itemIdsArgs['post_status'] = 'publish';
225
+ }
226
+ }
227
+ // Author
228
+ $author = (isset($scMeta['author']) ? $scMeta['author'] : array());
229
+ if (in_array('author', $adv_filter) && !empty($author)) {
230
+ $args['author__in'] = $itemIdsArgs['author__in'] = $author;
231
+ }
232
+ // Search
233
+ if (in_array('s', $adv_filter) && $s) {
234
+ $args['s'] = $itemIdsArgs['s'] = $s;
235
+ }
236
+
237
+ // Validation
238
+
239
+ if (($layout == 'layout2') || ($layout == 'layout3')) {
240
+ $iCol = isset($scMeta['tgp_layout2_image_column'][0]) ? absint($scMeta['tgp_layout2_image_column'][0]) : 4;
241
+ if ($preview) {
242
+ $iCol = isset($scMeta['tgp_layout2_image_column']) ? absint($scMeta['tgp_layout2_image_column']) : 4;
243
+ }
244
+ $iCol = $iCol > 12 ? 4 : $iCol;
245
+ $cCol = 12 - $iCol;
246
+ $arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
247
+ $arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
248
+ }
249
+ $col = $col == 5 ? "24" : round(12 / $col);
250
+ if (($layout == 'layout2') || ($layout == 'layout3')) {
251
+ $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-12 rt-col-xs-12";
252
+ } else {
253
+ $arg['grid'] = "rt-col-lg-{$col} rt-col-md-{$col} rt-col-sm-6 rt-col-xs-12";
254
+ }
255
+
256
+
257
+ $arg['class'] = 'rt-equal-height';
258
+ if ($isIsotope) {
259
+ $arg['class'] .= ' isotope-item';
260
+ }
261
+ $arg['link'] = $link;
262
+ $arg['link_target'] = $link_target ? " target='{$link_target}'" : null;
263
+
264
+ $arg['overlay'] = empty($scMeta['tpg_overlay'][0]) ? false : true;
265
+ $parentClass = (!empty($scMeta['parent_class'][0]) ? trim($scMeta['parent_class'][0]) : null);
266
+ $arg['items'] = isset($scMeta['item_fields']) ? ($scMeta['item_fields'] ? $scMeta['item_fields'] : array()) : array();
267
+ $arg['title_tag'] = (!empty($scMeta['title_tag'][0]) && in_array($scMeta['title_tag'][0], array_keys(rtTPG()->getTitleTags()))) ? esc_attr($scMeta['title_tag'][0]) : 'h2';
268
+ $postQuery = new WP_Query(apply_filters('tpg_sc_query_args', $args, $scMeta));
269
+ // Start layout
270
+ $html .= "<div class='container-fluid rt-tpg-container rt-tpg-container-{$scMeta['sc_id']} {$parentClass}' data-sc-id='{$scMeta['sc_id']}' id='{$layoutID}'>";
271
+ $extClass = null;
272
+ if ($isIsotope) {
273
+ $extClass = ' tpg-isotope';
274
+ }
275
+ // Set readmore false if excerpt type = full content
276
+ if (isset($arg['excerpt_type']) && $arg['excerpt_type'] === 'full' && ($key = array_search('read_more', $arg['items'])) !== false) {
277
+ unset($arg['items'][$key]);
278
+ }
279
+
280
+ $html .= "<div class='rt-row rt-content-loader {$layout}{$extClass}'>";
281
+ if ($postQuery->have_posts()) {
282
+ $html .= $this->layoutStyle($layoutID, $scMeta, $preview);
283
+
284
+ if ($isIsotope) {
285
+ $selectedTerms = (isset($scMeta['term_' . $isotope_filter]) ? $scMeta['term_' . $isotope_filter] : array());
286
+ $terms = get_terms($isotope_filter, array(
287
+ 'orderby' => 'name',
288
+ 'order' => 'ASC',
289
+ 'hide_empty' => false,
290
+ 'include' => $selectedTerms
291
+ ));
292
+
293
+ $html .= '<div id="iso-button-' . $rand . '" class="iso-button-' . $scMeta['sc_id'] . ' rt-tpg-isotope-buttons filter-button-group option-set">
294
  <button data-filter="*" class="selected">' . $arg['show_all_text'] . '</button>';
295
+ if (!empty($terms) && !is_wp_error($terms)) {
296
+ foreach ($terms as $term) {
297
+ $html .= "<button data-filter='.iso_{$term->term_id}'>" . $term->name . "</button>";
298
+ }
299
+ }
300
+ $html .= '</div>';
301
+
302
+ $html .= '<div class="rt-tpg-isotope iso-tpg-' . $scMeta['sc_id'] . '" id="iso-tpg-' . $rand . '">';
303
+ }
304
+
305
+
306
+ while ($postQuery->have_posts()) {
307
+ $postQuery->the_post();
308
+ $pID = get_the_ID();
309
+ $arg['pID'] = $pID;
310
+ $arg['title'] = rtTPG()->get_the_title($pID, $arg);
311
+ $arg['pLink'] = get_permalink();
312
+ $arg['author'] = '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author() . '</a>';
313
+ $cc = wp_count_comments($pID);
314
+ $arg['date'] = get_the_date();
315
+ $arg['excerpt'] = rtTPG()->get_the_excerpt($pID, $arg);
316
+ $arg['categories'] = get_the_term_list($pID, 'category', null, ', ');
317
+ $arg['tags'] = get_the_term_list($pID, 'post_tag', null, ', ');
318
+ if ($isIsotope) {
319
+ $termAs = wp_get_post_terms($pID, $isotope_filter, array("fields" => "all"));
320
+ $isoFilter = null;
321
+ if (!empty($termAs)) {
322
+ foreach ($termAs as $term) {
323
+ $isoFilter .= " iso_" . $term->term_id;
324
+ }
325
+ }
326
+ $arg['isoFilter'] = $isoFilter;
327
+ }
328
+ $deptClass = null;
329
+ if (!empty($deptAs)) {
330
+ foreach ($deptAs as $dept) {
331
+ $deptClass .= " " . $dept->slug;
332
+ }
333
+ }
334
+ if (comments_open()) {
335
+ $arg['comment'] = "<a href='" . get_comments_link($pID) . "'>{$cc->total_comments} </a>";
336
+ } else {
337
+ $arg['comment'] = "{$cc->total_comments}";
338
+ }
339
+ $imgSrc = null;
340
+
341
+ $arg['imgSrc'] = !$fImg ? rtTPG()->getFeatureImageSrc($pID, $fImgSize, $mediaSource) : null;
342
+
343
+ $html .= rtTPG()->render('layouts/' . $layout, $arg, true);
344
+ }
345
+
346
+ if ($isIsotope) {
347
+ $html .= '</div>'; // End isotope item holder
348
+ }
349
+
350
+ } else {
351
+ $html .= sprintf('<p>%s</p>',
352
+ apply_filters('tpg_not_found_text', __('No post found', 'the-post-grid'), $args, $scMeta)
353
+ );
354
+ }
355
+ $html .= "</div>"; // End row
356
+ if ($pagination && !$isIsotope) {
357
+ $found = 0;
358
+ if ($postQuery->found_posts > $limit) {
359
+ $found = $limit;
360
+ } else {
361
+ $found = $postQuery->found_posts;
362
+ }
363
+ $max_num_pages = ceil($found / $posts_per_page);
364
+ $html .= rtTPG()->rt_pagination($max_num_pages, $args['posts_per_page']);
365
+ }
366
+ $html .= "</div>"; // container rt-tpg
367
+
368
+ wp_reset_postdata();
369
+ if (!$preview) {
370
+ $scriptGenerator = array();
371
+ $scriptGenerator['layout'] = $layoutID;
372
+ $scriptGenerator['rand'] = $rand;
373
+ $scriptGenerator['scMeta'] = $scMeta;
374
+ $scriptGenerator['isIsotope'] = $isIsotope;
375
+ $this->scA[] = $scriptGenerator;
376
+ add_action('wp_footer', array($this, 'register_sc_scripts'));
377
+ }
378
+ } else {
379
+ if ($preview) {
380
+ $msg = __('Session Error !!', 'the-post-grid');
381
+ } else {
382
+ $html .= "<p>" . __("No shortCode found", 'the-post-grid') . "</p>";
383
+ }
384
+ }
385
+ if ($preview) {
386
+ wp_send_json(array(
387
+ 'error' => $error,
388
+ 'msg' => $msg,
389
+ 'data' => $html
390
+ ));
391
+ die();
392
+ }
393
+
394
+ return $html;
395
+ }
396
+
397
+ function layoutStyle($layout, $scMeta, $preview = false) {
398
+ if ($preview) {
399
+ $primaryColor = (!empty($scMeta['primary_color']) ? $scMeta['primary_color'] : null);
400
+ $button_bg_color = (!empty($scMeta['button_bg_color']) ? $scMeta['button_bg_color'] : null);
401
+ $button_hover_bg_color = (!empty($scMeta['button_hover_bg_color']) ? $scMeta['button_hover_bg_color'] : null);
402
+ $button_active_bg_color = (!empty($scMeta['button_active_bg_color']) ? $scMeta['button_active_bg_color'] : null);
403
+ $button_text_color = (!empty($scMeta['button_text_color']) ? $scMeta['button_text_color'] : null);
404
+ $title_color = isset($scMeta['title_color']) && !empty($scMeta['title_color']) ? $scMeta['title_color'] : null;
405
+ $title_hover_color = isset($scMeta['title_hover_color']) && !empty($scMeta['title_hover_color']) ? $scMeta['title_hover_color'] : null;
406
+ $read_more_button_border_radius = isset($scMeta['tpg_read_more_button_border_radius']) ? $scMeta['tpg_read_more_button_border_radius'] : '';
407
+
408
+ } else {
409
+
410
+ $primaryColor = (!empty($scMeta['primary_color'][0]) ? $scMeta['primary_color'][0] : null);
411
+ $button_bg_color = (!empty($scMeta['button_bg_color'][0]) ? $scMeta['button_bg_color'][0] : null);
412
+ $button_hover_bg_color = (!empty($scMeta['button_hover_bg_color'][0]) ? $scMeta['button_hover_bg_color'][0] : null);
413
+ $button_active_bg_color = (!empty($scMeta['button_active_bg_color'][0]) ? $scMeta['button_active_bg_color'][0] : null);
414
+ $button_text_color = (!empty($scMeta['button_text_color'][0]) ? $scMeta['button_text_color'][0] : null);
415
+ $title_color = isset($scMeta['title_color'][0]) && !empty($scMeta['title_color'][0]) ? $scMeta['title_color'][0] : null;
416
+ $title_hover_color = isset($scMeta['title_hover_color'][0]) && !empty($scMeta['title_hover_color'][0]) ? $scMeta['title_hover_color'][0] : null;
417
+ $read_more_button_border_radius = isset($scMeta['tpg_read_more_button_border_radius'][0]) ? $scMeta['tpg_read_more_button_border_radius'][0] : '';
418
+
419
+ }
420
+ $css = null;
421
+ $css .= "<style type='text/css' media='all'>";
422
+ // Variable
423
+ if ($primaryColor) {
424
+ $css .= "#{$layout} .rt-detail i,
425
  #{$layout} .rt-detail .post-meta-user a,
426
  #{$layout} .rt-detail .post-meta-category a{";
427
+ $css .= "color:" . $primaryColor . ";";
428
+ $css .= "}";
429
+ $css .= "body .rt-tpg-container .rt-tpg-isotope-buttons .selected{";
430
+ $css .= "background-color:" . $primaryColor . ";";
431
+ $css .= "}";
432
+ }
433
+ if ($button_bg_color) {
434
+ $css .= "#{$layout} .pagination li a,
435
  #{$layout} .rt-tpg-isotope-buttons button,
436
  #{$layout} .rt-detail .read-more a{";
437
+ $css .= "background-color:" . $button_bg_color . ";";
438
+ $css .= "}";
439
+ }
440
+ if ($button_hover_bg_color) {
441
+ $css .= "#{$layout} .pagination li a:hover,
442
  #{$layout} .rt-tpg-isotope-buttons button:hover,
443
  #{$layout} .rt-detail .read-more a:hover{";
444
+ $css .= "background-color:" . $button_hover_bg_color . ";";
445
+ $css .= "}";
446
+ }
447
+ if ($button_active_bg_color) {
448
+ $css .= "#{$layout} .pagination li.active span,
449
  #{$layout} .rt-tpg-isotope-buttons button.selected{";
450
+ $css .= "background-color:" . $button_active_bg_color . ";";
451
+ $css .= "}";
452
+ }
453
+ if ($button_text_color) {
454
+ $css .= "#{$layout} .pagination li a,
455
  #{$layout} .rt-tpg-isotope-buttons button,
456
  #{$layout} .rt-detail .read-more a{";
457
+ $css .= "color:" . $button_text_color . ";";
458
+ $css .= "}";
459
+ }
460
+ if ($title_color) {
461
+ $css .= "#{$layout} .rt-detail h2.entry-title a,
462
  #{$layout} .rt-detail h3.entry-title a,
463
  #{$layout} .rt-detail h4.entry-title a{";
464
+ $css .= "color:" . $title_color . ";";
465
+ $css .= "}";
466
+ }
467
+ if ($title_hover_color) {
468
+ $css .= "#{$layout} .rt-detail h2.entry-title a:hover,
469
  #{$layout} .rt-detail h3.entry-title a:hover,
470
  #{$layout} .rt-detail h4.entry-title a:hover{";
471
+ $css .= "color:" . $title_hover_color . ";";
472
+ $css .= "}";
473
+ }
474
+
475
+ // Read more button Position
476
+ if (!empty($read_more_button_border_radius)) {
477
+ $css .= "#{$layout} .read-more a{";
478
+ $css .= "border-radius:" . $read_more_button_border_radius . "px;";
479
+ $css .= "}";
480
+ }
481
+
482
+ $css .= "</style>";
483
+
484
+ return $css;
485
+ }
486
+ }
487
  endif;
lib/models/rtTPGField.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- if(!class_exists('rtTPGField')):
4
  class rtTPGField
5
  {
6
  private $type;
@@ -19,21 +19,20 @@ if(!class_exists('rtTPGField')):
19
  private $alignment;
20
  private $placeholder;
21
 
22
- function __construct(){
23
  }
24
 
25
- private function setArgument($attr){
26
  $this->type = isset($attr['type']) ? ($attr['type'] ? $attr['type'] : 'text') : 'text';
27
  $this->multiple = isset($attr['multiple']) ? ($attr['multiple'] ? $attr['multiple'] : false) : false;
28
  $this->name = isset($attr['name']) ? ($attr['name'] ? $attr['name'] : null) : null;
29
- $this->name = isset($attr['name']) ? ($attr['name'] ? $attr['name'] : null) : null;
30
  $this->default = isset($attr['default']) ? ($attr['default'] ? $attr['default'] : null) : null;
31
  $this->value = isset($attr['value']) ? ($attr['value'] ? $attr['value'] : null) : null;
32
 
33
- if(!$this->value){
34
- if($this->multiple){
35
  $v = get_post_meta(get_the_ID(), $this->name);
36
- }else{
37
  $v = get_post_meta(get_the_ID(), $this->name, true);
38
  }
39
  $this->value = ($v ? $v : $this->default);
@@ -49,64 +48,61 @@ if(!class_exists('rtTPGField')):
49
  $this->option = isset($attr['option']) ? ($attr['option'] ? $attr['option'] : null) : null;
50
  $this->attr = isset($attr['attr']) ? ($attr['attr'] ? $attr['attr'] : null) : null;
51
  $this->alignment = isset($attr['alignment']) ? ($attr['alignment'] ? $attr['alignment'] : null) : null;
52
-
53
  }
54
 
55
- public function Field($attr)
56
- {
57
  $this->setArgument($attr);
 
58
  $html = null;
59
- $html .= "<div class='field-holder {$this->holderClass}'>";
60
- $html .= "<div class='field-label'>";
61
- if($this->label){
62
- $html .="<label>{$this->label}</label>";
63
- }
64
- $html .= "</div>";
65
- $html .= "<div class='field'>";
66
- switch($this->type){
67
- case 'text':
68
- $html .= $this->text();
69
- break;
70
-
71
- case 'url':
72
- $html .= $this->url();
73
- break;
74
-
75
- case 'number':
76
- $html .= $this->number();
77
- break;
78
-
79
- case 'select':
80
- $html .= $this->select();
81
- break;
82
-
83
- case 'textarea':
84
- $html .= $this->textArea();
85
- break;
86
-
87
- case 'checkbox':
88
- $html .= $this->checkbox();
89
- break;
90
-
91
- case 'radio':
92
- $html .= $this->radioField();
93
- break;
94
-
95
- case 'custom_css':
96
- $html .= $this->customCss();
97
- break;
98
- }
99
- if($this->description) {
100
- $html .= "<p class='description'>{$this->description}</p>";
101
- }
102
- $html .="</div>"; // field
103
- $html .="</div>"; // field holder
104
 
105
  return $html;
106
  }
107
 
108
- private function text()
109
- {
110
  $h = null;
111
  $h .= "<input
112
  type='text'
@@ -120,15 +116,15 @@ if(!class_exists('rtTPGField')):
120
  return $h;
121
  }
122
 
123
- private function customCss(){
124
  $h = null;
125
  $h .= '<div class="rt-custom-css">';
126
- $h .= '<div class="custom_css_container">';
127
- $h .= "<div name='{$this->name}' id='ret-".mt_rand()."' class='custom-css'>";
128
- $h .= '</div>';
129
- $h .= '</div>';
130
 
131
- $h .= "<textarea
132
  style='display: none;'
133
  class='custom_css_textarea'
134
  id='{$this->id}'
@@ -139,8 +135,7 @@ if(!class_exists('rtTPGField')):
139
  return $h;
140
  }
141
 
142
- private function url()
143
- {
144
  $h = null;
145
  $h .= "<input
146
  type='url'
@@ -154,8 +149,7 @@ if(!class_exists('rtTPGField')):
154
  return $h;
155
  }
156
 
157
- private function number()
158
- {
159
  $h = null;
160
  $h .= "<input
161
  type='number'
@@ -169,31 +163,29 @@ if(!class_exists('rtTPGField')):
169
  return $h;
170
  }
171
 
172
- private function select()
173
- {
174
  $h = null;
175
- if($this->multiple){
176
  $this->attr = " style='min-width:160px;'";
177
- $this->name = $this->name."[]";
178
- $this->attr = $this->attr." multiple='multiple'";
179
  $this->value = (is_array($this->value) && !empty($this->value) ? $this->value : array());
180
- }else{
181
  $this->value = array($this->value);
182
  }
183
 
184
  $h .= "<select name='{$this->name}' id='{$this->id}' class='{$this->class}' {$this->attr}>";
185
- if(is_array($this->options) && !empty($this->options)){
186
- foreach($this->options as $key => $value){
187
- $slt = (in_array($key, $this->value) ? "selected" : null);
188
- $h .= "<option {$slt} value='{$key}'>{$value}</option>";
189
- }
190
  }
 
191
  $h .= "</select>";
192
  return $h;
193
  }
194
 
195
- private function textArea()
196
- {
197
  $h = null;
198
  $h .= "<textarea
199
  class='{$this->class} rt-textarea'
@@ -205,14 +197,13 @@ if(!class_exists('rtTPGField')):
205
  return $h;
206
  }
207
 
208
- private function checkbox()
209
- {
210
  $h = null;
211
- if($this->multiple){
212
- $this->name = $this->name."[]";
213
  $this->value = (is_array($this->value) && !empty($this->value) ? $this->value : array());
214
  }
215
- if($this->multiple) {
216
  $h .= "<div class='checkbox-group {$this->alignment}' id='{$this->id}'>";
217
  if (is_array($this->options) && !empty($this->options)) {
218
  foreach ($this->options as $key => $value) {
@@ -223,15 +214,14 @@ if(!class_exists('rtTPGField')):
223
  }
224
  }
225
  $h .= "</div>";
226
- }else{
227
  $checked = ($this->value ? "checked" : null);
228
  $h .= "<label><input type='checkbox' {$checked} id='{$this->id}' name='{$this->name}' value='1' />{$this->option}</label>";
229
  }
230
  return $h;
231
  }
232
 
233
- private function radioField()
234
- {
235
  $h = null;
236
  $h .= "<div class='radio-group {$this->alignment}' id='{$this->id}'>";
237
  if (is_array($this->options) && !empty($this->options)) {
1
  <?php
2
 
3
+ if (!class_exists('rtTPGField')):
4
  class rtTPGField
5
  {
6
  private $type;
19
  private $alignment;
20
  private $placeholder;
21
 
22
+ function __construct() {
23
  }
24
 
25
+ private function setArgument($attr) {
26
  $this->type = isset($attr['type']) ? ($attr['type'] ? $attr['type'] : 'text') : 'text';
27
  $this->multiple = isset($attr['multiple']) ? ($attr['multiple'] ? $attr['multiple'] : false) : false;
28
  $this->name = isset($attr['name']) ? ($attr['name'] ? $attr['name'] : null) : null;
 
29
  $this->default = isset($attr['default']) ? ($attr['default'] ? $attr['default'] : null) : null;
30
  $this->value = isset($attr['value']) ? ($attr['value'] ? $attr['value'] : null) : null;
31
 
32
+ if (!$this->value) {
33
+ if ($this->multiple) {
34
  $v = get_post_meta(get_the_ID(), $this->name);
35
+ } else {
36
  $v = get_post_meta(get_the_ID(), $this->name, true);
37
  }
38
  $this->value = ($v ? $v : $this->default);
48
  $this->option = isset($attr['option']) ? ($attr['option'] ? $attr['option'] : null) : null;
49
  $this->attr = isset($attr['attr']) ? ($attr['attr'] ? $attr['attr'] : null) : null;
50
  $this->alignment = isset($attr['alignment']) ? ($attr['alignment'] ? $attr['alignment'] : null) : null;
51
+ $this->class = $this->class ? $this->class . " rt-form-control" : "rt-form-control";
52
  }
53
 
54
+ public function Field($attr) {
 
55
  $this->setArgument($attr);
56
+ $holderId = $this->name . "_holder";
57
  $html = null;
58
+ $html .= "<div class='rt-field-wrapper {$this->holderClass}' id='{$holderId}'>";
59
+ $html .= sprintf('<div class="rt-label">%s</div>',
60
+ $this->label ? sprintf('<label for="">%s</label>', $this->label) : ''
61
+ );
62
+ $html .= "<div class='rt-field'>";
63
+ switch ($this->type) {
64
+ case 'text':
65
+ $html .= $this->text();
66
+ break;
67
+
68
+ case 'url':
69
+ $html .= $this->url();
70
+ break;
71
+
72
+ case 'number':
73
+ $html .= $this->number();
74
+ break;
75
+
76
+ case 'select':
77
+ $html .= $this->select();
78
+ break;
79
+
80
+ case 'textarea':
81
+ $html .= $this->textArea();
82
+ break;
83
+
84
+ case 'checkbox':
85
+ $html .= $this->checkbox();
86
+ break;
87
+
88
+ case 'radio':
89
+ $html .= $this->radioField();
90
+ break;
91
+
92
+ case 'custom_css':
93
+ $html .= $this->customCss();
94
+ break;
95
+ }
96
+ if ($this->description) {
97
+ $html .= "<p class='description'>{$this->description}</p>";
98
+ }
99
+ $html .= "</div>"; // field
100
+ $html .= "</div>"; // field holder
 
 
101
 
102
  return $html;
103
  }
104
 
105
+ private function text() {
 
106
  $h = null;
107
  $h .= "<input
108
  type='text'
116
  return $h;
117
  }
118
 
119
+ private function customCss() {
120
  $h = null;
121
  $h .= '<div class="rt-custom-css">';
122
+ $h .= '<div class="custom_css_container">';
123
+ $h .= "<div name='{$this->name}' id='ret-" . mt_rand() . "' class='custom-css'>";
124
+ $h .= '</div>';
125
+ $h .= '</div>';
126
 
127
+ $h .= "<textarea
128
  style='display: none;'
129
  class='custom_css_textarea'
130
  id='{$this->id}'
135
  return $h;
136
  }
137
 
138
+ private function url() {
 
139
  $h = null;
140
  $h .= "<input
141
  type='url'
149
  return $h;
150
  }
151
 
152
+ private function number() {
 
153
  $h = null;
154
  $h .= "<input
155
  type='number'
163
  return $h;
164
  }
165
 
166
+ private function select() {
 
167
  $h = null;
168
+ if ($this->multiple) {
169
  $this->attr = " style='min-width:160px;'";
170
+ $this->name = $this->name . "[]";
171
+ $this->attr = $this->attr . " multiple='multiple'";
172
  $this->value = (is_array($this->value) && !empty($this->value) ? $this->value : array());
173
+ } else {
174
  $this->value = array($this->value);
175
  }
176
 
177
  $h .= "<select name='{$this->name}' id='{$this->id}' class='{$this->class}' {$this->attr}>";
178
+ if (is_array($this->options) && !empty($this->options)) {
179
+ foreach ($this->options as $key => $value) {
180
+ $slt = (in_array($key, $this->value) ? "selected" : null);
181
+ $h .= "<option {$slt} value='{$key}'>{$value}</option>";
 
182
  }
183
+ }
184
  $h .= "</select>";
185
  return $h;
186
  }
187
 
188
+ private function textArea() {
 
189
  $h = null;
190
  $h .= "<textarea
191
  class='{$this->class} rt-textarea'
197
  return $h;
198
  }
199
 
200
+ private function checkbox() {
 
201
  $h = null;
202
+ if ($this->multiple) {
203
+ $this->name = $this->name . "[]";
204
  $this->value = (is_array($this->value) && !empty($this->value) ? $this->value : array());
205
  }
206
+ if ($this->multiple) {
207
  $h .= "<div class='checkbox-group {$this->alignment}' id='{$this->id}'>";
208
  if (is_array($this->options) && !empty($this->options)) {
209
  foreach ($this->options as $key => $value) {
214
  }
215
  }
216
  $h .= "</div>";
217
+ } else {
218
  $checked = ($this->value ? "checked" : null);
219
  $h .= "<label><input type='checkbox' {$checked} id='{$this->id}' name='{$this->name}' value='1' />{$this->option}</label>";
220
  }
221
  return $h;
222
  }
223
 
224
+ private function radioField() {
 
225
  $h = null;
226
  $h .= "<div class='radio-group {$this->alignment}' id='{$this->id}'>";
227
  if (is_array($this->options) && !empty($this->options)) {
lib/views/layouts/isotope1.php CHANGED
@@ -1,24 +1,46 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  $html = null;
4
 
5
  $html .= "<div class='{$grid} {$class} {$isoFilter}'>";
6
  $html .= '<div class="rt-holder">';
7
  if(!empty($imgSrc)) {
8
  $html .= '<div class="rt-img-holder">';
9
- if($overlay) {
10
- $html .= '<div class="overlay">';
11
- $html .= "<a class='view-details' href='{$pLink}'>
12
- <i class='fa fa-info'></i>
13
- </a>";
14
- $html .= '</div>';
15
- }
16
- $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
 
 
 
 
17
  $html .= '</div> ';
18
  }
19
  $html .= '<div class="rt-detail">';
20
  if(in_array('title', $items)){
21
- $html .= sprintf('<%1$s class="entry-title"><a href="%2$s">%3$s</a></%1$s>', $title_tag, $pLink, $title);
 
 
 
 
22
  }
23
  $postMetaTop = $postMetaMid = null;
24
 
@@ -48,8 +70,8 @@ $html .= "<div class='{$grid} {$class} {$isoFilter}'>";
48
  if(in_array('excerpt', $items) && $excerpt){
49
  $html .= "<div class='entry-content'><p>{$excerpt}</p></div>";
50
  }
51
- if(in_array('read_more', $items)){
52
- $html .= "<div class='read-more'><a href='{$pLink}'>{$read_more_text}</a></div>";
53
  }
54
  $html .= '</div>';
55
  $html .= '</div>';
1
  <?php
2
+ /**
3
+ * @var string $grid
4
+ * @var string $pLink
5
+ * @var string $class
6
+ * @var bool $link
7
+ * @var string $link_target
8
+ * @var string $title_tag
9
+ * @var string $categories
10
+ * @var string $read_more_text
11
+ * @var string $date
12
+ * @var string $author
13
+ * @var string $isoFilter
14
+ * @var bool $overlay
15
+ * @var array $items
16
+ */
17
  $html = null;
18
 
19
  $html .= "<div class='{$grid} {$class} {$isoFilter}'>";
20
  $html .= '<div class="rt-holder">';
21
  if(!empty($imgSrc)) {
22
  $html .= '<div class="rt-img-holder">';
23
+ if($overlay && $link) {
24
+ $html .= sprintf('<div class="overlay">
25
+ <div class="link-holder">
26
+ <a class="view-details" href="%s"%s><i class="fa fa-info"></i></a>
27
+ </div>
28
+ </div>', $pLink, $link_target);
29
+ }
30
+ if($link) {
31
+ $html .= sprintf('<a href="%s"%s><img class="img-responsive" src="%s" alt="%s"></a>', $pLink,$link_target, $imgSrc, $title);
32
+ }else{
33
+ $html .= "<img class='img-responsive' src='{$imgSrc}' alt='{$title}'>";
34
+ }
35
  $html .= '</div> ';
36
  }
37
  $html .= '<div class="rt-detail">';
38
  if(in_array('title', $items)){
39
+ if($link) {
40
+ $html .= sprintf('<%1$s class="entry-title"><a href="%2$s"%4$s>%3$s</a></%1$s>', $title_tag, $pLink, $title,$link_target);
41
+ }else{
42
+ $html .= sprintf('<%1$s class="entry-title">%2$s</%1$s>', $title_tag, $title);
43
+ }
44
  }
45
  $postMetaTop = $postMetaMid = null;
46
 
70
  if(in_array('excerpt', $items) && $excerpt){
71
  $html .= "<div class='entry-content'><p>{$excerpt}</p></div>";
72
  }
73
+ if(in_array('read_more', $items) && $link){
74
+ $html .= sprintf('<div class="read-more"><a href="%s"%s>%s</a></div>', $pLink, $link_target, $read_more_text);
75
  }
76
  $html .= '</div>';
77
  $html .= '</div>';
lib/views/layouts/layout1.php CHANGED
@@ -1,19 +1,40 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  $html = null;
4
  $html .= "<div class='{$grid} {$class}'>";
5
  $html .= '<div class="rt-holder">';
6
  if(!empty($imgSrc)) {
7
  $html .= '<div class="rt-img-holder">';
8
- if($overlay) {
9
- $html .= sprintf('<div class="overlay"><a class="view-details" href="%s"><i class="fa fa-info"></i></a></div>', $pLink);
10
  }
11
- $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
 
 
 
 
12
  $html .= '</div> ';
13
  }
14
  $html .= '<div class="rt-detail">';
15
  if(in_array('title', $items)){
16
- $html .= sprintf('<%1$s class="entry-title"><a href="%2$s">%3$s</a></%1$s>', $title_tag, $pLink, $title);
 
 
 
 
17
  }
18
  $postMetaTop = $postMetaMid =null;
19
 
@@ -44,10 +65,8 @@ $html .= "<div class='{$grid} {$class}'>";
44
  $html .= "<div class='post-content'>{$excerpt}</div>";
45
  }
46
  $postMetaBottom = null;
47
-
48
-
49
- if(in_array('read_more', $items)){
50
- $postMetaBottom .= "<span class='read-more'><a href='{$pLink}'>{$read_more_text}</a></span>";
51
  }
52
  if(!empty($postMetaBottom)){
53
  $html .= "<div class='post-meta'>$postMetaBottom</div>";
1
  <?php
2
+ /**
3
+ * @var string $grid
4
+ * @var string $pLink
5
+ * @var string $class
6
+ * @var bool $link
7
+ * @var string $link_target
8
+ * @var string $title_tag
9
+ * @var string $categories
10
+ * @var string $read_more_text
11
+ * @var string $date
12
+ * @var string $author
13
+ * @var bool $overlay
14
+ * @var array $items
15
+ */
16
  $html = null;
17
  $html .= "<div class='{$grid} {$class}'>";
18
  $html .= '<div class="rt-holder">';
19
  if(!empty($imgSrc)) {
20
  $html .= '<div class="rt-img-holder">';
21
+ if($overlay && $link) {
22
+ $html .= sprintf('<div class="overlay"><a class="view-details" href="%s"%s><i class="fa fa-info"></i></a></div>', $pLink, $link_target);
23
  }
24
+ if($link) {
25
+ $html .= sprintf('<a href="%s"%s><img class="img-responsive" src="%s" alt="%s"></a>', $pLink,$link_target, $imgSrc, $title);
26
+ }else{
27
+ $html .= "<img class='img-responsive' src='{$imgSrc}' alt='{$title}'>";
28
+ }
29
  $html .= '</div> ';
30
  }
31
  $html .= '<div class="rt-detail">';
32
  if(in_array('title', $items)){
33
+ if($link) {
34
+ $html .= sprintf('<%1$s class="entry-title"><a href="%2$s"%4$s>%3$s</a></%1$s>', $title_tag, $pLink, $title,$link_target);
35
+ }else{
36
+ $html .= sprintf('<%1$s class="entry-title">%2$s</%1$s>', $title_tag, $title);
37
+ }
38
  }
39
  $postMetaTop = $postMetaMid =null;
40
 
65
  $html .= "<div class='post-content'>{$excerpt}</div>";
66
  }
67
  $postMetaBottom = null;
68
+ if(in_array('read_more', $items) && $link){
69
+ $postMetaBottom .= sprintf('<div class="read-more"><a href="%s"%s>%s</a></div>', $pLink, $link_target, $read_more_text);
 
 
70
  }
71
  if(!empty($postMetaBottom)){
72
  $html .= "<div class='post-meta'>$postMetaBottom</div>";
lib/views/layouts/layout2.php CHANGED
@@ -1,4 +1,19 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  $html = null;
3
  $html .= "<div class='{$grid} {$class}'>";
4
  $html .= '<div class="rt-holder">';
@@ -6,14 +21,18 @@ $html .= "<div class='{$grid} {$class}'>";
6
  if(!empty($imgSrc)) {
7
  $html .= "<div class='{$image_area}'>";
8
  $html .= '<div class="rt-img-holder">';
9
- if($overlay) {
10
- $html .= '<div class="overlay">';
11
- $html .= "<div class='link-holder'>
12
- <a class='view-details' href='{$pLink}'><i class='fa fa-info'></i></a>
13
- </div>";
14
- $html .= '</div>';
15
  }
16
- $html .= "<a href='{$pLink}'><img class='img-responsive' src='{$imgSrc}' alt='{$title}'></a>";
 
 
 
 
17
  $html .= '</div>';
18
  $html .= '</div>';
19
  }else{
@@ -22,7 +41,11 @@ $html .= "<div class='{$grid} {$class}'>";
22
  $html .= "<div class='{$content_area}'>";
23
  $html .= '<div class="rt-detail">';
24
  if(in_array('title', $items)){
25
- $html .= sprintf('<%1$s class="entry-title"><a href="%2$s">%3$s</a></%1$s>', $title_tag, $pLink, $title);
 
 
 
 
26
  }
27
 
28
  $metaHtml = null;
@@ -46,10 +69,10 @@ $html .= "<div class='{$grid} {$class}'>";
46
  }
47
 
48
  if(in_array('excerpt', $items)){
49
- $html .= "<p>{$excerpt}</p>";
50
  }
51
- if(in_array('read_more', $items)){
52
- $html .= "<span class='read-more'><a href='{$pLink}'>{$read_more_text}</a></span>";
53
  }
54
  $html .= '</div>';
55
  $html .= '</div>';
1
  <?php
2
+ /**
3
+ * @var string $grid
4
+ * @var string $pLink
5
+ * @var string $class
6
+ * @var bool $link
7
+ * @var string $link_target
8
+ * @var string $title_tag
9
+ * @var string $image_area
10
+ * @var string $categories
11
+ * @var string $read_more_text
12
+ * @var string $date
13
+ * @var string $author
14
+ * @var bool $overlay
15
+ * @var array $items
16
+ */
17
  $html = null;
18
  $html .= "<div class='{$grid} {$class}'>";
19
  $html .= '<div class="rt-holder">';
21
  if(!empty($imgSrc)) {
22
  $html .= "<div class='{$image_area}'>";
23
  $html .= '<div class="rt-img-holder">';
24
+ if($overlay && $link) {
25
+ $html .= sprintf('<div class="overlay">
26
+ <div class="link-holder">
27
+ <a class="view-details" href="%s"%s><i class="fa fa-info"></i></a>
28
+ </div>
29
+ </div>', $pLink, $link_target);
30
  }
31
+ if($link) {
32
+ $html .= sprintf('<a href="%s"%s><img class="img-responsive" src="%s" alt="%s"></a>', $pLink,$link_target, $imgSrc, $title);
33
+ }else{
34
+ $html .= "<img class='img-responsive' src='{$imgSrc}' alt='{$title}'>";
35
+ }
36
  $html .= '</div>';
37
  $html .= '</div>';
38
  }else{
41
  $html .= "<div class='{$content_area}'>";
42
  $html .= '<div class="rt-detail">';
43
  if(in_array('title', $items)){
44
+ if($link) {
45
+ $html .= sprintf('<%1$s class="entry-title"><a href="%2$s"%4$s>%3$s</a></%1$s>', $title_tag, $pLink, $title,$link_target);
46
+ }else{
47
+ $html .= sprintf('<%1$s class="entry-title">%2$s</%1$s>', $title_tag, $title);
48
+ }
49
  }
50
 
51
  $metaHtml = null;
69
  }
70
 
71
  if(in_array('excerpt', $items)){
72
+ $html .= "<div class='post-content'>{$excerpt}</div>";
73
  }
74
+ if(in_array('read_more', $items) && $link){
75
+ $html .= sprintf('<div class="read-more"><a href="%s"%s>%s</a></div>', $pLink, $link_target, $read_more_text);
76
  }
77
  $html .= '</div>';
78
  $html .= '</div>';
lib/views/layouts/layout3.php CHANGED
@@ -1,5 +1,19 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  $html = null;
4
 
5
  $html .= "<div class='{$grid} {$class}'>";
@@ -8,14 +22,18 @@ $html .= "<div class='{$grid} {$class}'>";
8
  if(!empty($imgSrc)) {
9
  $html .= "<div class='{$image_area}'>";
10
  $html .= '<div class="rt-img-holder">';
11
- if($overlay) {
12
- $html .= '<div class="overlay">';
13
- $html .= "<div class='link-holder'>
14
- <a class='view-details' href='{$pLink}'><i class='fa fa-info'></i></a>
15
- </div>";
16
- $html .= '</div>';
17
  }
18
- $html .= "<a href='{$pLink}'><img class='img-responsive rounded' src='{$imgSrc}' alt='{$title}'></a>";
 
 
 
 
19
  $html .= '</div>';
20
  $html .= '</div>';
21
  }else{
@@ -24,7 +42,11 @@ $html .= "<div class='{$grid} {$class}'>";
24
  $html .= "<div class='{$content_area}'>";
25
  $html .= '<div class="rt-detail">';
26
  if(in_array('title', $items)){
27
- $html .= sprintf('<%1$s class="entry-title"><a href="%2$s">%3$s</a></%1$s>', $title_tag, $pLink, $title);
 
 
 
 
28
  }
29
  $metaHtml = null;
30
  if(in_array('post_date', $items) && $date){
@@ -49,8 +71,8 @@ $html .= "<div class='{$grid} {$class}'>";
49
  if(in_array('excerpt', $items)){
50
  $html .= "<div class='post-content'>{$excerpt}</div>";
51
  }
52
- if(in_array('read_more', $items)){
53
- $html .= "<span class='read-more'><a href='{$pLink}'>{$read_more_text}</a></span>";
54
  }
55
  $html .= '</div>';
56
  $html .= '</div>';
1
  <?php
2
+ /**
3
+ * @var string $grid
4
+ * @var string $pLink
5
+ * @var string $class
6
+ * @var bool $link
7
+ * @var string $link_target
8
+ * @var string $title_tag
9
+ * @var string $image_area
10
+ * @var string $categories
11
+ * @var string $read_more_text
12
+ * @var string $date
13
+ * @var string $author
14
+ * @var bool $overlay
15
+ * @var array $items
16
+ */
17
  $html = null;
18
 
19
  $html .= "<div class='{$grid} {$class}'>";
22
  if(!empty($imgSrc)) {
23
  $html .= "<div class='{$image_area}'>";
24
  $html .= '<div class="rt-img-holder">';
25
+ if($overlay && $link) {
26
+ $html .= sprintf('<div class="overlay">
27
+ <div class="link-holder">
28
+ <a class="view-details" href="%s"%s><i class="fa fa-info"></i></a>
29
+ </div>
30
+ </div>', $pLink, $link_target);
31
  }
32
+ if($link) {
33
+ $html .= sprintf('<a href="%s"%s><img class="img-responsive rounded" src="%s" alt="%s"></a>', $pLink,$link_target, $imgSrc, $title);
34
+ }else{
35
+ $html .= "<img class='img-responsive rounded' src='{$imgSrc}' alt='{$title}'>";
36
+ }
37
  $html .= '</div>';
38
  $html .= '</div>';
39
  }else{
42
  $html .= "<div class='{$content_area}'>";
43
  $html .= '<div class="rt-detail">';
44
  if(in_array('title', $items)){
45
+ if($link) {
46
+ $html .= sprintf('<%1$s class="entry-title"><a href="%2$s"%4$s>%3$s</a></%1$s>', $title_tag, $pLink, $title,$link_target);
47
+ }else{
48
+ $html .= sprintf('<%1$s class="entry-title">%2$s</%1$s>', $title_tag, $title);
49
+ }
50
  }
51
  $metaHtml = null;
52
  if(in_array('post_date', $items) && $date){
71
  if(in_array('excerpt', $items)){
72
  $html .= "<div class='post-content'>{$excerpt}</div>";
73
  }
74
+ if(in_array('read_more', $items) && $link){
75
+ $html .= sprintf('<div class="read-more"><a href="%s"%s>%s</a></div>', $pLink, $link_target, $read_more_text);
76
  }
77
  $html .= '</div>';
78
  $html .= '</div>';
lib/views/settings/post-source.php CHANGED
@@ -2,11 +2,11 @@
2
  global $rtTPG;
3
  echo $rtTPG->rtFieldGenerator($rtTPG->rtTPGPostType());
4
  $sHtml = null;
5
- $sHtml .= '<div class="field-holder">';
6
- $sHtml .= '<div class="field-label">Common filters</div>';
7
- $sHtml .= '<div class="field">';
8
- $sHtml .=$rtTPG->rtFieldGenerator($rtTPG->rtTPGCommonFilterFields(), true);
9
- $sHtml .= '</div>';
10
  $sHtml .= '</div>';
11
 
12
  echo $sHtml;
@@ -16,191 +16,191 @@ echo $sHtml;
16
  <div class='rt-tpg-filter-container'>
17
  <?php echo $rtTPG->rtFieldGenerator($rtTPG->rtTPAdvanceFilters()); ?>
18
  <div class="rt-tpg-filter-holder">
19
- <h3 style="text-align: center">Advance filter options</h3>
20
  <?php
21
- $html = null;
22
- $pt = get_post_meta($post->ID, 'tpg_post_type', true);
23
- $advFilters = $rtTPG->rtTPAdvanceFilters();
24
- foreach($advFilters['options'] as $key => $filter){
25
- if($key == 'tpg_taxonomy'){
26
- $html .= "<div class='rt-tpg-filter taxonomy tpg_taxonomy hidden'>";
27
- if(isset($pt) && $pt){
28
- $taxonomies = $rtTPG->rt_get_all_taxonomy_by_post_type($pt);
29
- $taxA = get_post_meta($post->ID, $key);
30
- $post_filter = get_post_meta($post->ID, 'post_filter');
31
- $html .= "<div class='taxonomy-field'>";
32
- if(is_array($post_filter) && !empty($post_filter) && in_array($key, $post_filter) && !empty($taxonomies)) {
33
- $html .= $rtTPG->rtFieldGenerator(
34
- array(
35
- 'type' => 'checkbox',
36
- 'name' => $key,
37
- 'label' => 'Taxonomy',
38
- 'id' => 'post-taxonomy',
39
- "multiple" => true,
40
- 'options' => $taxonomies
41
- )
42
- );
43
- }else{
44
- $html .= '<div class="field-holder">No Taxonomy found</div>';
45
- }
46
- $html .= "</div>";
47
- $html .= "<div class='rt-tpg-filter-item term-filter-item hidden'>";
48
- $html .= '<div class="field-holder">';
49
- $html .= '<div class="field-label">Terms</div>';
50
- $html .= '<div class="field term-filter-holder">';
51
- if(is_array($taxA) && !empty($taxA)){
52
- foreach($taxA as $tax){
53
-
54
- $html .="<div class='term-filter-item-container {$tax}'>";
55
- $html .= $rtTPG->rtFieldGenerator(
56
- array(
57
- 'type' => 'select',
58
- 'name' => 'term_'.$tax,
59
- 'label' => ucfirst(str_replace('_', ' ', $tax)),
60
- 'class' => 'rt-select2 full',
61
- 'holderClass' => "term-filter-item {$tax}",
62
- 'value' => get_post_meta($post->ID, 'term_'.$tax),
63
- "multiple" => true,
64
- 'options' => $rtTPG->rt_get_all_term_by_taxonomy($tax)
65
- )
66
- );
67
- $html .= $rtTPG->rtFieldGenerator(
68
- array(
69
- 'type' => 'select',
70
- 'name' => 'term_operator_'.$tax,
71
- 'label' => 'Operator',
72
- 'class' => 'rt-select2 full',
73
- 'holderClass' => "term-filter-item-operator {$tax}",
74
- 'value' => get_post_meta($post->ID, 'term_operator_'.$tax, true),
75
- 'options' => $rtTPG->rtTermOperators()
76
- )
77
- );
78
- $html .= "</div>";
79
- }
80
- }
81
- $html .= "</div>";
82
- $html .= "</div>";
83
-
84
- $html .= $rtTPG->rtFieldGenerator(
85
- array(
86
- 'type' => 'select',
87
- 'name' => 'taxonomy_relation',
88
- 'label' => 'Relation',
89
- 'class' => 'rt-select2',
90
- 'holderClass' => "term-filter-item-relation ". (count($taxA) > 1 ? null : "hidden"),
91
- 'value' => get_post_meta($post->ID, 'taxonomy_relation', true),
92
- 'options' => $rtTPG->rtTermRelations()
93
- )
94
- );
95
-
96
- $html .= "</div>";
97
- }else{
98
-
99
- $html .= "<div class='taxonomy-field'>";
100
- $html .= "</div>";
101
- $html .= "<div class='rt-tpg-filter-item'>";
102
- $html .= '<div class="field-holder">';
103
- $html .= '<div class="field-label">Terms</div>';
104
- $html .= '<div class="field term-filter-holder">';
105
- $html .= "</div>";
106
- $html .= "</div>";
107
- $html .= "</div>";
108
- $html .= $rtTPG->rtFieldGenerator(
109
- array(
110
- 'type' => 'select',
111
- 'name' => 'taxonomy_relation',
112
- 'label' => 'Relation',
113
- 'class' => 'rt-select2',
114
- 'holderClass' => "term-filter-item-relation hidden",
115
- 'default' => 'OR',
116
- 'options' => $rtTPG->rtTermRelations()
117
- )
118
- );
119
  }
120
  $html .= "</div>";
121
- }else if($key == 'order'){
122
- $html .= "<div class='rt-tpg-filter {$key} hidden'>";
123
- $html .= "<div class='rt-tpg-filter-item'>";
124
- $html .="<div class='field-holder'>";
125
- $html .= "<div class='field-label'><label>Order Settings</label></div>";
126
- $html .="<div class='field'>";
127
- $html .= $rtTPG->rtFieldGenerator(
128
- array(
129
- 'type' => 'select',
130
- 'name' => 'order_by',
131
- 'label' => 'Order by',
132
- 'class' => 'rt-select2 filter-item',
133
- 'value' => get_post_meta($post->ID, 'order_by', true),
134
- 'options' => $rtTPG->rtPostOrderBy()
135
- )
136
- );
137
- $html .= $rtTPG->rtFieldGenerator(
138
- array(
139
- 'type' => 'radio',
140
- 'name' => 'order',
141
- 'label' => 'Order',
142
- 'class' => 'rt-select2 filter-item',
143
- 'alignment' => 'vertical',
144
- 'default' => 'DESC',
145
- 'value' => get_post_meta($post->ID, 'order', true),
146
- 'options' => $rtTPG->rtPostOrders()
147
- )
148
- );
149
- $html .="</div>";
150
- $html .="</div>";
151
- $html .= "</div>";
152
- $html .= "</div>";
153
- }else if($key == 'author'){
154
- $html .= "<div class='rt-tpg-filter {$key} hidden'>";
155
- $html .= "<div class='rt-tpg-filter-item'>";
156
  $html .= $rtTPG->rtFieldGenerator(
157
  array(
158
- 'type' => 'select',
159
- 'name' => $key,
160
- 'label' => 'Author',
161
- 'class' => 'rt-select2 filter-item full',
162
- 'value' => get_post_meta($post->ID, $key),
163
- "multiple" => true,
164
- 'options' => $rtTPG->rt_get_users()
 
165
  )
166
  );
167
- $html .= "</div>";
168
- $html .= "</div>";
169
- }else if($key == 'tpg_post_status'){
170
- $html .= "<div class='rt-tpg-filter {$key} hidden'>";
171
- $html .= "<div class='rt-tpg-filter-item'>";
172
  $html .= $rtTPG->rtFieldGenerator(
173
  array(
174
- 'type' => 'select',
175
- 'name' => $key,
176
- 'label' => 'Status',
177
- 'class' => 'rt-select2 filter-item full',
178
- 'default' => array('publish'),
179
- 'value' => get_post_meta($post->ID, $key),
180
- "multiple" => true,
181
- 'options' => $rtTPG->rtTPGPostStatus()
182
  )
183
  );
184
- $html .= "</div>";
 
 
185
  $html .= "</div>";
186
- }else if($key == 's'){
187
- $html .= "<div class='rt-tpg-filter {$key} hidden'>";
188
- $html .= "<div class='rt-tpg-filter-item'>";
189
- $html .= $rtTPG->rtFieldGenerator(
190
- array(
191
- 'type' => 'text',
192
- 'name' => $key,
193
- 'label' => 'Search keyword',
194
- 'class' => 'filter-item full',
195
- 'value' => get_post_meta($post->ID, $key, true)
196
- )
197
- );
198
- $html .= "</div>";
199
  $html .= "</div>";
200
- }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
- echo $html;
 
 
204
  ?>
205
  </div>
206
  </div>
2
  global $rtTPG;
3
  echo $rtTPG->rtFieldGenerator($rtTPG->rtTPGPostType());
4
  $sHtml = null;
5
+ $sHtml .= '<div class="rt-field-wrapper">';
6
+ $sHtml .= '<div class="rt-label"><label>Common filters</label></div>';
7
+ $sHtml .= '<div class="rt-field">';
8
+ $sHtml .= $rtTPG->rtFieldGenerator($rtTPG->rtTPGCommonFilterFields(), true);
9
+ $sHtml .= '</div>';
10
  $sHtml .= '</div>';
11
 
12
  echo $sHtml;
16
  <div class='rt-tpg-filter-container'>
17
  <?php echo $rtTPG->rtFieldGenerator($rtTPG->rtTPAdvanceFilters()); ?>
18
  <div class="rt-tpg-filter-holder">
19
+ <h3><?php esc_html_e("Advance filter options", "the-post-grid"); ?></h3>
20
  <?php
21
+ $html = null;
22
+ $pt = get_post_meta($post->ID, 'tpg_post_type', true);
23
+ $advFilters = $rtTPG->rtTPAdvanceFilters();
24
+ foreach ($advFilters['options'] as $key => $filter) {
25
+ if ($key == 'tpg_taxonomy') {
26
+ $html .= "<div class='rt-tpg-filter taxonomy tpg_taxonomy hidden'>";
27
+ if (isset($pt) && $pt) {
28
+ $taxonomies = $rtTPG->rt_get_all_taxonomy_by_post_type($pt);
29
+ $taxA = get_post_meta($post->ID, $key);
30
+ $post_filter = get_post_meta($post->ID, 'post_filter');
31
+ $html .= "<div class='taxonomy-field'>";
32
+ if (is_array($post_filter) && !empty($post_filter) && in_array($key, $post_filter) && !empty($taxonomies)) {
33
+ $html .= $rtTPG->rtFieldGenerator(
34
+ array(
35
+ 'type' => 'checkbox',
36
+ 'name' => $key,
37
+ 'label' => 'Taxonomy',
38
+ 'id' => 'post-taxonomy',
39
+ "multiple" => true,
40
+ 'options' => $taxonomies
41
+ )
42
+ );
43
+ } else {
44
+ $html .= '<div class="rt-field-wrapper">No Taxonomy found</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
  $html .= "</div>";
47
+ $html .= "<div class='rt-tpg-filter-item term-filter-item hidden'>";
48
+ $html .= '<div class="rt-field-wrapper">';
49
+ $html .= '<div class="rt-label"></div>';
50
+ $html .= '<div class="rt-field term-filter-holder">';
51
+ if (is_array($taxA) && !empty($taxA)) {
52
+ foreach ($taxA as $tax) {
53
+
54
+ $html .= "<div class='term-filter-item-container {$tax}'>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  $html .= $rtTPG->rtFieldGenerator(
56
  array(
57
+ 'type' => 'select',
58
+ 'name' => 'term_' . $tax,
59
+ 'label' => ucfirst(str_replace('_', ' ', $tax)),
60
+ 'class' => 'rt-select2 full',
61
+ 'holderClass' => "term-filter-item {$tax}",
62
+ 'value' => get_post_meta($post->ID, 'term_' . $tax),
63
+ "multiple" => true,
64
+ 'options' => $rtTPG->rt_get_all_term_by_taxonomy($tax)
65
  )
66
  );
 
 
 
 
 
67
  $html .= $rtTPG->rtFieldGenerator(
68
  array(
69
+ 'type' => 'select',
70
+ 'name' => 'term_operator_' . $tax,
71
+ 'label' => 'Operator',
72
+ 'class' => 'rt-select2 full',
73
+ 'holderClass' => "term-filter-item-operator {$tax}",
74
+ 'value' => get_post_meta($post->ID, 'term_operator_' . $tax, true),
75
+ 'options' => $rtTPG->rtTermOperators()
 
76
  )
77
  );
78
+ $html .= "</div>";
79
+ }
80
+ }
81
  $html .= "</div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  $html .= "</div>";
 
83
 
84
+ $html .= $rtTPG->rtFieldGenerator(
85
+ array(
86
+ 'type' => 'select',
87
+ 'name' => 'taxonomy_relation',
88
+ 'label' => 'Relation',
89
+ 'class' => 'rt-select2',
90
+ 'holderClass' => "term-filter-item-relation " . (count($taxA) > 1 ? null : "hidden"),
91
+ 'value' => get_post_meta($post->ID, 'taxonomy_relation', true),
92
+ 'options' => $rtTPG->rtTermRelations()
93
+ )
94
+ );
95
+
96
+ $html .= "</div>";
97
+ } else {
98
+
99
+ $html .= "<div class='taxonomy-field'>";
100
+ $html .= "</div>";
101
+ $html .= "<div class='rt-tpg-filter-item'>";
102
+ $html .= '<div class="rt-field-wrapper">';
103
+ $html .= '<div class="rt-label">' . __("Terms", 'the-post-grid') . '</div>';
104
+ $html .= '<div class="field term-filter-holder">';
105
+ $html .= "</div>";
106
+ $html .= "</div>";
107
+ $html .= "</div>";
108
+ $html .= $rtTPG->rtFieldGenerator(
109
+ array(
110
+ 'type' => 'select',
111
+ 'name' => 'taxonomy_relation',
112
+ 'label' => 'Relation',
113
+ 'class' => 'rt-select2',
114
+ 'holderClass' => "term-filter-item-relation hidden",
115
+ 'default' => 'OR',
116
+ 'options' => $rtTPG->rtTermRelations()
117
+ )
118
+ );
119
+ }
120
+ $html .= "</div>";
121
+ } else if ($key == 'order') {
122
+ $html .= "<div class='rt-tpg-filter {$key} hidden'>";
123
+ $html .= "<div class='rt-tpg-filter-item'>";
124
+ $html .= "<div class='rt-field-wrapper'>";
125
+ $html .= "<div class='rt-label'><label>" . __("Order Settings", 'the-post-grid') . "</label></div>";
126
+ $html .= "<div class='rt-field'>";
127
+ $html .= $rtTPG->rtFieldGenerator(
128
+ array(
129
+ 'type' => 'select',
130
+ 'name' => 'order_by',
131
+ 'label' => 'Order by',
132
+ 'class' => 'rt-select2 filter-item',
133
+ 'value' => get_post_meta($post->ID, 'order_by', true),
134
+ 'options' => $rtTPG->rtPostOrderBy()
135
+ )
136
+ );
137
+ $html .= $rtTPG->rtFieldGenerator(
138
+ array(
139
+ 'type' => 'radio',
140
+ 'name' => 'order',
141
+ 'label' => 'Order',
142
+ 'class' => 'rt-select2 filter-item',
143
+ 'alignment' => 'vertical',
144
+ 'default' => 'DESC',
145
+ 'value' => get_post_meta($post->ID, 'order', true),
146
+ 'options' => $rtTPG->rtPostOrders()
147
+ )
148
+ );
149
+ $html .= "</div>";
150
+ $html .= "</div>";
151
+ $html .= "</div>";
152
+ $html .= "</div>";
153
+ } else if ($key == 'author') {
154
+ $html .= "<div class='rt-tpg-filter {$key} hidden'>";
155
+ $html .= "<div class='rt-tpg-filter-item'>";
156
+ $html .= $rtTPG->rtFieldGenerator(
157
+ array(
158
+ 'type' => 'select',
159
+ 'name' => $key,
160
+ 'label' => 'Author',
161
+ 'class' => 'rt-select2 filter-item full',
162
+ 'value' => get_post_meta($post->ID, $key),
163
+ "multiple" => true,
164
+ 'options' => $rtTPG->rt_get_users()
165
+ )
166
+ );
167
+ $html .= "</div>";
168
+ $html .= "</div>";
169
+ } else if ($key == 'tpg_post_status') {
170
+ $html .= "<div class='rt-tpg-filter {$key} hidden'>";
171
+ $html .= "<div class='rt-tpg-filter-item'>";
172
+ $html .= $rtTPG->rtFieldGenerator(
173
+ array(
174
+ 'type' => 'select',
175
+ 'name' => $key,
176
+ 'label' => 'Status',
177
+ 'class' => 'rt-select2 filter-item full',
178
+ 'default' => array('publish'),
179
+ 'value' => get_post_meta($post->ID, $key),
180
+ "multiple" => true,
181
+ 'options' => $rtTPG->rtTPGPostStatus()
182
+ )
183
+ );
184
+ $html .= "</div>";
185
+ $html .= "</div>";
186
+ } else if ($key == 's') {
187
+ $html .= "<div class='rt-tpg-filter {$key} hidden'>";
188
+ $html .= "<div class='rt-tpg-filter-item'>";
189
+ $html .= $rtTPG->rtFieldGenerator(
190
+ array(
191
+ 'type' => 'text',
192
+ 'name' => $key,
193
+ 'label' => 'Search keyword',
194
+ 'class' => 'filter-item full',
195
+ 'value' => get_post_meta($post->ID, $key, true)
196
+ )
197
+ );
198
+ $html .= "</div>";
199
+ $html .= "</div>";
200
  }
201
+
202
+ }
203
+ echo $html;
204
  ?>
205
  </div>
206
  </div>
lib/views/settings/settings.php CHANGED
@@ -1,36 +1,23 @@
1
  <?php global $rtTPG; ?>
2
- <div class="wrap rttpg-wrapper">
3
- <div class="width50">
4
- <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div>
5
- <h2><?php _e( 'The Post Grid Settings', 'the-post-grid' ); ?></h2>
6
- <h3><?php _e( 'General settings', 'the-post-grid' ); ?>
7
- <a style="margin-left: 15px; font-size: 15px;"
8
- href="http://demo.radiustheme.com/wordpress/plugins/the-post-grid/"
9
- target="_blank"><?php _e( 'Documentation', 'the-post-grid' ) ?></a>
10
- </h3>
11
-
12
- <div class="rt-setting-wrapper">
13
- <div class="rt-response"></div>
14
- <form id="rt-settings-form" onsubmit="rtTPGSettings(this); return false;">
15
  <div class="rt-setting-holder">
16
- <?php echo $rtTPG->rtFieldGenerator( $rtTPG->rtTPGSettingFields(), true ); ?>
17
  </div>
18
-
19
- <p class="submit"><input type="submit" name="submit" class="button button-primary rtSaveButton"
20
- value="Save Changes"></p>
21
-
22
- <?php wp_nonce_field( $rtTPG->nonceText(), $rtTPG->nonceId() ); ?>
23
  </form>
24
-
25
  <div class="rt-response"></div>
26
  </div>
27
- </div>
28
- <div class="width50">
29
- <div class="pro-features">
30
- <h3>PRO Version Features</h3>
31
- <?php echo $rtTPG->get_pro_feature_list(); ?>
32
- <p><a href="https://www.radiustheme.com/the-post-grid-pro-for-wordpress/" class="button-link"
33
- target="_blank">Get Pro Version</a></p>
34
  </div>
35
  </div>
36
 
1
  <?php global $rtTPG; ?>
2
+ <div class="wrap">
3
+ <h2><?php esc_html_e('The Post Grid Settings', 'the-post-grid'); ?></h2>
4
+ <div class="rt-settings-container">
5
+ <div class="rt-setting-title">
6
+ <h3><?php esc_html_e('General settings', "the-post-grid") ?></h3>
7
+ </div>
8
+ <div class="rt-setting-content">
9
+ <form id="rt-tpg-settings-form" onsubmit="rtTPGSettings(this); return false;">
 
 
 
 
 
10
  <div class="rt-setting-holder">
11
+ <?php echo $rtTPG->rtFieldGenerator($rtTPG->rtTPGSettingFields(), true); ?>
12
  </div>
13
+ <p class="submit"><input type="submit" name="submit" class="rt-admin-btn button button-primary rtSaveButton"
14
+ value="<?php esc_html_e('Save Changes', 'the-post-grid'); ?>"></p>
15
+ <?php wp_nonce_field($rtTPG->nonceText(), $rtTPG->nonceId()); ?>
 
 
16
  </form>
 
17
  <div class="rt-response"></div>
18
  </div>
19
+ <div class="rt-pro-feature-content">
20
+ <?php rtTPG()->rt_plugin_sc_pro_information('settings'); ?>
 
 
 
 
 
21
  </div>
22
  </div>
23
 
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: 2.3.2
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: 2.3.3
8
  * Text Domain: the-post-grid
9
  * Domain Path: /languages
10
  * Author URI: https://radiustheme.com/