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