PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / 4.1.0
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid v4.1.0
7.9.3 7.9.2 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.2.0 4.2.1 4.2.2 4.2.3 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 6.0.0 7.0.0 7.0.1 7.0.2 7.1.0 7.2.0 7.2.1 7.2.10 7.2.11 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6 7.2.7 7.2.8 7.2.9 7.3.0 7.3.1 7.4.0 7.4.1 7.4.2 7.4.3 7.5.0 7.6.0 7.6.1 7.7.0 7.7.1 7.7.10 7.7.11 7.7.12 7.7.13 7.7.14 7.7.15 7.7.16 7.7.17 7.7.18 7.7.19 7.7.2 7.7.20 7.7.21 7.7.22 7.7.3 7.7.4 7.7.5 7.7.6 7.7.7 7.7.8 7.7.9 7.8.0 7.8.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1
the-post-grid / app / Helpers / Options.php
the-post-grid / app / Helpers Last commit date
Fns.php 4 years ago Install.php 4 years ago Options.php 4 years ago
Options.php
1637 lines
1 <?php
2
3 namespace RT\ThePostGrid\Helpers;
4
5 class Options {
6
7 public static function rtPostTypes() {
8 $args = apply_filters( 'tpg_get_post_type',
9 [
10 '_builtin' => true,
11 ] );
12
13 $post_types = get_post_types( $args );
14
15 $exclude = [ 'attachment', 'revision', 'nav_menu_item' ];
16
17 foreach ( $exclude as $ex ) {
18 unset( $post_types[ $ex ] );
19 }
20
21 return $post_types;
22 }
23
24 public static function rtPostOrders() {
25 return [
26 "ASC" => __( "Ascending", 'the-post-grid' ),
27 "DESC" => __( "Descending", 'the-post-grid' ),
28 ];
29 }
30
31 public static function rtTermOperators() {
32 return [
33 'IN' => __( "IN — show posts which associate with one or more of selected terms",
34 'the-post-grid' ),
35 'NOT IN' => __( "NOT IN — show posts which do not associate with any of selected terms",
36 'the-post-grid' ),
37 'AND' => __( "AND — show posts which associate with all of selected terms", 'the-post-grid' ),
38 ];
39 }
40
41 public static function rtTermRelations() {
42 return [
43 'AND' => __( "AND — show posts which match all settings", 'the-post-grid' ),
44 'OR' => __( "OR — show posts which match one or more settings", 'the-post-grid' ),
45 ];
46 }
47
48 public static function rtMetaKeyType() {
49 return [
50 'meta_value' => __( 'Meta value', 'the-post-grid' ),
51 'meta_value_num' => __( 'Meta value number', 'the-post-grid' ),
52 'meta_value_datetime' => __( 'Meta value datetime', 'the-post-grid' ),
53 ];
54 }
55
56 public static function rtPostOrderBy( $isWoCom = false, $metaOrder = false ) {
57 $orderBy = [
58 // "ID" => __( "ID", 'the-post-grid' ),
59 "title" => __( "Title", 'the-post-grid' ),
60 "date" => __( "Created date", 'the-post-grid' ),
61 "modified" => __( "Modified date", 'the-post-grid' ),
62 "menu_order" => __( "Menu Order", 'the-post-grid' ),
63 ];
64
65 return apply_filters( 'rt_tpg_post_orderby', $orderBy, $isWoCom, $metaOrder );
66 }
67
68 public static function rtTPGSettingsCustomScriptFields() {
69 $settings = get_option( rtTPG()->options['settings'] );
70
71 return [
72 "script_before_item_load" => [
73 "label" => __( "Script before item load", 'the-post-grid' ),
74 'type' => 'textarea',
75 'holderClass' => 'rt-script-wrapper full',
76 'id' => 'script-before-item-load',
77 'value' => isset( $settings['script_before_item_load'] ) ? stripslashes( $settings['script_before_item_load'] ) : null,
78 ],
79 "script_after_item_load" => [
80 "label" => __( "Script After item load", 'the-post-grid' ),
81 'type' => 'textarea',
82 'holderClass' => 'rt-script-wrapper full',
83 'id' => 'script-after-item-load',
84 'value' => isset( $settings['script_after_item_load'] ) ? stripslashes( $settings['script_after_item_load'] ) : null,
85 ],
86 "script_loaded" => [
87 "label" => __( "After Loaded script", 'the-post-grid' ),
88 'type' => 'textarea',
89 'holderClass' => 'rt-script-wrapper full',
90 'id' => 'script-loaded',
91 'value' => isset( $settings['script_loaded'] ) ? stripslashes( $settings['script_loaded'] ) : null,
92 ],
93 ];
94 }
95
96 public static function rtTPGSettingsOtherSettingsFields() {
97 $settings = get_option( rtTPG()->options['settings'] );
98
99 $other_settings = [
100 'template_author' => [
101 'type' => 'select',
102 'name' => 'template_author',
103 'label' => 'Template Author',
104 'id' => 'template_author',
105 'holderClass' => 'pro-field',
106 'class' => 'select2',
107 'blank' => 'Select a layout',
108 'options' => Fns::getTPGShortCodeList(),
109 'value' => isset( $settings['template_author'] ) ? $settings['template_author'] : [],
110 ],
111 'template_category' => [
112 'type' => 'select',
113 'name' => 'template_category',
114 'label' => 'Template Category',
115 'id' => 'template_category',
116 'holderClass' => 'pro-field',
117 'class' => 'select2',
118 'blank' => 'Select a layout',
119 'options' => Fns::getTPGShortCodeList(),
120 'value' => isset( $settings['template_category'] ) ? $settings['template_category'] : [],
121 ],
122 'template_search' => [
123 'type' => 'select',
124 'name' => 'template_search',
125 'label' => 'Template Search',
126 'id' => 'template_search',
127 'holderClass' => 'pro-field',
128 'class' => 'select2',
129 'blank' => 'Select a layout',
130 'options' => Fns::getTPGShortCodeList(),
131 'value' => isset( $settings['template_search'] ) ? $settings['template_search'] : [],
132 ],
133 'template_tag' => [
134 'type' => 'select',
135 'name' => 'template_tag',
136 'label' => 'Template Tag',
137 'id' => 'template_tag',
138 'holderClass' => 'pro-field',
139 'class' => 'select2',
140 'blank' => 'Select a layout',
141 'options' => Fns::getTPGShortCodeList(),
142 'value' => isset( $settings['template_tag'] ) ? $settings['template_tag'] : [],
143 ],
144
145 'tpg_primary_color_main' => [
146 "type" => "text",
147 "label" => "Primary Color",
148 "class" => "rt-color",
149 "default" => isset( $settings['tpg_primary_color_main'] ) ? $settings['tpg_primary_color_main'] : "#0d6efd",
150 ],
151
152 'tpg_secondary_color_main' => [
153 "type" => "text",
154 "label" => "Secondary Color",
155 "class" => "rt-color",
156 "default" => isset( $settings['tpg_secondary_color_main'] ) ? $settings['tpg_secondary_color_main'] : "#0654c4",
157 ],
158
159 'tpg_loader_color' => [
160 "type" => "text",
161 "label" => "Preloader Color",
162 "class" => "rt-color",
163 "default" => isset( $settings['tpg_loader_color'] ) ? $settings['tpg_loader_color'] : "#0367bf",
164 ],
165
166 'template_class' => [
167 'type' => 'text',
168 'name' => 'template_class',
169 'label' => 'Template class',
170 'holderClass' => 'pro-field',
171 'id' => 'template_class',
172 'value' => isset( $settings['template_class'] ) ? $settings['template_class'] : '',
173 ],
174 ];
175
176 $plugin = Fns::is_acf();
177
178 if ( $plugin ) {
179 $acf_settings = [
180 'show_acf_details' => [
181 'type' => 'switch',
182 'name' => 'show_acf_details',
183 'label' => __( 'Enable Advanced Custom Field (ACF) for Single page', 'the-post-grid' ),
184 'description' => __( "You may enable advanced custom field (ACF) on details page", 'the-post-grid' ),
185 'holderClass' => 'pro-field',
186 'value' => isset( $settings['show_acf_details'] ) ? $settings['show_acf_details'] : false,
187 ],
188
189 'cf_group_details' => [
190 'type' => 'checkbox',
191 'name' => 'cf_group_details',
192 'label' => __( 'Choose ACF Group', 'the-post-grid' ),
193 'id' => 'cf_group_details',
194 'holderClass' => 'pro-field',
195 'alignment' => 'vertical',
196 'multiple' => true,
197 'options' => Fns::get_groups_by_post_type( 'all' ),
198 'value' => isset( $settings['cf_group_details'] ) ? $settings['cf_group_details'] : [],
199 ],
200
201 'cf_hide_empty_value_details' => [
202 'type' => 'switch',
203 'name' => 'cf_hide_empty_value_details',
204 'label' => __( 'Hide field with empty value', 'the-post-grid' ),
205 'value' => isset( $settings['cf_hide_empty_value_details'] ) ? $settings['cf_hide_empty_value_details'] : false,
206 'holderClass' => 'pro-field',
207 ],
208
209 'cf_show_only_value_details' => [
210 'type' => 'switch',
211 'name' => 'cf_show_only_value_details',
212 'label' => __( 'Show Title', 'the-post-grid' ),
213 'description' => __( "By default both name & value of field is shown", 'the-post-grid' ),
214 'value' => isset( $settings['cf_show_only_value_details'] ) ? $settings['cf_show_only_value_details'] : true,
215 'holderClass' => 'pro-field',
216 ],
217
218 'cf_hide_group_title_details' => [
219 'type' => 'switch',
220 'name' => 'cf_hide_group_title_details',
221 'label' => __( 'Show group title', 'the-post-grid' ),
222 'value' => isset( $settings['cf_hide_group_title_details'] ) ? $settings['cf_hide_group_title_details'] : false,
223 'holderClass' => 'pro-field',
224 ],
225 ];
226
227 $other_settings = array_merge( $other_settings, $acf_settings );
228 }
229
230 return $other_settings;
231 }
232
233
234 public static function rtTPGSettingsCommonSettingsFields() {
235 $settings = get_option( rtTPG()->options['settings'] );
236
237 $common_settings = [
238 'tpg_common_settings_heading' => [
239 'type' => 'heading',
240 'name' => 'tpg_common_settings_heading',
241 'class' => 'tpg_common_settings_heading',
242 'label' => __( 'Improve Performance', 'the-post-grid' ),
243 'description' => __( 'Please choose a Resource Load Type first. Otherwise, all CSS & JS for shortcode and elementor will load on your site which can create a bad performance issues.', 'the-post-grid' ),
244 ],
245
246 'tpg_block_type' => [
247 'type' => 'select',
248 'name' => 'tpg_block_type',
249 'label' => 'Resource Load Type',
250 'id' => 'tpg_block_type',
251 'class' => 'select2',
252 'options' => [
253 'default' => __( 'Default (Both Elementor and Shortcode)', 'the-post-grid' ),
254 'elementor' => __( 'Elementor', 'the-post-grid' ),
255 'shortcode' => __( 'Shortcode', 'the-post-grid' ),
256 ],
257 'description' => __( 'Please check which type of block you want to use. If you use Default then all styles and scripts for both will load on your site. But if you use one then just this style and script will load on your site.', 'the-post-grid' ),
258 'value' => isset( $settings['tpg_block_type'] ) ? $settings['tpg_block_type'] : 'default',
259 ],
260 'tpg_load_script' => [
261 'type' => 'switch',
262 'name' => 'tpg_load_script',
263 'label' => __( 'Load Script dependent on block', 'the-post-grid' ),
264 'description' => __( 'Check, if you want to load script when ShortCode or Elementor block is used on a page. <b>If you enable this then you must have to enable Preloader from below</b>', 'the-post-grid' ),
265 'value' => isset( $settings['tpg_load_script'] ) ? $settings['tpg_load_script'] : false,
266 ],
267 'tpg_enable_preloader' => [
268 'type' => 'switch',
269 'name' => 'tpg_enable_preloader',
270 'label' => __( 'Enable Pre-loader', 'the-post-grid' ),
271 'value' => isset( $settings['tpg_enable_preloader'] ) ? $settings['tpg_enable_preloader'] : false,
272 ],
273 'tpg_skip_fa' => [
274 'type' => 'switch',
275 'name' => 'tpg_skip_fa',
276 'label' => __( 'Disable Font Awesome Script', 'the-post-grid' ),
277 'description' => __( "If Font Awesome 5 exist with theme, don't need to load twice.", 'the-post-grid' ),
278 'value' => isset( $settings['tpg_skip_fa'] ) ? $settings['tpg_skip_fa'] : false,
279 ],
280 ];
281
282 return $common_settings;
283 }
284
285 public static function rtTPGLicenceField() {
286 $settings = get_option( rtTPG()->options['settings'] );
287 $status = ! empty( $settings['license_status'] ) && $settings['license_status'] === 'valid' ? true : false;
288 $license_status = ! empty( $settings['license_key'] ) ? sprintf( "<span class='license-status'>%s</span>",
289 $status
290 ? "<input type='submit' class='button-secondary rt-licensing-btn danger' name='license_deactivate' value='" . __( "Deactivate License", "the-post-grid" )
291 . "'/>"
292 : "<input type='submit' class='button-secondary rt-licensing-btn button-primary' name='license_activate' value='" . __( "Activate License", "the-post-grid" )
293 . "'/>"
294 ) : ' ';
295
296 return [
297 "license_key" => [
298 'type' => 'text',
299 'name' => 'license_key',
300 'attr' => 'style="min-width:300px;"',
301 'label' => __( 'Enter your license key', 'the-post-grid' ),
302 'description' => $license_status,
303 'id' => 'license_key',
304 'value' => isset( $settings['license_key'] ) ? $settings['license_key'] : '',
305 ],
306 ];
307 }
308
309 public static function rtTPGSettingsSocialShareFields() {
310 $settings = get_option( rtTPG()->options['settings'] );
311
312 return [
313 "social_share_items" => [
314 'type' => 'checkbox',
315 'name' => 'social_share_items',
316 'label' => 'Social share items',
317 'id' => 'social_share_items',
318 'holderClass' => 'pro-field',
319 'alignment' => 'vertical',
320 'multiple' => true,
321 'options' => Options::socialShareItemList(),
322 'value' => isset( $settings['social_share_items'] ) ? $settings['social_share_items'] : [],
323 ],
324 ];
325 }
326
327 public static function socialShareItemList() {
328 return [
329 'facebook' => 'Facebook',
330 'twitter' => 'Twitter',
331 'linkedin' => 'LinkedIn',
332 'pinterest' => 'Pinterest',
333 'reddit' => 'Reddit',
334 'email' => 'Email',
335 ];
336 }
337
338 public static function templateOverrideItemList() {
339 return [
340 'category-archive' => "Category archive",
341 'tag-archive' => "Tag archive",
342 'author-archive' => "Author archive",
343 'search' => "Search page",
344 ];
345 }
346
347 public static function rtTPGCommonFilterFields() {
348 return [
349 'post__in' => [
350 "name" => "post__in",
351 "label" => "Include only",
352 "type" => "text",
353 "class" => "full",
354 "description" => 'List of post IDs to show (comma-separated values, for example: 1,2,3)',
355 ],
356 'post__not_in' => [
357 "name" => "post__not_in",
358 "label" => "Exclude",
359 "type" => "text",
360 "class" => "full",
361 "description" => 'List of post IDs to hide (comma-separated values, for example: 1,2,3)',
362 ],
363 'limit' => [
364 "name" => "limit",
365 "label" => "Limit",
366 "type" => "number",
367 "class" => "full",
368 "description" => 'The number of posts to show. Set empty to show all found posts.',
369 ],
370 'offset' => [
371 "name" => "offset",
372 "label" => __( "Offset", "the-post-grid" ),
373 "type" => "number",
374 "class" => "full",
375 "description" => 'The number of posts to skip from start',
376 ],
377 ];
378 }
379
380 public static function rtTPGPostType() {
381 return [
382 'tpg_post_type' => [
383 "label" => "Post Type",
384 "type" => "select",
385 "id" => "rt-sc-post-type",
386 "class" => "-rt-select2",
387 "options" => self::rtPostTypes(),
388 ],
389 ];
390 }
391
392 public static function rtTPAdvanceFilters() {
393 $fields = apply_filters( 'rt_tpg_advanced_filters',
394 [
395 'tpg_taxonomy' => "Taxonomy",
396 'order' => "Order",
397 'author' => "Author",
398 'tpg_post_status' => "Status",
399 's' => "Search",
400 ] );
401
402 return [
403 'post_filter' => [
404 'type' => "checkboxFilter",
405 'name' => "post_filter",
406 'label' => "Advanced Filters",
407 "alignment" => "vertical",
408 "multiple" => true,
409 'default' => [ 'tpg_taxonomy', 'order' ],
410 "options" => $fields,
411 ],
412 ];
413 }
414
415 public static function rtTPGPostStatus() {
416 return [
417 'publish' => 'Publish',
418 'pending' => 'Pending',
419 'draft' => 'Draft',
420 'auto-draft' => 'Auto draft',
421 'future' => 'Future',
422 'private' => 'Private',
423 'inherit' => 'Inherit',
424 'trash' => 'Trash',
425 ];
426 }
427
428 public static function owl_property() {
429 return [
430 'auto_play' => 'Auto Play',
431 'loop' => 'Loop',
432 'nav_button' => 'Nav Button',
433 'pagination' => 'Pagination',
434 'stop_hover' => 'Stop Hover',
435 'auto_height' => 'Auto Height',
436 'lazy_load' => 'Lazy Load',
437 'rtl' => 'Right to left (RTL)',
438 ];
439 }
440
441 public static function rtTPGLayoutSettingFields() {
442 $options = [
443 'layout_type' => [
444 "type" => "radio-image",
445 "label" => __( "Layout Type", "the-post-grid" ),
446 "id" => "rt-tpg-sc-layout-type",
447 "options" => self::rtTPGLayoutType(),
448 ],
449 'layout' => [
450 "type" => "radio-image",
451 "label" => __( "Layout", "the-post-grid" ),
452 "id" => "rt-tpg-sc-layout",
453 "class" => "rt-select2",
454 "options" => self::rtTPGLayouts(),
455 ],
456 'tgp_filter' => [
457 "type" => "checkbox",
458 "label" => "Filter",
459 'holderClass' => "sc-tpg-grid-filter tpg-hidden pro-field",
460 "multiple" => true,
461 "alignment" => 'vertical',
462 "options" => self::tgp_filter_list(),
463 ],
464 'tgp_filter_taxonomy' => [
465 "type" => "select",
466 "label" => "Taxonomy Filter",
467 'holderClass' => "sc-tpg-grid-filter sc-tpg-filter tpg-hidden",
468 "class" => "rt-select2",
469 "options" => Fns::rt_get_taxonomy_for_filter(),
470 ],
471 'tgp_filter_taxonomy_hierarchical' => [
472 "type" => "switch",
473 "label" => "Display as sub category",
474 'holderClass' => "sc-tpg-grid-filter sc-tpg-filter tpg-hidden",
475 "option" => "Active",
476 ],
477 'tgp_filter_type' => [
478 "type" => "select",
479 "label" => "Taxonomy filter type",
480 'holderClass' => "sc-tpg-grid-filter sc-tpg-filter tpg-hidden",
481 "class" => "rt-select2",
482 "options" => self::rt_filter_type(),
483 ],
484 'tgp_default_filter' => [
485 "type" => "select",
486 "label" => "Selected filter term (Selected item)",
487 'holderClass' => "sc-tpg-grid-filter sc-tpg-filter tpg-hidden",
488 "class" => "rt-select2",
489 "attr" => "data-selected='" . get_post_meta( get_the_ID(), 'tgp_default_filter', true ) . "'",
490 "options" => [ '' => __( 'Show All', 'the-post-grid' ) ],
491 ],
492 'tpg_hide_all_button' => [
493 "type" => "switch",
494 "label" => "Hide All (Show all) button",
495 'holderClass' => "sc-tpg-grid-filter sc-tpg-filter tpg-hidden",
496 "option" => 'Hide',
497 ],
498 'tpg_post_count' => [
499 "type" => "switch",
500 "label" => "Show post count",
501 'holderClass' => "sc-tpg-grid-filter sc-tpg-filter tpg-hidden",
502 "option" => 'Enable',
503 ],
504 'isotope_filter' => [
505 "type" => "select",
506 "label" => "Isotope Filter",
507 'holderClass' => "isotope-item sc-isotope-filter tpg-hidden",
508 "id" => "rt-tpg-sc-isotope-filter",
509 "class" => "rt-select2",
510 "options" => Fns::rt_get_taxonomy_for_filter(),
511 ],
512 'isotope_default_filter' => [
513 "type" => "select",
514 "label" => "Isotope filter (Selected item)",
515 'holderClass' => "isotope-item sc-isotope-default-filter tpg-hidden pro-field",
516 "id" => "rt-tpg-sc-isotope-default-filter",
517 "class" => "rt-select2",
518 "attr" => "data-selected='" . get_post_meta( get_the_ID(),
519 'isotope_default_filter',
520 true ) . "'",
521 "options" => [ '' => __( 'Show all', 'the-post-grid' ) ],
522 ],
523 'tpg_show_all_text' => [
524 "type" => "text",
525 'holderClass' => "isotope-item sc-isotope-filter tpg-hidden",
526 "label" => esc_html__( "Show all text", 'the-post-grid' ),
527 "default" => esc_html__( "Show all", 'the-post-grid' ),
528 ],
529 'isotope_filter_dropdown' => [
530 "type" => "switch",
531 "label" => "Isotope dropdown filter",
532 'holderClass' => "isotope-item sc-isotope-filter sc-isotope-filter-dropdown tpg-hidden pro-field",
533 ],
534 'isotope_filter_show_all' => [
535 "type" => "switch",
536 "name" => "isotope_filter_show_all",
537 "label" => "Isotope filter (Show All item)",
538 'holderClass' => "isotope-item sc-isotope-filter-show-all tpg-hidden pro-field",
539 "id" => "rt-tpg-sc-isotope-filter-show-all",
540 ],
541 'isotope_filter_count' => [
542 "type" => "switch",
543 "label" => "Isotope filter count number",
544 'holderClass' => "isotope-item sc-isotope-filter tpg-hidden pro-field",
545 "option" => 'Enable',
546 ],
547 'isotope_filter_url' => [
548 "type" => "switch",
549 "label" => "Isotope filter URL",
550 'holderClass' => "isotope-item sc-isotope-filter tpg-hidden pro-field",
551 ],
552 'isotope_search_filter' => [
553 "type" => "switch",
554 "label" => "Isotope search filter",
555 'holderClass' => "isotope-item sc-isotope-search-filter tpg-hidden pro-field",
556 "id" => "rt-tpg-sc-isotope-search-filter",
557 "option" => 'Enable',
558 ],
559 'carousel_property' => [
560 "type" => "checkbox",
561 "label" => "Carousel property",
562 "multiple" => true,
563 "alignment" => 'vertical',
564 'holderClass' => "carousel-item carousel-property tpg-hidden",
565 "id" => "carousel-property",
566 "default" => [ 'pagination' ],
567 "options" => self::owl_property(),
568 ],
569 'tpg_carousel_speed' => [
570 "label" => __( "Speed", 'the-post-grid' ),
571 "holderClass" => "tpg-hidden carousel-item",
572 "type" => "number",
573 'default' => 250,
574 "description" => __( 'Auto play Speed in milliseconds', 'the-post-grid' ),
575 ],
576 'tpg_carousel_autoplay_timeout' => [
577 "label" => __( "Autoplay timeout", 'the-post-grid' ),
578 "holderClass" => "tpg-hidden carousel-item tpg-carousel-auto-play-timeout",
579 "type" => "number",
580 'default' => 5000,
581 "description" => __( 'Autoplay interval timeout', 'the-post-grid' ),
582 ],
583 ];
584
585 return apply_filters( 'rt_tpg_layout_options', $options );
586 }
587
588 public static function responsiveSettingsColumn() {
589 $options = [
590 'column' => [
591 'type' => 'select',
592 'label' => __( 'Desktop', 'the-post-grid' ),
593 'class' => 'rt-select2',
594 'holderClass' => "offset-column-wrap rt-3-column",
595 'default' => 3,
596 'options' => self::scColumns(),
597 "description" => "Desktop > 991px",
598 ],
599 'tpg_tab_column' => [
600 'type' => 'select',
601 'label' => __( 'Tab', 'the-post-grid' ),
602 'class' => 'rt-select2',
603 'holderClass' => "offset-column-wrap rt-3-column",
604 'default' => 2,
605 'options' => self::scColumns(),
606 "description" => "Tab < 992px",
607 ],
608 'tpg_mobile_column' => [
609 'type' => 'select',
610 'label' => __( 'Mobile', 'the-post-grid' ),
611 'class' => 'rt-select2',
612 'holderClass' => "offset-column-wrap rt-3-column",
613 'default' => 1,
614 'options' => self::scColumns(),
615 "description" => "Mobile < 768px",
616 ],
617 ];
618
619 return apply_filters( 'rt_tpg_layout_column_options', $options );
620 }
621
622 public static function layoutMiscSettings() {
623 $options = [
624 'pagination' => [
625 "type" => "switch",
626 "label" => "Pagination",
627 'holderClass' => "pagination",
628 "id" => "rt-tpg-pagination",
629 "description" => "Pagination not allow in Grid Hover layout",
630 "option" => 'Enable',
631 ],
632 'posts_per_page' => [
633 "type" => "number",
634 "label" => "Display per page",
635 'holderClass' => "pagination-item posts-per-page tpg-hidden",
636 "default" => 5,
637 "description" => "If value of Limit setting is not blank (empty), this value should be smaller than Limit value.",
638 ],
639 'posts_loading_type' => [
640 "type" => "radio",
641 "label" => "Pagination Type",
642 'holderClass' => "pagination-item posts-loading-type tpg-hidden pro-field",
643 "alignment" => "vertical",
644 "default" => 'pagination',
645 "options" => self::postLoadingType(),
646 ],
647 'link_to_detail_page' => [
648 "type" => "switch",
649 "label" => "Link To Detail Page",
650 "alignment" => "vertical",
651 "default" => true,
652 ],
653 'detail_page_link_type' => [
654 "type" => "radio",
655 "label" => "Detail page link type",
656 'holderClass' => "detail-page-link-type tpg-hidden pro-field",
657 "alignment" => "vertical",
658 "default" => "new_page",
659 "options" => [
660 'new_page' => "New Page",
661 'popup' => "PopUp",
662 ],
663 ],
664 'popup_type' => [
665 "type" => "radio",
666 "label" => "PopUp Type",
667 'holderClass' => "popup-type tpg-hidden pro-field",
668 "alignment" => "vertical",
669 "default" => "single",
670 "options" => [
671 'single' => "Single PopUp",
672 'multi' => "Multi PopUp",
673 ],
674 ],
675 'link_target' => [
676 "type" => "radio",
677 "label" => "Link Target",
678 'holderClass' => "tpg-link-target tpg-hidden",
679 "alignment" => 'vertical',
680 "options" => [
681 '' => 'Same Window',
682 '_blank' => 'New Window',
683 ],
684 ],
685 ];
686
687 return apply_filters( 'rt_tpg_layout_misc_options', $options );
688 }
689
690 public static function stickySettings() {
691 $options = [
692 'ignore_sticky_posts' => [
693 "type" => "switch",
694 "label" => "Show sticky posts at the top",
695 'holderClass' => "pro-field",
696 "alignment" => "vertical",
697 "default" => false,
698 ],
699 ];
700
701 return $options;
702 }
703
704 public static function scMarginOpt() {
705 return [
706 'default' => "Bootstrap default",
707 'no' => "No Margin",
708 ];
709 }
710
711 function scGridType() {
712 return [
713 'even' => "Even Grid",
714 'masonry' => "Masonry",
715 ];
716 }
717
718 public static function getTitleTags() {
719 return [
720 'h2' => "H2",
721 'h3' => "H3",
722 'h4' => "H4",
723 ];
724 }
725
726 public static function getHeadingTags() {
727 return [
728 'h1' => "H1",
729 'h2' => "H2",
730 'h3' => "H3",
731 'h4' => "H4",
732 'h5' => "H5",
733 'h6' => "H6",
734 ];
735 }
736
737 public static function rtTpgSettingsDetailFieldSelection() {
738 $settings = get_option( rtTPG()->options['settings'] );
739
740 $fields = [
741 "popup_fields" => [
742 'type' => 'checkbox',
743 'label' => 'Field Selection',
744 'id' => 'popup-fields',
745 'holderClass' => 'pro-field',
746 'alignment' => 'vertical',
747 'multiple' => true,
748 'options' => Options::detailAvailableFields(),
749 'default' => array_keys( Options::detailAvailableFields() ),
750 'value' => isset( $settings['popup_fields'] ) ? $settings['popup_fields'] : [],
751 ],
752 ];
753 $cf = Fns::is_acf();
754 if ( $cf ) {
755 $plist = self::getCFPluginList();
756 $pName = ! empty( $plist[ $cf ] ) ? $plist[ $cf ] : " - ";
757 $fields['cf_group'] = [
758 "type" => "checkbox",
759 "name" => "cf_group",
760 "holderClass" => "tpg-hidden cfs-fields cf-group pro-field",
761 "label" => "Custom Field group " . " ({$pName})",
762 "multiple" => true,
763 "alignment" => "vertical",
764 "id" => "cf_group",
765 "options" => Fns::get_groups_by_post_type( 'all' ),
766 "value" => isset( $settings['cf_group'] ) ? $settings['cf_group'] : [],
767 ];
768 $fields['cf_hide_empty_value'] = [
769 "type" => "checkbox",
770 "name" => "cf_hide_empty_value",
771 "holderClass" => "tpg-hidden cfs-fields pro-field",
772 "label" => "Hide field with empty value",
773 "value" => ! empty( $settings['cf_hide_empty_value'] ) ? 1 : 0,
774 ];
775 $fields['cf_show_only_value'] = [
776 "type" => "checkbox",
777 "name" => "cf_show_only_value",
778 "holderClass" => "tpg-hidden cfs-fields pro-field",
779 "label" => "Show only value of field",
780 "description" => "By default both name & value of field is shown",
781 "value" => ! empty( $settings['cf_show_only_value'] ) ? 1 : 0,
782 ];
783 $fields['cf_hide_group_title'] = [
784 "type" => "checkbox",
785 "name" => "cf_hide_group_title",
786 "holderClass" => "tpg-hidden cfs-fields pro-field",
787 "label" => "Hide group title",
788 "value" => ! empty( $settings['cf_hide_group_title'] ) ? 1 : 0,
789 ];
790 }
791
792 return $fields;
793 }
794
795 public static function detailAvailableFields() {
796 $fields = self::rtTPGItemFields();
797 $inserted = [
798 'content' => __( 'Content', "the-post-grid" ),
799 'feature_img' => __( "Feature Image", "the-post-grid" ),
800 ];
801 unset( $fields['heading'] );
802 unset( $fields['excerpt'] );
803 unset( $fields['read_more'] );
804 unset( $fields['comment_count'] );
805 $offset = array_search( 'title', array_keys( $fields ) ) + 1;
806 $newFields = array_slice( $fields, 0, $offset, true ) + $inserted + array_slice( $fields,
807 $offset,
808 null,
809 true );
810 $newFields['social_share'] = "Social Share";
811
812 return $newFields;
813 }
814
815 public static function rtTPGSCHeadingSettings() {
816 $fields = [
817 'tpg_heading_tag' => [
818 'type' => 'select',
819 'name' => 'tpg_heading_tag',
820 'label' => esc_html__( 'Tag', 'the-post-grid' ),
821 'class' => 'rt-select2',
822 'id' => 'heading-tag',
823 'options' => self::getHeadingTags(),
824 'default' => 'h2',
825 ],
826 'tpg_heading_style' => [
827 "type" => "select",
828 "class" => "rt-select2",
829 "label" => esc_html__( "Style", "the-post-grid" ),
830 "blank" => esc_html__( "Default", "the-post-grid" ),
831 "options" => [
832 'style1' => esc_html__( "Style 1", "the-post-grid" ),
833 'style2' => esc_html__( "Style 2", "the-post-grid" ),
834 'style3' => esc_html__( "Style 3", "the-post-grid" ),
835 ],
836 ],
837 'tpg_heading_alignment' => [
838 "type" => "select",
839 "class" => "rt-select2",
840 "label" => esc_html__( "Alignment", "the-post-grid" ),
841 "blank" => esc_html__( "Default", "the-post-grid" ),
842 "options" => [
843 'left' => esc_html__( "Left", "the-post-grid" ),
844 'right' => esc_html__( "Right", "the-post-grid" ),
845 'center' => esc_html__( "Center", "the-post-grid" ),
846 ],
847 ],
848 'tpg_heading_link' => [
849 "type" => "url",
850 "label" => __( 'Link', 'the-post-grid' ),
851 ],
852 ];
853
854 return $fields;
855 }
856
857 public static function rtTPGSCCategorySettings() {
858 $fields = [
859 'tpg_category_position' => [
860 "type" => "select",
861 "class" => "rt-select2",
862 "holderClass" => "pro-field",
863 "label" => esc_html__( "Position", "the-post-grid" ),
864 "blank" => esc_html__( "Default", "the-post-grid" ),
865 "options" => [
866 'above_title' => esc_html__( "Above Title", "the-post-grid" ),
867 'top_left' => esc_html__( "Over image (Top Left)", "the-post-grid" ),
868 'top_right' => esc_html__( "Over image (Top Right)", "the-post-grid" ),
869 'bottom_left' => esc_html__( "Over image (Bottom Left)", "the-post-grid" ),
870 'bottom_right' => esc_html__( "Over image (Bottom Right)", "the-post-grid" ),
871 'image_center' => esc_html__( "Over image (Center)", "the-post-grid" ),
872 ],
873 ],
874 'tpg_category_style' => [
875 "type" => "select",
876 "class" => "rt-select2",
877 "holderClass" => "pro-field",
878 "label" => esc_html__( "Style", "the-post-grid" ),
879 "blank" => esc_html__( "Default", "the-post-grid" ),
880 "options" => [
881 'style1' => esc_html__( "Style 1", "the-post-grid" ),
882 'style2' => esc_html__( "Style 2", "the-post-grid" ),
883 'style3' => esc_html__( "Style 3", "the-post-grid" ),
884 ],
885 ],
886 'tpg_category_icon' => [
887 "type" => "switch",
888 "label" => esc_html__( "Icon", "the-post-grid" ),
889 "default" => true,
890 ],
891 ];
892
893 return $fields;
894 }
895
896 public static function rtTPGSCTitleSettings() {
897 $fields = [
898 'tpg_title_position' => [
899 "type" => "select",
900 "label" => esc_html__( "Title Position (Above or Below image)", "the-post-grid" ),
901 "class" => "rt-select2 ",
902 "holderClass" => "pro-field",
903 "blank" => esc_html__( "Default", "the-post-grid" ),
904 "options" => [
905 'above' => esc_html__( "Above image", "the-post-grid" ),
906 'below' => esc_html__( "Below image", "the-post-grid" ),
907 ],
908 "description" => __( "<span style='color:#ff0000'>Only Layout 1, Layout 12, Layout 14, Isotope1, Isotope8, Isotope10, Carousel Layout 1, Carousel Layout 8, Carousel Layout 10</span>",
909 'the-post-grid' ),
910 ],
911 'title_tag' => [
912 'type' => 'select',
913 'name' => 'title_tag',
914 'label' => esc_html__( 'Title tag', 'the-post-grid' ),
915 'class' => 'rt-select2',
916 'id' => 'title-tag',
917 'options' => self::getTitleTags(),
918 'default' => 'h3',
919 ],
920 'tpg_title_limit' => [
921 "type" => "number",
922 "label" => esc_html__( "Title limit", 'the-post-grid' ),
923 "description" => esc_html__( "Title limit only integer number is allowed, Leave it blank for full title.", 'the-post-grid' ),
924 ],
925 'tpg_title_limit_type' => [
926 "type" => "radio",
927 "label" => esc_html__( "Title limit type", 'the-post-grid' ),
928 "alignment" => "vertical",
929 "default" => 'character',
930 "options" => self::get_limit_type(),
931 ],
932 ];
933
934 return $fields;
935 }
936
937 public static function rtTPGSCMetaSettings() {
938 $fields = [
939 'tpg_meta_position' => [
940 "type" => "select",
941 "label" => esc_html__( "Position", "the-post-grid" ),
942 "class" => "rt-select2 ",
943 "holderClass" => "pro-field",
944 "blank" => esc_html__( "Default", "the-post-grid" ),
945 "options" => [
946 'above_title' => esc_html__( "Above Title", "the-post-grid" ),
947 'above_excerpt' => esc_html__( "Above excerpt", "the-post-grid" ),
948 'below_excerpt' => esc_html__( "Below excerpt", "the-post-grid" ),
949 ],
950 ],
951 'tpg_meta_icon' => [
952 "type" => "switch",
953 "label" => esc_html__( "Icon", "the-post-grid" ),
954 "default" => true,
955 ],
956 'tpg_meta_separator' => [
957 "type" => "select",
958 "class" => "rt-select2",
959 "label" => esc_html__( "Separator", "the-post-grid" ),
960 "blank" => esc_html__( "Default", "the-post-grid" ),
961 "options" => [
962 'dot' => esc_html__( "Dot ( . )", "the-post-grid" ),
963 's_slash' => esc_html__( "Single Slash ( / )", "the-post-grid" ),
964 'd_slash' => esc_html__( "Double Slash ( // )", "the-post-grid" ),
965 'hypen' => esc_html__( "Hypen ( - )", "the-post-grid" ),
966 'v_pipe' => esc_html__( "Vertical Pipe ( | )", "the-post-grid" ),
967 ],
968 ],
969 ];
970
971 return $fields;
972 }
973
974 public static function rtTPGSCImageSettings() {
975 $fields = [
976 'feature_image' => [
977 "type" => "switch",
978 "label" => "Hide Feature Image",
979 "id" => "rt-tpg-feature-image",
980 "default" => false,
981 ],
982 'featured_image_size' => [
983 "type" => "select",
984 "label" => "Feature Image Size",
985 "class" => "rt-select2",
986 'holderClass' => "rt-feature-image-option tpg-hidden",
987 "options" => Fns::get_image_sizes(),
988 ],
989 'custom_image_size' => [
990 "type" => "image_size",
991 "label" => "Custom Image Size",
992 'holderClass' => "rt-sc-custom-image-size-holder tpg-hidden",
993 "multiple" => true,
994 ],
995 'media_source' => [
996 "type" => "radio",
997 "label" => "Media Source",
998 "default" => 'feature_image',
999 "alignment" => "vertical",
1000 'holderClass' => "rt-feature-image-option tpg-hidden",
1001 "options" => self::rtMediaSource(),
1002 ],
1003 'tgp_layout2_image_column' => [
1004 'type' => 'select',
1005 'label' => esc_html__( 'Image column', 'the-post-grid' ),
1006 'class' => 'rt-select2',
1007 'holderClass' => "holder-layout2-image-column tpg-hidden",
1008 'default' => 4,
1009 'options' => self::scColumns(),
1010 "description" => "Content column will calculate automatically",
1011 ],
1012 'tpg_image_type' => [
1013 "type" => "radio",
1014 "label" => esc_html__( "Type", 'the-post-grid' ),
1015 "alignment" => "vertical",
1016 'holderClass' => "rt-feature-image-option tpg-hidden pro-field",
1017 "default" => 'normal',
1018 "options" => self::get_image_types(),
1019 ],
1020 'tpg_image_animation' => [
1021 "type" => "select",
1022 "label" => esc_html__( 'Hover Animation', 'the-post-grid' ),
1023 "class" => "rt-select2",
1024 "blank" => esc_html__( "Default", "the-post-grid" ),
1025 "options" => [
1026 'img_zoom_in' => esc_html__( 'Zoom in', 'the-post-grid' ),
1027 'img_zoom_out' => esc_html__( 'Zoom out', 'the-post-grid' ),
1028 'img_no_effect' => esc_html__( 'None', 'the-post-grid' ),
1029 ],
1030 ],
1031 'tpg_image_border_radius' => [
1032 "type" => "number",
1033 "class" => "small-text",
1034 'holderClass' => "pro-field",
1035 "label" => esc_html__( "Border radius", "the-post-grid" ),
1036 "description" => esc_html__( "Leave it blank for default", 'the-post-grid' ),
1037 ],
1038 ];
1039
1040 return apply_filters( 'rt_tpg_sc_image_settings', $fields );
1041 }
1042
1043 public static function rtTPGSCExcerptSettings() {
1044 $fields = [
1045 'excerpt_limit' => [
1046 "type" => "number",
1047 "label" => esc_html__( "Excerpt limit", 'the-post-grid' ),
1048 "default" => 15,
1049 "description" => esc_html__( "Excerpt limit only integer number is allowed, Leave it blank for full excerpt.", 'the-post-grid' ),
1050 ],
1051 'tgp_excerpt_type' => [
1052 "type" => "radio",
1053 "label" => esc_html__( "Excerpt Type", 'the-post-grid' ),
1054 "alignment" => "vertical",
1055 "default" => 'word',
1056 "options" => self::get_limit_type( 'content' ),
1057 ],
1058 'tgp_excerpt_more_text' => [
1059 "type" => "text",
1060 "label" => "Excerpt more text",
1061 "default" => '...',
1062 ],
1063 ];
1064
1065 return $fields;
1066 }
1067
1068 public static function rtTPGSCButtonSettings() {
1069 $fields = [
1070 'tpg_read_more_button_border_radius' => [
1071 "type" => "number",
1072 "class" => "small-text",
1073 "label" => esc_html__( "Border radius", "the-post-grid" ),
1074 "description" => __( "Leave it blank for default", 'the-post-grid' ),
1075 ],
1076 'tpg_read_more_button_alignment' => [
1077 "type" => "select",
1078 "class" => "rt-select2",
1079 "label" => esc_html__( "Alignment", "the-post-grid" ),
1080 "blank" => esc_html__( "Default", "the-post-grid" ),
1081 "options" => [
1082 'left' => esc_html__( "Left", "the-post-grid" ),
1083 'right' => esc_html__( "Right", "the-post-grid" ),
1084 'center' => esc_html__( "Center", "the-post-grid" ),
1085 ],
1086 ],
1087 'tgp_read_more_text' => [
1088 "type" => "text",
1089 "label" => "Text",
1090 ],
1091 ];
1092
1093 return $fields;
1094 }
1095
1096 public static function rtTPGStyleFields() {
1097 $fields = [
1098 'parent_class' => [
1099 "type" => "text",
1100 "label" => "Parent class",
1101 "class" => "medium-text",
1102 "description" => "Parent class for adding custom css",
1103 ],
1104 'primary_color' => [
1105 "type" => "text",
1106 "label" => "Primary Color",
1107 "class" => "rt-color",
1108 "default" => "#0367bf",
1109 ],
1110 ];
1111
1112 return apply_filters( 'rt_tpg_style_fields', $fields );
1113 }
1114
1115 public static function rtTPGStyleButtonColorFields() {
1116 $fields = [
1117
1118 'button_bg_color' => [
1119 "type" => "text",
1120 "name" => "button_bg_color",
1121 "label" => "Background",
1122 "class" => "rt-color",
1123 ],
1124 'button_hover_bg_color' => [
1125 "type" => "text",
1126 "name" => "button_hover_bg_color",
1127 "label" => "Hover Background",
1128 "class" => "rt-color",
1129 ],
1130 'button_active_bg_color' => [
1131 "type" => "text",
1132 "label" => "Active Background (Isotop)",
1133 "class" => "rt-color",
1134 ],
1135 'button_text_bg_color' => [
1136 "type" => "text",
1137 "label" => "Text",
1138 "class" => "rt-color",
1139 ],
1140 'button_hover_text_color' => [
1141 "type" => "text",
1142 "label" => "Text Hover",
1143 "class" => "rt-color",
1144 ],
1145 ];
1146
1147 return apply_filters( 'rt_tpg_style_button_css_fields', $fields );
1148 }
1149
1150 public static function rtTPGStyleHeading() {
1151 $fields = [
1152 'tpg_heading_bg' => [
1153 "type" => "text",
1154 "class" => "rt-color",
1155 "label" => esc_html__( "Background Color", "the-post-grid" ),
1156 ],
1157 'tpg_heading_color' => [
1158 "type" => "text",
1159 "class" => "rt-color",
1160 "label" => esc_html__( "Text Color", "the-post-grid" ),
1161 ],
1162 'tpg_heading_border_color' => [
1163 "type" => "text",
1164 "class" => "rt-color",
1165 "label" => esc_html__( "Border Color", "the-post-grid" ),
1166 ],
1167 'tpg_heading_border_size' => [
1168 "type" => "number",
1169 "class" => "small-text",
1170 "label" => esc_html__( "Border Size", "the-post-grid" ),
1171 "description" => __( "Leave it blank for default", 'the-post-grid' ),
1172 ],
1173 'tpg_heading_margin' => [
1174 "type" => "text",
1175 "class" => "medium-text tpg-spacing-field",
1176 "label" => esc_html__( "Margin", "the-post-grid" ),
1177 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1178 ],
1179 'tpg_heading_padding' => [
1180 "type" => "text",
1181 "class" => "medium-text tpg-spacing-field",
1182 "label" => esc_html__( "Padding", "the-post-grid" ),
1183 "description" => __( "Leave it blank for default, multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1184 ],
1185 ];
1186
1187 return apply_filters( 'tpg_heading_style_fields', $fields );
1188 }
1189
1190 public static function rtTPGStyleFullArea() {
1191 $fields = [
1192 'tpg_full_area_bg' => [
1193 "type" => "text",
1194 "class" => "rt-color",
1195 "label" => esc_html__( "Background", "the-post-grid" ),
1196 ],
1197 'tpg_full_area_margin' => [
1198 "type" => "text",
1199 "class" => "medium-text",
1200 "label" => esc_html__( "Margin", "the-post-grid" ),
1201 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1202 ],
1203 'tpg_full_area_padding' => [
1204 "type" => "text",
1205 "class" => "medium-text",
1206 "label" => esc_html__( "Padding", "the-post-grid" ),
1207 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1208 ],
1209 ];
1210
1211 return apply_filters( 'tpg_box_style_fields', $fields );
1212 }
1213
1214 public static function rtTPGStyleContentWrap() {
1215 $fields = [
1216 'tpg_content_wrap_bg' => [
1217 "type" => "text",
1218 "class" => "rt-color",
1219 "label" => esc_html__( "Background Color", "the-post-grid" ),
1220 ],
1221 'tpg_content_wrap_shadow' => [
1222 "type" => "text",
1223 "class" => "rt-color",
1224 "label" => esc_html__( "Box Shadow Color", "the-post-grid" ),
1225 ],
1226 'tpg_content_wrap_border_color' => [
1227 "type" => "text",
1228 "class" => "rt-color",
1229 "label" => esc_html__( "Border Color", "the-post-grid" ),
1230 ],
1231 'tpg_content_wrap_border' => [
1232 "type" => "number",
1233 "class" => "small-text",
1234 "label" => esc_html__( "Border Width", "the-post-grid" ),
1235 "description" => __( "Leave it blank for default", 'the-post-grid' ),
1236 ],
1237 'tpg_content_wrap_border_radius' => [
1238 "type" => "number",
1239 "class" => "small-text",
1240 "label" => esc_html__( "Border Radius", "the-post-grid" ),
1241 ],
1242 'tpg_box_padding' => [
1243 "type" => "text",
1244 "class" => "medium-text",
1245 "label" => esc_html__( "Box Padding", "the-post-grid" ),
1246 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1247 ],
1248 'tpg_content_padding' => [
1249 "type" => "text",
1250 "class" => "medium-text",
1251 "label" => esc_html__( "Content Padding", "the-post-grid" ),
1252 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1253 ],
1254 ];
1255
1256 return apply_filters( 'tpg_content_style_fields', $fields );
1257 }
1258
1259 public static function rtTPGStyleCategory() {
1260 $fields = [
1261 'tpg_category_bg' => [
1262 "type" => "text",
1263 "class" => "rt-color",
1264 "label" => esc_html__( "Background Color", "the-post-grid" ),
1265 ],
1266 'tpg_category_color' => [
1267 "type" => "text",
1268 "class" => "rt-color",
1269 "label" => esc_html__( "Text Color", "the-post-grid" ),
1270 ],
1271 'tpg_category_border_radius' => [
1272 "type" => "number",
1273 "class" => "small-text",
1274 "label" => esc_html__( "Border Radius", "the-post-grid" ),
1275 "description" => __( "Leave it blank for default", 'the-post-grid' ),
1276 ],
1277 'tpg_category_margin' => [
1278 "type" => "text",
1279 "class" => "medium-text tpg-spacing-field",
1280 "label" => esc_html__( "Margin", "the-post-grid" ),
1281 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1282 ],
1283 'tpg_category_padding' => [
1284 "type" => "text",
1285 "class" => "medium-text tpg-spacing-field",
1286 "label" => esc_html__( "Padding", "the-post-grid" ),
1287 "description" => __( "Multiple value allowed separated by comma 12,0,5,10", 'the-post-grid' ),
1288 ],
1289 'rt_tpg_category_font_size' => [
1290 "type" => "select",
1291 "class" => "rt-select2",
1292 "label" => esc_html__( "Font Size", "the-post-grid" ),
1293 "blank" => 'Default',
1294 "options" => self::scFontSize(),
1295 ],
1296 ];
1297
1298 return apply_filters( 'tpg_category_style_fields', $fields );
1299 }
1300
1301
1302 public static function itemFields() {
1303
1304 $itemField = self::rtTPGItemFields();
1305 $itemField['tpg_default_value'] = 'Default';
1306
1307 $fields = [
1308 'item_fields' => [
1309 "type" => "checkbox",
1310 "name" => "item_fields",
1311 "label" => "Field selection",
1312 "id" => "item-fields",
1313 "multiple" => true,
1314 "alignment" => "vertical",
1315 "default" => array_keys( $itemField ),
1316 "options" => $itemField,
1317 ],
1318 ];
1319 if ( $cf = Fns::is_acf() ) {
1320 global $post;
1321 $post_type = get_post_meta( $post->ID, 'tpg_post_type', true );
1322 $plist = self::getCFPluginList();
1323 $fields['cf_group'] = [
1324 "type" => "checkbox",
1325 "name" => "cf_group",
1326 "holderClass" => "tpg-hidden cf-fields cf-group",
1327 "label" => "Custom Field group " . " ({$plist[$cf]})",
1328 "multiple" => true,
1329 "alignment" => "vertical",
1330 "id" => "cf_group",
1331 "options" => Fns::get_groups_by_post_type( $post_type, $cf ),
1332 ];
1333 $fields['cf_hide_empty_value'] = [
1334 "type" => "checkbox",
1335 "name" => "cf_hide_empty_value",
1336 "holderClass" => "tpg-hidden cf-fields",
1337 "label" => "Hide field with empty value",
1338 "default" => 1,
1339 ];
1340 $fields['cf_show_only_value'] = [
1341 "type" => "checkbox",
1342 "name" => "cf_show_only_value",
1343 "holderClass" => "tpg-hidden cf-fields",
1344 "label" => "Show only value of field",
1345 "description" => "By default both name & value of field is shown",
1346 ];
1347 $fields['cf_hide_group_title'] = [
1348 "type" => "checkbox",
1349 "name" => "cf_hide_group_title",
1350 "holderClass" => "tpg-hidden cf-fields",
1351 "label" => "Hide group title",
1352 ];
1353 }
1354
1355 return $fields;
1356 }
1357
1358
1359 public static function getCFPluginList() {
1360 return [
1361 'acf' => "Advanced Custom Field",
1362 ];
1363 }
1364
1365 public static function rtMediaSource() {
1366 return [
1367 "feature_image" => "Feature Image",
1368 "first_image" => "First Image from content",
1369 ];
1370 }
1371
1372 public static function get_image_types() {
1373 return [
1374 'normal' => "Normal",
1375 'circle' => "Circle",
1376 ];
1377 }
1378
1379 public static function get_limit_type( $content = null ) {
1380 $types = [
1381 'character' => __( "Character", "the-post-grid" ),
1382 'word' => __( "Word", "the-post-grid" ),
1383 ];
1384 if ( $content === 'content' ) {
1385 $types['full'] = __( "Full Content", "the-post-grid" );
1386 }
1387
1388 return apply_filters( 'tpg_limit_type', $types, $content );
1389 }
1390
1391 public static function scColumns() {
1392 return [
1393 1 => "Column 1",
1394 2 => "Column 2",
1395 3 => "Column 3",
1396 4 => "Column 4",
1397 5 => "Column 5",
1398 6 => "Column 6",
1399 ];
1400 }
1401
1402 public static function tgp_filter_list() {
1403 return [
1404 '_taxonomy_filter' => __( 'Taxonomy filter', "the-post-grid" ),
1405 '_author_filter' => __( 'Author filter', "the-post-grid" ),
1406 '_order_by' => __( 'Order - Sort retrieved posts by parameter', "the-post-grid" ),
1407 '_sort_order' => __( 'Sort Order - Designates the ascending or descending order of the "orderby" parameter', "the-post-grid" ),
1408 '_search' => __( "Search filter", "the-post-grid" ),
1409 ];
1410 }
1411
1412 public static function overflowOpacity() {
1413 return [
1414 1 => '10%',
1415 2 => '20%',
1416 3 => '30%',
1417 4 => '40%',
1418 5 => '50%',
1419 6 => '60%',
1420 7 => '70%',
1421 8 => '80%',
1422 9 => '90%',
1423 ];
1424 }
1425
1426 public static function rtTPGLayoutType() {
1427 $layoutType = [
1428 'grid' => [
1429 'title' => __( "Grid", "the-post-grid" ),
1430 'img' => rtTPG()->get_assets_uri( 'images/grid.png' ),
1431 ],
1432 'grid_hover' => [
1433 'title' => __( "Grid Hover", "the-post-grid" ),
1434 'img' => rtTPG()->get_assets_uri( 'images/grid_hover.png' ),
1435 ],
1436 'list' => [
1437 'title' => __( "List", "the-post-grid" ),
1438 'img' => rtTPG()->get_assets_uri( 'images/list.png' ),
1439 ],
1440 'isotope' => [
1441 'title' => __( "Isotope", "the-post-grid" ),
1442 'img' => rtTPG()->get_assets_uri( 'images/isotope.png' ),
1443 ],
1444 ];
1445
1446 return apply_filters( 'rt_tpg_layouts_type', $layoutType );
1447 }
1448
1449 public static function rtTPGLayouts() {
1450 $layouts = [
1451 'layout1' => [
1452 'title' => __( "Grid Layout 1", "the-post-grid" ),
1453 'layout' => 'grid',
1454 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/',
1455 'img' => rtTPG()->get_assets_uri( 'images/layouts/grid1.png' ),
1456 ],
1457 'layout12' => [
1458 'title' => esc_html__( "Grid Layout 2", "the-post-grid" ),
1459 'layout' => 'grid',
1460 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/grid-layout-2/',
1461 'img' => rtTPG()->get_assets_uri( 'images/layouts/grid10.png' ),
1462 ],
1463 'layout5' => [
1464 'title' => __( "Grid Hover 1", "the-post-grid" ),
1465 'layout' => 'grid_hover',
1466 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-1/',
1467 'img' => rtTPG()->get_assets_uri( 'images/layouts/grid3.png' ),
1468 ],
1469 'layout6' => [
1470 'title' => esc_html__( "Grid Hover 2", "the-post-grid" ),
1471 'layout' => 'grid_hover',
1472 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-2/',
1473 'img' => rtTPG()->get_assets_uri( 'images/layouts/grid4.png' ),
1474 ],
1475 'layout7' => [
1476 'title' => esc_html__( "Grid Hover 3", "the-post-grid" ),
1477 'layout' => 'grid_hover',
1478 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-3/',
1479 'img' => rtTPG()->get_assets_uri( 'images/layouts/grid5.png' ),
1480 ],
1481 'layout2' => [
1482 'title' => __( "List Layout 1", "the-post-grid" ),
1483 'layout' => 'list',
1484 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/list-layout-1/',
1485 'img' => rtTPG()->get_assets_uri( 'images/layouts/list1.png' ),
1486 ],
1487 'layout3' => [
1488 'title' => __( "List Layout 2", "the-post-grid" ),
1489 'layout' => 'list',
1490 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/list-layout-rounded-image/',
1491 'img' => rtTPG()->get_assets_uri( 'images/layouts/list2.png' ),
1492 ],
1493 'isotope1' => [
1494 'title' => __( "Isotope Layout 1", "the-post-grid" ),
1495 'layout' => 'isotope',
1496 'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/layout-4-filter/',
1497 'img' => rtTPG()->get_assets_uri( 'images/layouts/isotope1.png' ),
1498 ],
1499 ];
1500
1501 return apply_filters( 'tpg_layouts', $layouts );
1502 }
1503
1504 public static function rtTPGItemFields() {
1505 $items = [
1506 'heading' => __( "ShortCode Heading", "the-post-grid" ),
1507 'title' => __( "Title", "the-post-grid" ),
1508 'excerpt' => __( "Excerpt", "the-post-grid" ),
1509 'read_more' => __( "Read More", "the-post-grid" ),
1510 'post_date' => __( "Post Date", "the-post-grid" ),
1511 'author' => __( "Author", "the-post-grid" ),
1512 'categories' => __( "Categories", "the-post-grid" ),
1513 'tags' => __( "Tags", "the-post-grid" ),
1514 'comment_count' => __( "Comment count", "the-post-grid" ),
1515 ];
1516
1517 return apply_filters( 'tpg_field_selection_items', $items );
1518 }
1519
1520 public static function postLoadingType() {
1521 return apply_filters( 'rttpg_pagination_type',
1522 [
1523 'pagination' => __( "Pagination", "the-post-grid" ),
1524 ] );
1525 }
1526
1527 public static function scGridOpt() {
1528 return [
1529 'even' => "Even",
1530 'masonry' => "Masonry",
1531 ];
1532 }
1533
1534 public static function extraStyle() {
1535 return apply_filters( 'tpg_extra_style',
1536 [
1537 'title' => "Title",
1538 'title_hover' => "Title hover",
1539 'excerpt' => "Excerpt",
1540 'meta_data' => "Meta Data",
1541 ] );
1542 }
1543
1544 public static function scFontSize() {
1545 $num = [];
1546 for ( $i = 10; $i <= 50; $i ++ ) {
1547 $num[ $i ] = $i . "px";
1548 }
1549
1550 return $num;
1551 }
1552
1553 public static function scAlignment() {
1554 return [
1555 'left' => "Left",
1556 'right' => "Right",
1557 'center' => "Center",
1558 'justify' => "Justify",
1559 ];
1560 }
1561
1562 public static function scReadMoreButtonPositionList() {
1563 return [
1564 'left' => "Left",
1565 'right' => "Right",
1566 'center' => "Center",
1567 ];
1568 }
1569
1570
1571 public static function scTextWeight() {
1572 return [
1573 'normal' => "Normal",
1574 'bold' => "Bold",
1575 'bolder' => "Bolder",
1576 'lighter' => "Lighter",
1577 'inherit' => "Inherit",
1578 'initial' => "Initial",
1579 'unset' => "Unset",
1580 100 => '100',
1581 200 => '200',
1582 300 => '300',
1583 400 => '400',
1584 500 => '500',
1585 600 => '600',
1586 700 => '700',
1587 800 => '800',
1588 900 => '900',
1589 ];
1590 }
1591
1592 public static function imageCropType() {
1593 return [
1594 'soft' => "Soft Crop",
1595 'hard' => "Hard Crop",
1596 ];
1597 }
1598
1599 public static function rt_filter_type() {
1600 return [
1601 'dropdown' => "Dropdown",
1602 'button' => "Button",
1603 ];
1604 }
1605
1606 public static function get_pro_feature_list() {
1607 return '<ol>
1608 <li>Fully responsive and mobile friendly.</li>
1609 <li>62 Different Layouts</li>
1610 <li>45 Elementor Layouts</li>
1611 <li>Creative Slider layouts</li>
1612 <li>Archive page builder for Elementor</li>
1613 <li>Even and Masonry Grid.</li>
1614 <li>WooCommerce supported.</li>
1615 <li>EDD supported for shortcode.</li>
1616 <li>Custom Post Type Supported</li>
1617 <li>Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)</li>
1618 <li>Order by Id, Title, Created date, Modified date and Menu order.</li>
1619 <li>Display image size (thumbnail, medium, large, full)</li>
1620 <li>Ajax front-end filter by category(s), tag(s), author(s), keyword(s)</li>
1621 <li>Isotope filter for any taxonomy ie. categories, tags...</li>
1622 <li>Query Post with Relation.</li>
1623 <li>Fields Selection.</li>
1624 <li>All Text and Color control.</li>
1625 <li>Meta Position Control.</li>
1626 <li>Category Position Control.</li>
1627 <li>Content Wrapper Style Control.</li>
1628 <li>Enable/Disable Pagination.</li>
1629 <li>AJAX Pagination (Load more and Load on Scrolling)</li>
1630 <li>Advanced Custom Field support</li>
1631 <li>Post View Count</li>
1632 </ol>
1633 <a href="https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/" class="rt-admin-btn" target="_blank">' . __( "Get Pro Version", "the-post-grid" )
1634 . '</a>';
1635 }
1636
1637 }