PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / trunk
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid vtrunk
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 / Widgets / elementor / rtTPGElementorHelper.php
the-post-grid / app / Widgets / elementor Last commit date
widgets 4 months ago base.php 9 months ago rtTPGElementorHelper.php 3 months ago rtTPGElementorQuery.php 4 months ago
rtTPGElementorHelper.php
9185 lines
1 <?php
2 /**
3 * Elementor Helper Class
4 *
5 * @package RT_TPG
6 */
7
8 use Elementor\Controls_Manager;
9 use Elementor\Group_Control_Border;
10 use Elementor\Group_Control_Typography;
11 use RT\ThePostGrid\Helpers\Fns;
12 use RT\ThePostGrid\Helpers\Options;
13
14 // Do not allow directly accessing this file.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit( 'This script cannot be accessed directly.' );
17 }
18 //phpcs:disable WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
19 require_once RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/rtTPGElementorQuery.php';
20
21 /**
22 * Elementor Helper Class
23 */
24 class rtTPGElementorHelper {
25
26 /**
27 * Post Query Builderx
28 *
29 * @param $ref
30 */
31 public static function query( $ref ) {
32 $post_types = Fns::get_post_types();
33
34 $taxonomies = get_taxonomies( [], 'objects' );
35
36 do_action( 'rt_tpg_el_query_build', $ref );
37 $ref->start_controls_section(
38 'rt_post_query',
39 [
40 'label' => esc_html__( 'Query Build', 'the-post-grid' ),
41 'tab' => Controls_Manager::TAB_CONTENT,
42 ]
43 );
44
45 $ref->add_control(
46 'multiple_post_type',
47 [
48 'label' => esc_html__( 'Multiple Post Types?', 'the-post-grid' ) . $ref->pro_label,
49 'type' => Controls_Manager::SWITCHER,
50 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
51 'label_off' => esc_html__( 'No', 'the-post-grid' ),
52 'return_value' => 'yes',
53 'default' => false,
54 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
55 'condition' => [
56 'post_type!' => 'current_query',
57 ],
58 ]
59 );
60
61 $ref->add_control(
62 'multiple_post_type_notice',
63 [
64 'type' => Controls_Manager::ALERT,
65 'alert_type' => 'info',
66 'condition' => [
67 'multiple_post_type' => 'yes',
68 ],
69 'content' => esc_html__( 'If you enable Multiple Post Types the Front-end Filter will not work.', 'the-post-grid' ),
70 ]
71 );
72
73 $singlePostType = $post_types;
74 if ( rtTPG()->hasPro() ) {
75 $singlePostType = $post_types + [ 'current_query' => __( 'Current Query', 'the-post-grid' ) ];
76 }
77 $ref->add_control(
78 'post_type',
79 [
80 'label' => esc_html__( 'Post Source', 'the-post-grid' ),
81 'type' => Controls_Manager::SELECT,
82 'options' => $singlePostType,
83 'default' => 'post',
84 'description' => $ref->get_pro_message( 'all post type.' ),
85 'condition' => [
86 'multiple_post_type!' => 'yes',
87 ],
88 ]
89 );
90
91 $ref->add_control(
92 'current_query_note',
93 [
94 'type' => \Elementor\Controls_Manager::NOTICE,
95 'notice_type' => 'warning',
96 'dismissible' => true,
97 'condition' => [
98 'post_type' => 'current_query',
99 ],
100 'content' => esc_html__( 'The Current Query is used only for the archive page. If you use the Current Query the below settings under this tab will not work.', 'the-post-grid' ),
101 ]
102 );
103
104 $ref->add_control(
105 'post_types',
106 [
107 'label' => esc_html__( 'Post Sources', 'the-post-grid' ),
108 'type' => Controls_Manager::SELECT2,
109 'multiple' => true,
110 'options' => $post_types,
111 'default' => [ 'post' ],
112 'description' => $ref->get_pro_message( 'all post type.' ),
113 'condition' => [
114 'multiple_post_type' => 'yes',
115 ],
116 ]
117 );
118
119 // Common Filter
120
121 $ref->add_control(
122 'common_filters_heading',
123 [
124 'label' => esc_html__( 'Common Filters:', 'the-post-grid' ),
125 'type' => Controls_Manager::HEADING,
126 'separator' => 'before',
127 'classes' => 'tpg-control-type-heading',
128 ]
129 );
130
131 $ref->add_control(
132 'post_id',
133 [
134 'label' => esc_html__( 'Include only', 'the-post-grid' ),
135 'type' => Controls_Manager::TEXT,
136 'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ),
137 'placeholder' => 'Eg. 10, 15, 17',
138 ]
139 );
140
141 $ref->add_control(
142 'exclude',
143 [
144 'label' => esc_html__( 'Exclude', 'the-post-grid' ),
145 'type' => Controls_Manager::TEXT,
146 'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ),
147 'placeholder' => 'Eg. 12, 13',
148 ]
149 );
150
151 $ref->add_control(
152 'post_limit',
153 [
154 'label' => esc_html__( 'Limit', 'the-post-grid' ),
155 'type' => Controls_Manager::NUMBER,
156 'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ),
157 ]
158 );
159
160 $ref->add_control(
161 'display_per_page',
162 [
163 'label' => esc_html__( 'Display Per Page', 'the-post-grid' ),
164 'type' => Controls_Manager::NUMBER,
165 'description' => esc_html__( 'Enter how may posts will display per page. It works only for the the pagination and ajax-filer.', 'the-post-grid' ),
166 ]
167 );
168
169 $ref->add_control(
170 'offset',
171 [
172 'label' => esc_html__( 'Offset', 'the-post-grid' ),
173 'type' => Controls_Manager::TEXT,
174 'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ),
175 'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ),
176 ]
177 );
178
179 $ref->add_control(
180 'instant_query',
181 [
182 'label' => esc_html__( 'Quick Query', 'the-post-grid' ) . $ref->pro_label,
183 'type' => Controls_Manager::SELECT,
184 'options' => [
185 'default' => esc_html__( '--Quick Query--', 'the-post-grid' ) . ' ' . $ref->pro_label(),
186 'popular_post_1_day_view' => esc_html__( 'Popular Post (1 Day View)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
187 'popular_post_7_days_view' => esc_html__( 'Popular Post (7 Days View)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
188 'popular_post_30_days_view' => esc_html__( 'Popular Post (30 Days View)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
189 'popular_post_all_times_view' => esc_html__( 'Popular Post (All time View)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
190 'most_comment_1_day' => esc_html__( 'Most Comment (1 Day)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
191 'most_comment_7_days' => esc_html__( 'Most Comment (7 Days)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
192 'most_comment_30_days' => esc_html__( 'Most Comment (30 Days)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
193 'random_post_7_days' => esc_html__( 'Random Posts (7 Days)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
194 'random_post_30_days' => esc_html__( 'Random Post (30 Days)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
195 'related_category' => esc_html__( 'Related Posts (Category)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
196 'related_tag' => esc_html__( 'Related Posts (Tag)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
197 'related_cat_tag' => esc_html__( 'Related Posts (Tag and Category)', 'the-post-grid' ) . ' ' . $ref->pro_label(),
198 'event_query' => esc_html__( 'Event Query', 'the-post-grid' ) . ' ' . $ref->pro_label(),
199 ],
200 'classes' => rtTPG()->hasPro() ? '' : 'tpg-pro-field-select',
201 'default' => 'default',
202 'description' => esc_html__( 'If you choose any value from here the orderby worn\'t work.', 'the-post-grid' ),
203 ]
204 );
205
206 // Advance Filter
207
208 $ref->add_control(
209 'advanced_filters_heading',
210 [
211 'label' => esc_html__( 'Advanced Filters:', 'the-post-grid' ),
212 'type' => Controls_Manager::HEADING,
213 'separator' => 'before',
214 'classes' => 'tpg-control-type-heading',
215 ]
216 );
217
218 $_url = site_url( 'wp-admin/edit.php?post_type=rttpg&page=tgp_taxonomy_order' );
219
220 foreach ( $taxonomies as $taxonomy => $object ) {
221 if ( ! isset( $object->object_type[0] )
222 || ! in_array( $object->object_type[0], array_keys( $post_types ) )
223 || in_array( $taxonomy, Fns::get_excluded_taxonomy() )
224 ) {
225 continue;
226 }
227 $ref->add_control(
228 $taxonomy . '_ids',
229 [
230 'label' => esc_html__( 'By ', 'the-post-grid' ) . $object->label,
231 'type' => Controls_Manager::SELECT2,
232 'label_block' => true,
233 'multiple' => true,
234 'options' => Fns::tpg_get_categories_by_id( $taxonomy ),
235 'condition' => [
236 'post_type' => $object->object_type,
237 'multiple_post_type!' => 'yes',
238 ],
239 'description' => "For custom order: <a target='_blank' href='" . $_url . "'>The Post Grid > Taxonomy Order</a>",
240 ]
241 );
242
243 $ref->add_control(
244 $taxonomy . '_ids2',
245 [
246 'label' => esc_html__( 'By ', 'the-post-grid' ) . $object->label,
247 'type' => Controls_Manager::SELECT2,
248 'label_block' => true,
249 'multiple' => true,
250 'options' => Fns::tpg_get_categories_by_id( $taxonomy ),
251 'condition' => [
252 'multiple_post_type' => 'yes',
253 ],
254 'description' => "For custom order: <a target='_blank' href='" . $_url . "'>The Post Grid > Taxonomy Order</a>",
255 ]
256 );
257 }
258
259 $ref->add_control(
260 'relation',
261 [
262 'label' => esc_html__( 'Taxonomies Relation', 'the-post-grid' ),
263 'type' => Controls_Manager::SELECT,
264 'default' => 'OR',
265 'options' => [
266 'OR' => __( 'OR', 'the-post-grid' ),
267 'AND' => __( 'AND', 'the-post-grid' ),
268 ],
269 ]
270 );
271
272 $ref->add_control(
273 'author',
274 [
275 'label' => esc_html__( 'By Author', 'the-post-grid' ),
276 'type' => Controls_Manager::SELECT2,
277 'multiple' => true,
278 'label_block' => true,
279 'options' => Fns::rt_get_users(),
280 ]
281 );
282
283 $ref->add_control(
284 'post_keyword',
285 [
286 'label' => esc_html__( 'By Keyword', 'the-post-grid' ),
287 'type' => Controls_Manager::TEXT,
288 'label_block' => true,
289 'placeholder' => esc_html__( 'Search by keyword', 'the-post-grid' ),
290 'description' => esc_html__( 'Search by post title or content keyword', 'the-post-grid' ),
291 ]
292 );
293
294 $ref->add_control(
295 'date_range',
296 [
297 'label' => esc_html__( 'Date Range (Start to End)', 'the-post-grid' ) . $ref->pro_label,
298 'type' => Controls_Manager::DATE_TIME,
299 'placeholder' => 'Choose date...',
300 'description' => esc_html__( 'NB: Enter DEL button for delete date range', 'the-post-grid' ),
301 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
302 'picker_options' => [
303 'enableTime' => false,
304 'mode' => 'range',
305 'dateFormat' => 'M j, Y',
306 ],
307 ]
308 );
309
310 $orderby_opt = [
311 'date' => esc_html__( 'Date', 'the-post-grid' ),
312 'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ),
313 'author' => esc_html__( 'Author', 'the-post-grid' ),
314 'title' => esc_html__( 'Title', 'the-post-grid' ),
315 'modified' => esc_html__( 'Last modified date', 'the-post-grid' ),
316 'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ),
317 'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ),
318 'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ),
319 ];
320
321 if ( rtTPG()->hasPro() ) {
322 $prderby_pro_opt = [
323 'include_only' => esc_html__( 'Include only', 'the-post-grid' ),
324 'rand' => esc_html__( 'Random order', 'the-post-grid' ),
325 'meta_value' => esc_html__( 'Meta value', 'the-post-grid' ), //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
326 'meta_value_num' => esc_html__( 'Meta value number', 'the-post-grid' ),
327 'meta_value_datetime' => esc_html__( 'Meta value datetime', 'the-post-grid' ),
328 ];
329 $orderby_opt = array_merge( $orderby_opt, $prderby_pro_opt );
330 }
331
332 $ref->add_control(
333 'orderby',
334 [
335 'label' => esc_html__( 'Order by', 'the-post-grid' ),
336 'type' => Controls_Manager::SELECT,
337 'options' => $orderby_opt,
338 'default' => 'date',
339 'description' => $ref->get_pro_message( 'Random Order.' ),
340 'condition' => [
341 'instant_query' => 'default',
342 ],
343 ]
344 );
345
346 $ref->add_control(
347 'meta_key',
348 [
349 'label' => esc_html__( 'Meta Key', 'the-post-grid' ),
350 'type' => Controls_Manager::TEXT,
351 'placeholder' => esc_html__( 'Enter Meta Key.', 'the-post-grid' ),
352 'condition' => [
353 'orderby' => [ 'meta_value', 'meta_value_num', 'meta_value_datetime' ],
354 ],
355 ]
356 );
357
358 $ref->add_control(
359 'order',
360 [
361 'label' => esc_html__( 'Sort order', 'the-post-grid' ),
362 'type' => Controls_Manager::SELECT,
363 'options' => [
364 'ASC' => esc_html__( 'ASC', 'the-post-grid' ),
365 'DESC' => esc_html__( 'DESC', 'the-post-grid' ),
366 ],
367 'default' => 'DESC',
368 ]
369 );
370
371 $ref->add_control(
372 'ignore_sticky_posts',
373 [
374 'label' => esc_html__( 'Ignore sticky posts at the top', 'the-post-grid' ) . $ref->pro_label,
375 'type' => Controls_Manager::SWITCHER,
376 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
377 'label_off' => esc_html__( 'No', 'the-post-grid' ),
378 'return_value' => 'yes',
379 'default' => 'no',
380 'disabled' => true,
381 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
382 ]
383 );
384
385 $ref->add_control(
386 'no_posts_found_text',
387 [
388 'label' => esc_html__( 'No post found Text', 'the-post-grid' ),
389 'type' => Controls_Manager::TEXT,
390 'default' => esc_html__( 'No posts found.', 'the-post-grid' ),
391 'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ),
392 'separator' => 'before',
393 ]
394 );
395
396 $ref->end_controls_section();
397 }
398
399 /**
400 * Archive Query Builder
401 *
402 * @param $ref
403 * @param $layout_type
404 *
405 * @return void
406 */
407 public static function query_builder( $ref, $layout_type = '' ) {
408 $post_types = Fns::get_post_types();
409
410 $taxonomies = get_object_taxonomies( 'post', 'object' );
411
412 do_action( 'rt_tpg_el_query_build', $ref );
413 $ref->start_controls_section(
414 'rt_post_query',
415 [
416 'label' => esc_html__( 'Query Build', 'the-post-grid' ),
417 'tab' => Controls_Manager::TAB_CONTENT,
418 ]
419 );
420
421 $ref->add_control(
422 'post_limit',
423 [
424 'label' => esc_html__( 'Posts per page', 'the-post-grid' ),
425 'type' => Controls_Manager::NUMBER,
426 'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ),
427 ]
428 );
429
430 if ( 'single' == $layout_type ) {
431 $get_all_taxonomy = [];
432 foreach ( $taxonomies as $taxonomy => $object ) {
433 if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) )
434 || in_array( $taxonomy, Fns::get_excluded_taxonomy() )
435 ) {
436 continue;
437 }
438 $get_all_taxonomy[ $object->name ] = $object->label;
439 }
440
441 $ref->add_control(
442 'taxonomy_lists',
443 [
444 'label' => esc_html__( 'Select a Taxonomy for relation', 'the-post-grid' ),
445 'type' => Controls_Manager::SELECT,
446 'default' => 'category',
447 'options' => $get_all_taxonomy,
448 ]
449 );
450
451 $orderby_opt = [
452 'date' => esc_html__( 'Date', 'the-post-grid' ),
453 'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ),
454 'author' => esc_html__( 'Author', 'the-post-grid' ),
455 'title' => esc_html__( 'Title', 'the-post-grid' ),
456 'modified' => esc_html__( 'Last modified date', 'the-post-grid' ),
457 'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ),
458 'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ),
459 'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ),
460 'rand' => esc_html__( 'Random order', 'the-post-grid' ),
461
462 ];
463
464 $ref->add_control(
465 'orderby',
466 [
467 'label' => esc_html__( 'Order by', 'the-post-grid' ),
468 'type' => Controls_Manager::SELECT,
469 'options' => $orderby_opt,
470 'default' => 'date',
471 ]
472 );
473
474 $ref->add_control(
475 'order',
476 [
477 'label' => esc_html__( 'Sort order', 'the-post-grid' ),
478 'type' => Controls_Manager::SELECT,
479 'options' => [
480 'ASC' => esc_html__( 'ASC', 'the-post-grid' ),
481 'DESC' => esc_html__( 'DESC', 'the-post-grid' ),
482 ],
483 'default' => 'DESC',
484 'condition' => [
485 'orderby!' => 'menu_order',
486 ],
487 ]
488 );
489 } else {
490 $ref->add_control(
491 'post_id',
492 [
493 'label' => esc_html__( 'Include only', 'the-post-grid' ),
494 'type' => Controls_Manager::TEXT,
495 'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ),
496 'placeholder' => 'Eg. 10, 15, 17',
497 ]
498 );
499
500 $ref->add_control(
501 'exclude',
502 [
503 'label' => esc_html__( 'Exclude', 'the-post-grid' ),
504 'type' => Controls_Manager::TEXT,
505 'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ),
506 'placeholder' => 'Eg. 12, 13',
507 ]
508 );
509
510 $ref->add_control(
511 'offset',
512 [
513 'label' => esc_html__( 'Offset', 'the-post-grid' ),
514 'type' => Controls_Manager::TEXT,
515 'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ),
516 'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ),
517 ]
518 );
519
520 $ref->add_control(
521 'no_posts_found_text_archive',
522 [
523 'label' => esc_html__( 'No post found Text', 'the-post-grid' ),
524 'type' => Controls_Manager::TEXT,
525 'default' => esc_html__( 'No posts found.', 'the-post-grid' ),
526 'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ),
527 'separator' => 'before',
528 ]
529 );
530 }
531 $ref->end_controls_section();
532 }
533
534 /**
535 * Grid Layout Settings
536 *
537 * @param $ref
538 */
539 public static function grid_layouts( $ref, $layout_type = '' ) {
540 $prefix = $ref->prefix;
541
542 $ref->start_controls_section(
543 $prefix . '_layout_settings',
544 [
545 'label' => esc_html__( 'Layout', 'the-post-grid' ),
546 'tab' => Controls_Manager::TAB_CONTENT,
547 ]
548 );
549
550 if ( 'grid' === $prefix ) {
551 $layout_class = 'grid-layout';
552 $layout_options = [
553 $prefix . '-layout1' => [
554 'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
555 ],
556 $prefix . '-layout3' => [
557 'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
558 ],
559 $prefix . '-layout4' => [
560 'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
561 ],
562 $prefix . '-layout2' => [
563 'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
564 ],
565 $prefix . '-layout5' => [
566 'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
567 ],
568 $prefix . '-layout5-2' => [
569 'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
570 ],
571 $prefix . '-layout6' => [
572 'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
573 ],
574 $prefix . '-layout6-2' => [
575 'title' => esc_html__( 'Layout 8', 'the-post-grid' ),
576 ],
577 $prefix . '-layout7' => [
578 'title' => esc_html__( 'Gallery', 'the-post-grid' ),
579 ],
580 ];
581 }
582
583 if ( 'grid_hover' === $prefix ) {
584 $layout_class = 'grid-hover-layout';
585 $layout_options = [
586 $prefix . '-layout1' => [
587 'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
588 ],
589 $prefix . '-layout2' => [
590 'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
591 ],
592 $prefix . '-layout3' => [
593 'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
594 ],
595 $prefix . '-layout4' => [
596 'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
597 ],
598 $prefix . '-layout4-2' => [
599 'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
600 ],
601 $prefix . '-layout5' => [
602 'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
603 ],
604 $prefix . '-layout5-2' => [
605 'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
606 ],
607 $prefix . '-layout6' => [
608 'title' => esc_html__( 'Layout 8', 'the-post-grid' ),
609 ],
610 $prefix . '-layout6-2' => [
611 'title' => esc_html__( 'Layout 9', 'the-post-grid' ),
612 ],
613 $prefix . '-layout7' => [
614 'title' => esc_html__( 'Layout 10', 'the-post-grid' ),
615 ],
616 $prefix . '-layout7-2' => [
617 'title' => esc_html__( 'Layout 11', 'the-post-grid' ),
618 ],
619 $prefix . '-layout8' => [
620 'title' => esc_html__( 'Layout 12', 'the-post-grid' ),
621 ],
622 $prefix . '-layout9' => [
623 'title' => esc_html__( 'Layout 13', 'the-post-grid' ),
624 ],
625 $prefix . '-layout9-2' => [
626 'title' => esc_html__( 'Layout 14', 'the-post-grid' ),
627 ],
628 $prefix . '-layout10' => [
629 'title' => esc_html__( 'Layout 15', 'the-post-grid' ),
630 ],
631 $prefix . '-layout11' => [
632 'title' => esc_html__( 'Layout 16', 'the-post-grid' ),
633 ],
634 ];
635 }
636
637 if ( 'slider' === $prefix ) {
638 $layout_class = 'slider-layout';
639 $layout_options = [
640 $prefix . '-layout1' => [
641 'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
642 ],
643 $prefix . '-layout2' => [
644 'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
645 ],
646 $prefix . '-layout3' => [
647 'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
648 ],
649 $prefix . '-layout4' => [
650 'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
651 ],
652 $prefix . '-layout5' => [
653 'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
654 ],
655 $prefix . '-layout6' => [
656 'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
657 ],
658 $prefix . '-layout7' => [
659 'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
660 ],
661 $prefix . '-layout8' => [
662 'title' => esc_html__( 'Layout 8', 'the-post-grid' ),
663 ],
664 $prefix . '-layout9' => [
665 'title' => esc_html__( 'Layout 9', 'the-post-grid' ),
666 ],
667 $prefix . '-layout10' => [
668 'title' => esc_html__( 'Layout 10', 'the-post-grid' ),
669 ],
670 $prefix . '-layout11' => [
671 'title' => esc_html__( 'Layout 11', 'the-post-grid' ),
672 ],
673 $prefix . '-layout12' => [
674 'title' => esc_html__( 'Layout 12', 'the-post-grid' ),
675 ],
676 $prefix . '-layout13' => [
677 'title' => esc_html__( 'Layout 13', 'the-post-grid' ),
678 ],
679 ];
680
681 if ( 'single' === $layout_type ) {
682 $layout_options = array_slice( $layout_options, 0, 9 );
683 }
684 }
685
686 $ref->add_control(
687 $prefix . '_layout',
688 [
689 'label' => esc_html__( 'Choose Layout', 'the-post-grid' ),
690 'type' => Controls_Manager::CHOOSE,
691 'label_block' => true,
692 'options' => $layout_options,
693 'toggle' => false,
694 'default' => $prefix . '-layout1',
695 'style_transfer' => true,
696 'classes' => 'tpg-image-select ' . $layout_class . ' ' . $ref->is_post_layout,
697 ]
698 );
699
700 $ref->add_control(
701 'offset_img_position',
702 [
703 'label' => esc_html__( 'Offset Image Position', 'the-post-grid' ),
704 'type' => Controls_Manager::SELECT,
705 'default' => 'image-left',
706 'options' => [
707 'image-left' => esc_html__( 'Left (Default)', 'the-post-grid' ),
708 'image-right' => esc_html__( 'Right', 'the-post-grid' ),
709 ],
710 'prefix_class' => 'offset-',
711 'condition' => [
712 'grid_layout' => [
713 'grid-layout5',
714 'grid-layout5-2',
715 'list-layout2',
716 'list-layout2-2',
717 'list-layout3',
718 'list-layout3-2',
719 ],
720 ],
721 ]
722 );
723
724 $ref->add_control(
725 'middle_border',
726 [
727 'label' => esc_html__( 'Middle Border?', 'the-post-grid' ),
728 'type' => Controls_Manager::SELECT,
729 'default' => 'yes',
730 'options' => [
731 'yes' => esc_html__( 'Yes', 'the-post-grid' ),
732 'no' => esc_html__( 'No', 'the-post-grid' ),
733 ],
734 'condition' => [
735 'grid_layout' => [ 'grid-layout6', 'grid-layout6-2' ],
736 ],
737 ]
738 );
739
740 $ref->add_control(
741 'layout_options_heading',
742 [
743 'label' => esc_html__( 'Layout Options:', 'the-post-grid' ),
744 'type' => Controls_Manager::HEADING,
745 'classes' => 'tpg-control-type-heading',
746 ]
747 );
748
749 $column_options = [
750 '0' => esc_html__( 'Default from layout', 'the-post-grid' ),
751 '12' => esc_html__( '1 Columns', 'the-post-grid' ),
752 '6' => esc_html__( '2 Columns', 'the-post-grid' ),
753 '4' => esc_html__( '3 Columns', 'the-post-grid' ),
754 '3' => esc_html__( '4 Columns', 'the-post-grid' ),
755 ];
756
757 if ( 'grid' === $prefix ) {
758 $grid_column_condition = [
759 'grid_layout!' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ],
760 ];
761 }
762
763 if ( 'grid_hover' === $prefix ) {
764 $grid_column_condition = [
765 'grid_hover_layout!' => [ 'grid_hover-layout8' ],
766 ];
767 }
768
769 if ( 'slider' === $prefix ) {
770 $column_options = [
771 '0' => esc_html__( 'Default from layout', 'the-post-grid' ),
772 '1' => esc_html__( '1 Columns', 'the-post-grid' ),
773 '2' => esc_html__( '2 Columns', 'the-post-grid' ),
774 '3' => esc_html__( '3 Columns', 'the-post-grid' ),
775 '4' => esc_html__( '4 Columns', 'the-post-grid' ),
776 '5' => esc_html__( '5 Columns', 'the-post-grid' ),
777 '6' => esc_html__( '6 Columns', 'the-post-grid' ),
778 ];
779 $grid_column_condition = [
780 'slider_layout!' => [ 'slider-layout10', 'slider-layout11', 'slider-layout13' ],
781 ];
782 }
783
784 $ref->add_responsive_control(
785 $prefix . '_column',
786 [
787 'label' => esc_html__( 'Column', 'the-post-grid' ),
788 'type' => Controls_Manager::SELECT,
789 'options' => $column_options,
790 'default' => '0',
791 'tablet_default' => '0',
792 'mobile_default' => '0',
793 'description' => esc_html__( 'Choose Column for layout.', 'the-post-grid' ),
794 'condition' => $grid_column_condition,
795 ]
796 );
797
798 if ( 'single' === $layout_type ) {
799 $ref->add_control(
800 'enable_related_slider',
801 [
802 'label' => esc_html__( 'Enable Slider', 'the-post-grid' ),
803 'type' => Controls_Manager::SWITCHER,
804 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
805 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
806 'return_value' => 'yes',
807 'default' => 'yes',
808 ]
809 );
810
811 $ref->add_responsive_control(
812 'slider_gap_2',
813 [
814 'label' => esc_html__( 'Grid Gap', 'the-post-grid' ),
815 'type' => Controls_Manager::SLIDER,
816 'size_units' => [ 'px' ],
817 'range' => [
818 'px' => [
819 'min' => 0,
820 'max' => 100,
821 'step' => 1,
822 ],
823 ],
824 'selectors' => [
825 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-slider-item' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}}; padding-bottom: calc({{SIZE}}{{UNIT}} * 2)',
826 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
827 ],
828 'condition' => [
829 'enable_related_slider!' => 'yes',
830 ],
831 ]
832 );
833 }
834
835 $ref->add_responsive_control(
836 $prefix . '_offset_col_width',
837 [
838 'label' => esc_html__( 'Offset Column Width', 'the-post-grid' ),
839 'type' => Controls_Manager::SLIDER,
840 'size_units' => [ '%' ],
841 'range' => [
842 'px' => [
843 'min' => 30,
844 'max' => 70,
845 'step' => 1,
846 ],
847 '%' => [
848 'min' => 30,
849 'max' => 70,
850 'step' => 1,
851 ],
852 ],
853 'selectors' => [
854 '{{WRAPPER}} .tpg-el-main-wrapper .offset-left' => 'width: {{SIZE}}%;',
855 '{{WRAPPER}} .tpg-el-main-wrapper .offset-right' => 'width: calc( 100% - {{SIZE}}%);',
856 ],
857 'condition' => [
858 $prefix . '_layout' => [
859 'grid-layout5',
860 'grid-layout5-2',
861 'grid-layout6',
862 'grid-layout6-2',
863 'grid_hover-layout4',
864 'grid_hover-layout4-2',
865 'grid_hover-layout5',
866 'grid_hover-layout5-2',
867 'grid_hover-layout6',
868 'grid_hover-layout6-2',
869 'grid_hover-layout7',
870 'grid_hover-layout7-2',
871 'grid_hover-layout9',
872 'grid_hover-layout9-2',
873 ],
874 ],
875 ]
876 );
877
878 if ( 'grid' === $prefix ) {
879 $layout_style_opt = [
880 'tpg-even' => esc_html__( 'Grid', 'the-post-grid' ),
881 'tpg-full-height' => esc_html__( 'Grid Equal Height', 'the-post-grid' ),
882 ];
883 if ( rtTPG()->hasPro() ) {
884 $layout_style_new_opt = [
885 'masonry' => esc_html__( 'Masonry', 'the-post-grid' ),
886 ];
887 $layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt );
888 }
889
890 $ref->add_control(
891 $prefix . '_layout_style',
892 [
893 'label' => esc_html__( 'Layout Style', 'the-post-grid' ),
894 'type' => Controls_Manager::SELECT,
895 'default' => 'tpg-full-height',
896 'options' => $layout_style_opt,
897 'description' => esc_html__( 'If you use card border then equal height will work. ', 'the-post-grid' ) . $ref->get_pro_message( 'masonry layout' ),
898 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field',
899 'condition' => [
900 $prefix . '_layout!' => [
901 'grid-layout2',
902 'grid-layout5',
903 'grid-layout5-2',
904 'grid-layout6',
905 'grid-layout6-2',
906 'grid-layout7',
907 'grid-layout7-2',
908 ],
909 ],
910 ]
911 );
912 }
913
914 if ( ! in_array( $prefix, [ 'slider' ] ) ) {
915 $layout_align_css = [
916 '{{WRAPPER}} .rt-tpg-container .grid-layout2 .rt-holder .post-right-content' => 'justify-content: {{VALUE}};',
917 ];
918
919 if ( $prefix === 'grid_hover' ) {
920 $layout_align_css = [
921 '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'justify-content: {{VALUE}};',
922 ];
923 }
924
925 // Grid layout
926 $ref->add_control(
927 $prefix . '_layout_alignment',
928 [
929 'label' => esc_html__( 'Vertical Align', 'the-post-grid' ),
930 'type' => Controls_Manager::SELECT,
931 'options' => [
932 '' => esc_html__( 'Default', 'the-post-grid' ),
933 'flex-start' => esc_html__( 'Start', 'the-post-grid' ),
934 'center' => esc_html__( 'Center', 'the-post-grid' ),
935 'flex-end' => esc_html__( 'End', 'the-post-grid' ),
936 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ),
937 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ),
938 ],
939 'condition' => [
940 $prefix . '_layout!' => [
941 'grid-layout1',
942 'grid-layout3',
943 'grid-layout4',
944 'grid-layout5',
945 'grid-layout5-2',
946 'grid-layout6',
947 'grid-layout6-2',
948 'grid-layout7',
949 ],
950 ],
951 'selectors' => $layout_align_css,
952 ]
953 );
954 }
955
956 if ( $prefix === 'slider' ) {
957 // Grid layout
958 $ref->add_control(
959 $prefix . '_layout_alignment_2',
960 [
961 'label' => esc_html__( 'Vertical Align', 'the-post-grid' ),
962 'type' => Controls_Manager::SELECT,
963 'options' => [
964 '' => esc_html__( 'Default', 'the-post-grid' ),
965 'flex-start' => esc_html__( 'Start', 'the-post-grid' ),
966 'center' => esc_html__( 'Center', 'the-post-grid' ),
967 'flex-end' => esc_html__( 'End', 'the-post-grid' ),
968 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ),
969 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ),
970 ],
971 'condition' => [
972 $prefix . '_layout!' => [
973 'slider-layout1',
974 'slider-layout2',
975 'slider-layout3',
976 'slider-layout13',
977 'slider-layout4',
978 ],
979 ],
980 'selectors' => [
981 '{{WRAPPER}} .tpg-el-main-wrapper .grid-behaviour .rt-holder .rt-el-content-wrapper .gallery-content' => 'justify-content: {{VALUE}};height:100%;',
982 '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'justify-content: {{VALUE}};',
983 ],
984 ]
985 );
986 }
987
988 $ref->add_responsive_control(
989 'full_wrapper_align',
990 [
991 'label' => esc_html__( 'Text Align', 'the-post-grid' ),
992 'type' => Controls_Manager::CHOOSE,
993 'options' => [
994 'left' => [
995 'title' => esc_html__( 'Left', 'the-post-grid' ),
996 'icon' => 'eicon-text-align-left',
997 ],
998 'center' => [
999 'title' => esc_html__( 'Center', 'the-post-grid' ),
1000 'icon' => 'eicon-text-align-center',
1001 ],
1002 'right' => [
1003 'title' => esc_html__( 'Right', 'the-post-grid' ),
1004 'icon' => 'eicon-text-align-right',
1005 ],
1006 ],
1007 'prefix_class' => 'tpg-wrapper-align-',
1008 'render_type' => 'template',
1009 'toggle' => true,
1010 'selectors' => [
1011 '{{WRAPPER}} .tpg-post-holder div' => 'text-align: {{VALUE}};',
1012 '{{WRAPPER}} .rt-tpg-container .rt-el-post-meta' => 'justify-content: {{VALUE}};',
1013 ],
1014 'condition' => [
1015 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
1016 ],
1017
1018 ]
1019 );
1020
1021 $ref->add_control(
1022 'block_primary_color',
1023 [
1024 'type' => Controls_Manager::COLOR,
1025 'label' => esc_html__( 'Primary Color', 'raw-addons' ),
1026 'selectors' => [
1027 '{{WRAPPER}} .tpg-el-main-wrapper' => '--tpg-primary-color: {{VALUE}}',
1028 ],
1029 'separator' => 'before',
1030 ]
1031 );
1032 $ref->add_control(
1033 'block_secondary_color',
1034 [
1035 'type' => Controls_Manager::COLOR,
1036 'label' => esc_html__( 'Secondary Color', 'raw-addons' ),
1037 'selectors' => [
1038 '{{WRAPPER}} .tpg-el-main-wrapper' => '--tpg-secondary-color: {{VALUE}}',
1039 ],
1040 ]
1041 );
1042
1043 $ref->end_controls_section();
1044 }
1045
1046 /**
1047 * Front-end Filter Settings
1048 *
1049 * @param $ref
1050 */
1051 public static function filter_settings( $ref ) {
1052 $prefix = $ref->prefix;
1053
1054 if ( ! rtTPG()->hasPro() ) {
1055 return;
1056 }
1057 $ref->start_controls_section(
1058 $prefix . '_filter_settings',
1059 [
1060 'label' => esc_html__( 'Filter (Front-end)', 'the-post-grid' ),
1061 'tab' => Controls_Manager::TAB_CONTENT,
1062 ]
1063 );
1064
1065 $ref->add_control(
1066 'show_taxonomy_filter',
1067 [
1068 'label' => esc_html__( 'Taxonomy Filter', 'the-post-grid' ),
1069 'type' => Controls_Manager::SWITCHER,
1070 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1071 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1072 'return_value' => 'show',
1073 'default' => 'hide',
1074 ]
1075 );
1076
1077 $ref->add_control(
1078 'show_author_filter',
1079 [
1080 'label' => esc_html__( 'Author filter', 'the-post-grid' ),
1081 'type' => Controls_Manager::SWITCHER,
1082 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1083 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1084 'return_value' => 'show',
1085 'default' => 'hide',
1086 ]
1087 );
1088
1089 $ref->add_control(
1090 'show_order_by',
1091 [
1092 'label' => esc_html__( 'Order By Filter', 'the-post-grid' ),
1093 'type' => Controls_Manager::SWITCHER,
1094 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1095 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1096 'return_value' => 'show',
1097 'default' => 'hide',
1098 ]
1099 );
1100
1101 $ref->add_control(
1102 'show_sort_order',
1103 [
1104 'label' => esc_html__( 'Sort Order Filter', 'the-post-grid' ),
1105 'type' => Controls_Manager::SWITCHER,
1106 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1107 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1108 'return_value' => 'show',
1109 'default' => 'hide',
1110 ]
1111 );
1112
1113 $ref->add_control(
1114 'show_search',
1115 [
1116 'label' => esc_html__( 'Search filter', 'the-post-grid' ),
1117 'type' => Controls_Manager::SWITCHER,
1118 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1119 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1120 'return_value' => 'show',
1121 'default' => 'hide',
1122 ]
1123 );
1124
1125 $ref->add_control(
1126 'search_by',
1127 [
1128 'label' => esc_html__( 'Search By', 'the-post-grid' ),
1129 'type' => Controls_Manager::SELECT,
1130 'default' => 'all_content',
1131 'options' => [
1132 'all_content' => esc_html__( 'All Content', 'the-post-grid' ),
1133 'title' => esc_html__( 'Title only', 'the-post-grid' ),
1134 ],
1135 'condition' => [ 'show_search' => 'show' ],
1136 ]
1137 );
1138
1139 // Filter Settings
1140 // ======================================================
1141
1142 $front_end_filter_condition = [
1143 'relation' => 'or',
1144 'terms' => [
1145 [
1146 'name' => 'show_taxonomy_filter',
1147 'operator' => '==',
1148 'value' => 'show',
1149 ],
1150 [
1151 'name' => 'show_author_filter',
1152 'operator' => '==',
1153 'value' => 'show',
1154 ],
1155 [
1156 'name' => 'show_order_by',
1157 'operator' => '==',
1158 'value' => 'show',
1159 ],
1160 [
1161 'name' => 'show_sort_order',
1162 'operator' => '==',
1163 'value' => 'show',
1164 ],
1165 [
1166 'name' => 'show_search',
1167 'operator' => '==',
1168 'value' => 'show',
1169 ],
1170 ],
1171 ];
1172
1173 $ref->add_control(
1174 'filter_type',
1175 [
1176 'label' => esc_html__( 'Filter Type', 'the-post-grid' ),
1177 'type' => Controls_Manager::SELECT,
1178 'default' => 'dropdown',
1179 'options' => [
1180 'dropdown' => esc_html__( 'Dropdown', 'the-post-grid' ),
1181 'button' => esc_html__( 'Button', 'the-post-grid' ),
1182 ],
1183 'render_type' => 'template',
1184 'prefix_class' => 'tpg-filter-type-',
1185 'conditions' => $front_end_filter_condition,
1186 'separator' => 'before',
1187 ]
1188 );
1189
1190 $ref->add_control(
1191 'multiple_taxonomy',
1192 [
1193 'label' => esc_html__( 'Multiple Taxonomy', 'the-post-grid' ),
1194 'type' => Controls_Manager::SWITCHER,
1195 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1196 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1197 'description' => esc_html__( 'Enable multiple taxonomy filter', 'the-post-grid' ),
1198 'return_value' => 'yes',
1199 'default' => false,
1200 'conditions' => $front_end_filter_condition,
1201 'condition' => [
1202 'show_taxonomy_filter' => 'show',
1203 ],
1204 ]
1205 );
1206
1207
1208 $post_types = Fns::get_post_types();
1209 $_all_taxonomies = [];
1210
1211 foreach ( $post_types as $post_type => $label ) {
1212 $_taxonomies = get_object_taxonomies( $post_type, 'object' );
1213 if ( empty( $_taxonomies ) ) {
1214 continue;
1215 }
1216 $taxonomies_list = [];
1217 foreach ( $_taxonomies as $tax ) {
1218 if ( in_array(
1219 $tax->name,
1220 [
1221 'post_format',
1222 'elementor_library_type',
1223 'product_visibility',
1224 'product_shipping_class',
1225 ]
1226 ) ) {
1227 continue;
1228 }
1229 // if ( in_array( $tax->name, $_all_taxonomies ) ) {
1230 // continue;
1231 // }
1232
1233 $taxonomies_list[ $tax->name ] = $tax->label;
1234 $_all_taxonomies[] = $tax->name;
1235 }
1236
1237 if ( 'post' === $post_type ) {
1238 $default_cat = 'category';
1239 } elseif ( 'product' === $post_type ) {
1240 $default_cat = 'product_cat';
1241 } elseif ( 'download' === $post_type ) {
1242 $default_cat = 'download_category';
1243 } elseif ( 'docs' === $post_type ) {
1244 $default_cat = 'doc_category';
1245 } elseif ( 'lp_course' === $post_type ) {
1246 $default_cat = 'course_category';
1247 } else {
1248 $taxonomie_keys = array_keys( $_taxonomies );
1249 $filter_cat = array_filter(
1250 $taxonomie_keys,
1251 function ( $item ) {
1252 return strpos( $item, 'cat' ) !== false;
1253 }
1254 );
1255
1256 if ( is_array( $filter_cat ) && ! empty( $filter_cat ) ) {
1257 $default_cat = array_shift( $filter_cat );
1258 }
1259 }
1260
1261 $ref->add_control(
1262 $post_type . '_filter_taxonomy',
1263 [
1264 'label' => esc_html__( 'Choose Taxonomy', 'the-post-grid' ),
1265 'type' => Controls_Manager::SELECT,
1266 'default' => $default_cat,
1267 'options' => $taxonomies_list,
1268 'condition' => [
1269 'post_type' => $post_type,
1270 'show_taxonomy_filter' => 'show',
1271 'multiple_taxonomy!' => 'yes',
1272 ],
1273 'description' => esc_html__( 'Select a taxonomy for showing in filter', 'the-post-grid' ),
1274 ]
1275 );
1276
1277 $ref->add_control(
1278 $post_type . '_filter_taxonomies',
1279 [
1280 'label' => esc_html__( 'Choose Taxonomies', 'the-post-grid' ),
1281 'type' => Controls_Manager::SELECT2,
1282 'multiple' => true,
1283 'default' => $default_cat,
1284 'options' => $taxonomies_list,
1285 'condition' => [
1286 'post_type' => $post_type,
1287 'show_taxonomy_filter' => 'show',
1288 'multiple_taxonomy' => 'yes',
1289 ],
1290 'description' => esc_html__( 'Select a taxonomies for showing in filter', 'the-post-grid' ),
1291 ]
1292 );
1293
1294 foreach ( $_taxonomies as $tax ) {
1295 if ( in_array(
1296 $tax->name,
1297 [
1298 'post_format',
1299 'elementor_library_type',
1300 'product_visibility',
1301 'product_shipping_class',
1302 ]
1303 ) ) {
1304 continue;
1305 }
1306 // if ( in_array( $tax->name, $_all_taxonomies ) ) {
1307 // continue;
1308 // }
1309
1310 $term_first = [ '0' => esc_html__( '--Select--', 'the-post-grid' ) ];
1311 $term_lists = get_terms(
1312 [
1313 'taxonomy' => $tax->name, // Custom taxonomy name.
1314 'hide_empty' => true,
1315 'fields' => 'id=>name',
1316 ]
1317 );
1318
1319 $term_lists = $term_first + $term_lists;
1320
1321 $terms_prefix = '';
1322 if ( 'post' != $post_type ) {
1323 $terms_prefix = $post_type . '_';
1324 }
1325 $terms_prefix .= $tax->name;
1326
1327 $ref->add_control(
1328 $terms_prefix . '_default_terms',
1329 [
1330 'label' => esc_html__( 'Selected ', 'the-post-grid' ) . $tax->label,
1331 'type' => Controls_Manager::SELECT,
1332 'default' => '0',
1333 'options' => $term_lists,
1334 'condition' => [
1335 $post_type . '_filter_taxonomy' => $tax->name,
1336 'post_type' => $post_type,
1337 'show_taxonomy_filter' => 'show',
1338 'multiple_taxonomy!' => 'yes',
1339 ],
1340 ]
1341 );
1342 }
1343 }
1344
1345 $ref->add_control(
1346 'multi_tax_relation',
1347 [
1348 'label' => esc_html__( 'Relation between taxonomies', 'the-post-grid' ),
1349 'description' => esc_html__( 'If you choose AND need to match all taxonomy. Choose OR for match anyone', 'the-post-grid' ),
1350 'type' => Controls_Manager::SELECT,
1351 'default' => 'OR',
1352 'options' => [
1353 'OR' => __( 'OR', 'the-post-grid' ),
1354 'AND' => __( 'AND', 'the-post-grid' ),
1355 ],
1356 'condition' => [
1357 'multiple_taxonomy' => 'yes',
1358 ],
1359 ]
1360 );
1361
1362 $ref->add_control(
1363 'tax_filter_search',
1364 [
1365 'label' => esc_html__( 'Taxonomy Filter Search', 'the-post-grid' ),
1366 'type' => Controls_Manager::SWITCHER,
1367 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1368 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1369 'description' => esc_html__( 'Add a search field to filter taxonomy terms when you have many terms.', 'the-post-grid' ),
1370 'return_value' => 'yes',
1371 'default' => false,
1372 'condition' => [
1373 'show_taxonomy_filter' => 'show',
1374 ],
1375 ]
1376 );
1377
1378 $ref->add_control(
1379 'tax_filter_clear_btn',
1380 [
1381 'label' => esc_html__( 'Dropdown Clear Button', 'the-post-grid' ),
1382 'type' => Controls_Manager::SWITCHER,
1383 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1384 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1385 'description' => esc_html__( 'Show a clear button on dropdown filters to quickly reset the selection.', 'the-post-grid' ),
1386 'return_value' => 'yes',
1387 'default' => false,
1388 'condition' => [
1389 'show_taxonomy_filter' => 'show',
1390 'filter_type' => 'dropdown',
1391 ],
1392 ]
1393 );
1394
1395 $ref->add_control(
1396 'filter_btn_style',
1397 [
1398 'label' => esc_html__( 'Filter Style', 'the-post-grid' ),
1399 'type' => Controls_Manager::SELECT,
1400 'default' => 'default',
1401 'options' => [
1402 'default' => esc_html__( 'Default', 'the-post-grid' ),
1403 'carousel' => esc_html__( 'Collapsable', 'the-post-grid' ),
1404 ],
1405 'condition' => [
1406 'filter_type' => 'button',
1407 'multiple_taxonomy!' => 'yes',
1408 ],
1409 'conditions' => $front_end_filter_condition,
1410 'description' => esc_html__( 'If you use collapsable then only taxonomy section will show on the filter', 'the-post-grid' ),
1411 ]
1412 );
1413
1414 $ref->add_responsive_control(
1415 'filter_btn_item_per_page',
1416 [
1417 'label' => esc_html__( 'Button Item Per Slider', 'the-post-grid' ),
1418 'type' => Controls_Manager::SELECT,
1419 'options' => [
1420 'auto' => esc_html__( 'Auto', 'the-post-grid' ),
1421 '2' => esc_html__( '2', 'the-post-grid' ),
1422 '3' => esc_html__( '3', 'the-post-grid' ),
1423 '4' => esc_html__( '4', 'the-post-grid' ),
1424 '5' => esc_html__( '5', 'the-post-grid' ),
1425 '6' => esc_html__( '6', 'the-post-grid' ),
1426 '7' => esc_html__( '7', 'the-post-grid' ),
1427 '8' => esc_html__( '8', 'the-post-grid' ),
1428 '9' => esc_html__( '9', 'the-post-grid' ),
1429 '10' => esc_html__( '10', 'the-post-grid' ),
1430 '11' => esc_html__( '11', 'the-post-grid' ),
1431 '12' => esc_html__( '12', 'the-post-grid' ),
1432 ],
1433 'default' => 'auto',
1434 'tablet_default' => 'auto',
1435 'mobile_default' => 'auto',
1436 'condition' => [
1437 'filter_type' => 'button',
1438 'filter_btn_style' => 'carousel',
1439 ],
1440 'conditions' => $front_end_filter_condition,
1441 'description' => esc_html__( 'If you use carousel then only category section show on the filter', 'the-post-grid' ),
1442 ]
1443 );
1444
1445 $front_end_filter_tax_condition = [
1446 'relation' => 'or',
1447 'terms' => [
1448 [
1449 'name' => 'show_taxonomy_filter',
1450 'operator' => '==',
1451 'value' => 'show',
1452 ],
1453 [
1454 'name' => 'show_author_filter',
1455 'operator' => '==',
1456 'value' => 'show',
1457 ],
1458 ],
1459 ];
1460
1461 $ref->add_control(
1462 'filter_post_count',
1463 [
1464 'label' => esc_html__( 'Filter Post Count', 'the-post-grid' ),
1465 'type' => Controls_Manager::SELECT,
1466 'default' => 'no',
1467 'options' => [
1468 'yes' => esc_html__( 'Yes', 'the-post-grid' ),
1469 'no' => esc_html__( 'No', 'the-post-grid' ),
1470 ],
1471 'conditions' => $front_end_filter_tax_condition,
1472 ]
1473 );
1474
1475 $ref->add_control(
1476 'tgp_filter_taxonomy_hierarchical',
1477 [
1478 'label' => esc_html__( 'Tax Hierarchical', 'the-post-grid' ),
1479 'type' => Controls_Manager::SWITCHER,
1480 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
1481 'label_off' => esc_html__( 'No', 'the-post-grid' ),
1482 'return_value' => 'yes',
1483 'default' => 'yes',
1484 'conditions' => $front_end_filter_tax_condition,
1485 'condition' => [
1486 'filter_type' => 'button',
1487 'filter_btn_style' => 'default',
1488 ],
1489 ]
1490 );
1491
1492 $ref->add_control(
1493 'tpg_hide_all_button',
1494 [
1495 'label' => esc_html__( 'Hide "Show all" button', 'the-post-grid' ),
1496 'type' => Controls_Manager::SWITCHER,
1497 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1498 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1499 'return_value' => 'yes',
1500 'default' => 'yes',
1501 'conditions' => $front_end_filter_tax_condition,
1502 'condition' => [
1503 'filter_type' => 'button',
1504 ],
1505 ]
1506 );
1507
1508 $ref->add_control(
1509 'custom_taxonomy_order',
1510 [
1511 'label' => esc_html__( 'Taxonomy Order', 'the-post-grid' ),
1512 'type' => Controls_Manager::SWITCHER,
1513 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1514 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1515 'return_value' => 'yes',
1516 'default' => false,
1517 'description' => esc_html__( 'You must sort taxonomy from the dashboard first.', 'the-post-grid' ),
1518 'condition' => [
1519 'show_taxonomy_filter' => 'show',
1520 ],
1521 ]
1522 );
1523
1524 $ref->add_control(
1525 'tax_filter_all_text',
1526 [
1527 'label' => esc_html__( 'All Taxonomy Text', 'the-post-grid' ),
1528 'type' => Controls_Manager::TEXT,
1529 'placeholder' => esc_html__( 'Enter All Category Text Here..', 'the-post-grid' ),
1530 'conditions' => $front_end_filter_tax_condition,
1531 ]
1532 );
1533
1534 $ref->add_control(
1535 'tax_filter_all_text2',
1536 [
1537 'label' => esc_html__( 'All Taxonomy Text 2', 'the-post-grid' ),
1538 'type' => Controls_Manager::TEXT,
1539 'placeholder' => esc_html__( 'Enter All Tax 2 Here..', 'the-post-grid' ),
1540 'description' => esc_html__( 'This is optional. If you need you can change for 2nd taxonomy.', 'the-post-grid' ),
1541 'condition' => [
1542 'multiple_taxonomy' => 'yes',
1543 ],
1544 ]
1545 );
1546
1547 $ref->add_control(
1548 'tax_filter_all_text3',
1549 [
1550 'label' => esc_html__( 'All Taxonomy Text 3', 'the-post-grid' ),
1551 'type' => Controls_Manager::TEXT,
1552 'placeholder' => esc_html__( 'Enter All Tax 3 Here..', 'the-post-grid' ),
1553 'description' => esc_html__( 'This is optional. If you need you can change for 3rd taxonomy.', 'the-post-grid' ),
1554 'condition' => [
1555 'multiple_taxonomy' => 'yes',
1556 ],
1557 ]
1558 );
1559
1560 $ref->add_control(
1561 'author_filter_all_text',
1562 [
1563 'label' => esc_html__( 'All Users Text', 'the-post-grid' ),
1564 'type' => Controls_Manager::TEXT,
1565 'placeholder' => esc_html__( 'Enter All Users Text Here..', 'the-post-grid' ),
1566 'condition' => [
1567 'show_author_filter' => 'show',
1568 'filter_btn_style' => 'default',
1569 ],
1570 ]
1571 );
1572
1573 $ref->add_control(
1574 'filter_preloader',
1575 [
1576 'label' => esc_html__( 'Filter Preloader?', 'the-post-grid' ),
1577 'type' => Controls_Manager::SELECT,
1578 'default' => 'on',
1579 'options' => [
1580 'on' => esc_html__( 'On', 'the-post-grid' ),
1581 'off' => esc_html__( 'Off', 'the-post-grid' ),
1582 ],
1583 'prefix_class' => 'filter-preloader-',
1584 'conditions' => $front_end_filter_condition,
1585 ]
1586 );
1587
1588 $ref->end_controls_section();
1589 }
1590
1591 /**
1592 * List Layout Settings
1593 *
1594 * @param $ref
1595 */
1596 public static function list_layouts( $ref, $layout_type = '' ) {
1597 $prefix = $ref->prefix;
1598 $ref->start_controls_section(
1599 'list_layout_settings',
1600 [
1601 'label' => esc_html__( 'Layout', 'the-post-grid' ),
1602 'tab' => Controls_Manager::TAB_CONTENT,
1603 ]
1604 );
1605
1606 $ref->add_control(
1607 'list_layout',
1608 [
1609 'label' => esc_html__( 'Choose Layout', 'the-post-grid' ),
1610 'type' => Controls_Manager::CHOOSE,
1611 'label_block' => true,
1612 'options' => [
1613 'list-layout1' => [
1614 'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
1615 ],
1616 'list-layout2' => [
1617 'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
1618 ],
1619 'list-layout2-2' => [
1620 'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
1621 ],
1622 'list-layout3' => [
1623 'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
1624 ],
1625 'list-layout3-2' => [
1626 'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
1627 ],
1628 'list-layout4' => [
1629 'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
1630 ],
1631 'list-layout5' => [
1632 'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
1633 ],
1634 ],
1635 'toggle' => false,
1636 'default' => 'list-layout1',
1637 'style_transfer' => true,
1638 'classes' => 'tpg-image-select list-layout ' . $ref->is_post_layout,
1639 ]
1640 );
1641
1642 $ref->add_control(
1643 'layout_options_heading2',
1644 [
1645 'label' => esc_html__( 'Layout Options:', 'the-post-grid' ),
1646 'type' => Controls_Manager::HEADING,
1647 'classes' => 'tpg-control-type-heading',
1648 ]
1649 );
1650
1651 $ref->add_responsive_control(
1652 'list_column',
1653 [
1654 'label' => esc_html__( 'Column', 'the-post-grid' ),
1655 'type' => Controls_Manager::SELECT,
1656 'options' => [
1657 '0' => esc_html__( 'Default from layout', 'the-post-grid' ),
1658 '12' => esc_html__( '1 Columns', 'the-post-grid' ),
1659 '6' => esc_html__( '2 Columns', 'the-post-grid' ),
1660 '4' => esc_html__( '3 Columns', 'the-post-grid' ),
1661 '3' => esc_html__( '4 Columns', 'the-post-grid' ),
1662 ],
1663 'default' => '0',
1664 'tablet_default' => '0',
1665 'mobile_default' => '0',
1666 'description' => esc_html__( 'Choose Column for layout', 'the-post-grid' ),
1667 'condition' => [
1668 'list_layout!' => [
1669 'list-layout2',
1670 'list-layout2-2',
1671 'list-layout3',
1672 'list-layout3-2',
1673 'list-layout4',
1674 ],
1675 ],
1676 ]
1677 );
1678
1679 $ref->add_responsive_control(
1680 'list_layout_alignment',
1681 [
1682 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ),
1683 'type' => Controls_Manager::SELECT,
1684 'options' => [
1685 '' => esc_html__( 'Default', 'the-post-grid' ),
1686 'flex-start' => esc_html__( 'Start', 'the-post-grid' ),
1687 'center' => esc_html__( 'Center', 'the-post-grid' ),
1688 'flex-end' => esc_html__( 'End', 'the-post-grid' ),
1689 'space-around' => esc_html__( 'Space Around', 'the-post-grid' ),
1690 'space-between' => esc_html__( 'Space Between', 'the-post-grid' ),
1691 ],
1692 'selectors' => [
1693 '{{WRAPPER}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper' => 'align-items: {{VALUE}};',
1694 ],
1695 'condition' => [
1696 'list_layout!' => [ 'list-layout2', 'list-layout2-2' ],
1697 ],
1698 ]
1699 );
1700
1701 $ref->add_responsive_control(
1702 'list_flex_direction',
1703 [
1704 'label' => esc_html__( 'Flex Direction', 'the-post-grid' ),
1705 'type' => Controls_Manager::SELECT,
1706 'options' => [
1707 '' => esc_html__( 'Default', 'the-post-grid' ),
1708 'row-reverse' => esc_html__( 'Row Reverse', 'the-post-grid' ),
1709 'column' => esc_html__( 'Column', 'the-post-grid' ),
1710 'column-reverse' => esc_html__( 'Column Reverse', 'the-post-grid' ),
1711 ],
1712 'condition' => [
1713 'list_layout' => [
1714 'list-layout1',
1715 'list-layout5',
1716 ],
1717 ],
1718 'selectors' => [
1719 '{{WRAPPER}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper' => 'flex-direction: {{VALUE}};',
1720 ],
1721 ]
1722 );
1723
1724 $ref->add_responsive_control(
1725 'list_left_side_width',
1726 [
1727 'label' => esc_html__( 'Offset Width', 'the-post-grid' ),
1728 'type' => Controls_Manager::SLIDER,
1729 'size_units' => [ '%' ],
1730 'range' => [
1731 'px' => [
1732 'min' => 0,
1733 'max' => 700,
1734 'step' => 5,
1735 ],
1736 '%' => [
1737 'min' => 0,
1738 'max' => 100,
1739 ],
1740 ],
1741 'selectors' => [
1742 '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper .offset-left' => 'width: {{SIZE}}%;',
1743 '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper .offset-right' => 'width: calc( 100% - {{SIZE}}%);',
1744 ],
1745 'condition' => [
1746 'list_layout' => [ 'list-layout2', 'list-layout3', 'list-layout2-2', 'list-layout3-2' ],
1747 ],
1748 ]
1749 );
1750
1751 $layout_style_opt = [
1752 // translators: %s represents the prefix.
1753 'tpg-even' => sprintf( esc_html__( '%s Default', 'the-post-grid' ), ucwords( $ref->prefix ) ),
1754 ];
1755 if ( rtTPG()->hasPro() ) {
1756 $layout_style_new_opt = [
1757 'masonry' => esc_html__( 'Masonry', 'the-post-grid' ),
1758 ];
1759 $layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt );
1760 }
1761
1762 $ref->add_control(
1763 'list_layout_style',
1764 [
1765 'label' => esc_html__( 'Layout Style', 'the-post-grid' ),
1766 'type' => Controls_Manager::SELECT,
1767 'default' => 'tpg-even',
1768 'options' => $layout_style_opt,
1769 'description' => $ref->get_pro_message( 'masonry layout' ),
1770 'condition' => [
1771 'list_layout' => [ 'list-layout1', 'list-layout5' ],
1772 'list_column!' => [ '0', '12' ],
1773 ],
1774 ]
1775 );
1776
1777 $ref->add_responsive_control(
1778 'full_wrapper_align',
1779 [
1780 'label' => esc_html__( 'Text Align', 'the-post-grid' ),
1781 'type' => Controls_Manager::CHOOSE,
1782 'options' => [
1783 'left' => [
1784 'title' => esc_html__( 'Left', 'the-post-grid' ),
1785 'icon' => 'eicon-text-align-left',
1786 ],
1787 'center' => [
1788 'title' => esc_html__( 'Center', 'the-post-grid' ),
1789 'icon' => 'eicon-text-align-center',
1790 ],
1791 'right' => [
1792 'title' => esc_html__( 'Right', 'the-post-grid' ),
1793 'icon' => 'eicon-text-align-right',
1794 ],
1795 ],
1796 'selectors' => [
1797 '{{WRAPPER}} .tpg-post-holder div' => 'text-align: {{VALUE}};',
1798 ],
1799 'render_type' => 'template',
1800 'prefix_class' => 'tpg-wrapper-align-',
1801 'toggle' => true,
1802 ]
1803 );
1804
1805 $ref->add_control(
1806 'block_primary_color',
1807 [
1808 'type' => Controls_Manager::COLOR,
1809 'label' => esc_html__( 'Primary Color', 'raw-addons' ),
1810 'selectors' => [
1811 '{{WRAPPER}} .tpg-el-main-wrapper' => '--tpg-primary-color: {{VALUE}}',
1812 ],
1813 'separator' => 'before',
1814 ]
1815 );
1816 $ref->add_control(
1817 'block_secondary_color',
1818 [
1819 'type' => Controls_Manager::COLOR,
1820 'label' => esc_html__( 'Secondary Color', 'raw-addons' ),
1821 'selectors' => [
1822 '{{WRAPPER}} .tpg-el-main-wrapper' => '--tpg-secondary-color: {{VALUE}}',
1823 ],
1824 ]
1825 );
1826
1827 $ref->end_controls_section();
1828 }
1829
1830 /**
1831 * Pagination and Load more style tab
1832 *
1833 * @param $ref
1834 * @param bool $is_print
1835 */
1836 public static function pagination_settings( $ref, $layout_type = '' ) {
1837 $ref->start_controls_section(
1838 'pagination_settings',
1839 [
1840 'label' => esc_html__( 'Pagination', 'the-post-grid' ),
1841 'tab' => Controls_Manager::TAB_CONTENT,
1842 ]
1843 );
1844
1845 $ref->add_control(
1846 'show_pagination',
1847 [
1848 'label' => esc_html__( 'Show Pagination', 'the-post-grid' ),
1849 'type' => Controls_Manager::SWITCHER,
1850 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1851 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1852 'return_value' => 'show',
1853 'default' => 'default',
1854 'render_type' => 'template',
1855 // 'prefix_class' => 'pagination-visibility-',
1856 ]
1857 );
1858
1859 $default_pagination = 'pagination';
1860 if ( 'archive' == $layout_type ) {
1861 $pagination_type = [];
1862 $default_pagination = 'pagination_ajax';
1863 } else {
1864 $pagination_type = [
1865 'pagination' => esc_html__( 'Default Pagination', 'the-post-grid' ),
1866 ];
1867 }
1868
1869 if ( rtTPG()->hasPro() ) {
1870 $pagination_type_pro = [
1871 'pagination_ajax' => esc_html__( 'Ajax Pagination ( Only for Grid )', 'the-post-grid' ),
1872 'load_more' => esc_html__( 'Load More - On Click', 'the-post-grid' ),
1873 'load_on_scroll' => esc_html__( 'Load On Scroll', 'the-post-grid' ),
1874 ];
1875 $pagination_type = array_merge( $pagination_type, $pagination_type_pro );
1876 }
1877
1878 $ref->add_control(
1879 'pagination_type',
1880 [
1881 'label' => esc_html__( 'Pagination Type', 'the-post-grid' ),
1882 'type' => Controls_Manager::SELECT,
1883 'default' => $default_pagination,
1884 'options' => $pagination_type,
1885 'description' => $ref->get_pro_message( 'loadmore and ajax pagination' ),
1886 'condition' => [
1887 'show_pagination' => 'show',
1888 ],
1889 ]
1890 );
1891
1892 $ref->add_control(
1893 'ajax_pagination_type',
1894 [
1895 'label' => esc_html__( 'Enable Ajax Next Previous', 'the-post-grid' ),
1896 'type' => Controls_Manager::SWITCHER,
1897 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
1898 'label_off' => esc_html__( 'No', 'the-post-grid' ),
1899 'return_value' => 'yes',
1900 'default' => false,
1901 'condition' => [
1902 'pagination_type' => 'pagination_ajax',
1903 'show_pagination' => 'show',
1904 ],
1905 'prefix_class' => 'ajax-pagination-type-next-prev-',
1906 ]
1907 );
1908
1909 $ref->add_control(
1910 'load_more_button_text',
1911 [
1912 'label' => esc_html__( 'Button Text', 'the-post-grid' ),
1913 'type' => Controls_Manager::TEXT,
1914 'default' => esc_html__( 'Load More', 'the-post-grid' ),
1915 'condition' => [
1916 'pagination_type' => 'load_more',
1917 'show_pagination' => 'show',
1918 ],
1919 ]
1920 );
1921
1922 $ref->end_controls_section();
1923 }
1924
1925 /**
1926 * Get Field Selections
1927 *
1928 * @param $ref
1929 */
1930 public static function field_selection( $ref ) {
1931 $prefix = $ref->prefix;
1932 $ref->start_controls_section(
1933 'field_selection_settings',
1934 [
1935 'label' => esc_html__( 'Field Selection', 'the-post-grid' ),
1936 'tab' => Controls_Manager::TAB_SETTINGS,
1937 ]
1938 );
1939
1940 $ref->add_control(
1941 'show_section_title',
1942 [
1943 'label' => esc_html__( 'Section Title', 'the-post-grid' ),
1944 'type' => Controls_Manager::SWITCHER,
1945 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1946 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1947 'return_value' => 'show',
1948 'default' => 'show',
1949 'render_type' => 'template',
1950 // 'prefix_class' => 'section-title-visibility-',
1951 ]
1952 );
1953
1954 $ref->add_control(
1955 'show_title',
1956 [
1957 'label' => esc_html__( 'Post Title', 'the-post-grid' ),
1958 'type' => Controls_Manager::SWITCHER,
1959 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1960 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1961 'return_value' => 'show',
1962 'default' => 'show',
1963 'render_type' => 'template',
1964 // 'prefix_class' => 'title-visibility-',
1965 'condition' => [
1966 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
1967 ],
1968
1969 ]
1970 );
1971
1972 $ref->add_control(
1973 'show_thumb',
1974 [
1975 'label' => esc_html__( 'Post Thumbnail', 'the-post-grid' ),
1976 'type' => Controls_Manager::SWITCHER,
1977 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1978 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1979 'return_value' => 'show',
1980 'default' => 'show',
1981 'render_type' => 'template',
1982 // 'prefix_class' => 'thumbnail-visibility-',
1983 ]
1984 );
1985
1986 $ref->add_control(
1987 'show_excerpt',
1988 [
1989 'label' => esc_html__( 'Post Excerpt', 'the-post-grid' ),
1990 'type' => Controls_Manager::SWITCHER,
1991 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
1992 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
1993 'return_value' => 'show',
1994 'default' => 'show',
1995 'render_type' => 'template',
1996 // 'prefix_class' => 'excerpt-visibility-',
1997 'condition' => [
1998 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
1999 ],
2000 ]
2001 );
2002
2003 $ref->add_control(
2004 'show_meta',
2005 [
2006 'label' => esc_html__( 'Meta Data', 'the-post-grid' ),
2007 'type' => Controls_Manager::SWITCHER,
2008 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2009 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2010 'return_value' => 'show',
2011 'default' => 'show',
2012 'render_type' => 'template',
2013 'prefix_class' => 'meta-visibility-',
2014 'condition' => [
2015 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2016 ],
2017 ]
2018 );
2019
2020 $ref->add_control(
2021 'show_date',
2022 [
2023 'label' => esc_html__( 'Post Date', 'the-post-grid' ),
2024 'type' => Controls_Manager::SWITCHER,
2025 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2026 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2027 'return_value' => 'show',
2028 'default' => 'show',
2029 'render_type' => 'template',
2030 'classes' => 'tpg-padding-left',
2031 // 'prefix_class' => 'date-visibility-',
2032 'condition' => [
2033 'show_meta' => 'show',
2034 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2035 ],
2036 ]
2037 );
2038
2039 $ref->add_control(
2040 'show_category',
2041 [
2042 'label' => esc_html__( 'Post Categories', 'the-post-grid' ),
2043 'type' => Controls_Manager::SWITCHER,
2044 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2045 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2046 'return_value' => 'show',
2047 'default' => 'show',
2048 'render_type' => 'template',
2049 'classes' => 'tpg-padding-left',
2050 // 'prefix_class' => 'category-visibility-',
2051 'condition' => [
2052 'show_meta' => 'show',
2053 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2054 ],
2055 ]
2056 );
2057
2058 $ref->add_control(
2059 'show_author',
2060 [
2061 'label' => esc_html__( 'Post Author', 'the-post-grid' ),
2062 'type' => Controls_Manager::SWITCHER,
2063 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2064 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2065 'return_value' => 'show',
2066 'default' => 'show',
2067 'classes' => 'tpg-padding-left',
2068 'condition' => [
2069 'show_meta' => 'show',
2070 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2071 ],
2072 ]
2073 );
2074
2075 $ref->add_control(
2076 'show_tags',
2077 [
2078 'label' => esc_html__( 'Post Tags', 'the-post-grid' ),
2079 'type' => Controls_Manager::SWITCHER,
2080 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2081 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2082 'return_value' => 'show',
2083 'default' => false,
2084 'classes' => 'tpg-padding-left',
2085 'condition' => [
2086 'show_meta' => 'show',
2087 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2088 ],
2089 ]
2090 );
2091
2092 $ref->add_control(
2093 'show_comment_count',
2094 [
2095 'label' => esc_html__( 'Post Comment Count', 'the-post-grid' ),
2096 'type' => Controls_Manager::SWITCHER,
2097 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2098 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2099 'return_value' => 'show',
2100 'default' => false,
2101 'classes' => 'tpg-padding-left',
2102 'condition' => [
2103 'show_meta' => 'show',
2104 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2105 ],
2106 ]
2107 );
2108
2109 $ref->add_control(
2110 'show_post_count',
2111 [
2112 'label' => esc_html__( 'Post View Count', 'the-post-grid' ) . $ref->pro_label,
2113 'type' => Controls_Manager::SWITCHER,
2114 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2115 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2116 'return_value' => 'show',
2117 'default' => false,
2118 'classes' => rtTPG()->hasPro() ? 'tpg-padding-left' : 'the-post-grid-field-hide tpg-padding-left',
2119 'condition' => [
2120 'show_meta' => 'show',
2121 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2122 ],
2123 ]
2124 );
2125
2126 $ref->add_control(
2127 'show_read_more',
2128 [
2129 'label' => esc_html__( 'Read More Button', 'the-post-grid' ),
2130 'type' => Controls_Manager::SWITCHER,
2131 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2132 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2133 'return_value' => 'show',
2134 'default' => 'show',
2135 'condition' => [
2136 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2137 ],
2138 ]
2139 );
2140
2141 $ref->add_control(
2142 'show_event_date',
2143 [
2144 'label' => esc_html__( 'Event Date', 'the-post-grid' ) . $ref->pro_label,
2145 'type' => Controls_Manager::SWITCHER,
2146 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2147 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2148 'return_value' => 'on',
2149 'default' => false,
2150 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
2151 ]
2152 );
2153
2154 $ref->add_control(
2155 'show_social_share',
2156 [
2157 'label' => esc_html__( 'Social Share', 'the-post-grid' ) . $ref->pro_label,
2158 'type' => Controls_Manager::SWITCHER,
2159 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2160 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2161 'return_value' => 'show',
2162 'default' => 'default',
2163 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
2164 'condition' => [
2165 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2166 ],
2167 ]
2168 );
2169
2170 if ( Fns::is_woocommerce() ) {
2171 $ref->add_control(
2172 'show_woocommerce_rating',
2173 [
2174 'label' => __( 'Rating (WooCommerce)', 'the-post-grid' ),
2175 'type' => Controls_Manager::SWITCHER,
2176 'label_on' => __( 'Show', 'the-post-grid' ),
2177 'label_off' => __( 'Hide', 'the-post-grid' ),
2178 'return_value' => 'show',
2179 'default' => 'default',
2180 'condition' => [
2181 'post_type' => [ 'product', 'download' ],
2182 ],
2183 ]
2184 );
2185 }
2186
2187 $cf = Fns::is_acf();
2188 if ( $cf ) {
2189 $ref->add_control(
2190 'show_acf',
2191 [
2192 'label' => esc_html__( 'Advanced Custom Field', 'the-post-grid' ) . $ref->pro_label,
2193 'type' => Controls_Manager::SWITCHER,
2194 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2195 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2196 'return_value' => 'show',
2197 'default' => false,
2198 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
2199 'condition' => [
2200 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2201 ],
2202 ]
2203 );
2204 }
2205
2206 $ref->end_controls_section();
2207 }
2208
2209 /**
2210 * Section Title Settings
2211 *
2212 * @param $ref
2213 */
2214 public static function section_title_settings( $ref, $layout_type = '' ) {
2215 $default = ( 'single' == $layout_type ) ? esc_html__( 'Related Posts', 'the-post-grid' ) : esc_html__( 'Section Title', 'the-post-grid' );
2216 $ref->start_controls_section(
2217 'section_title_settings',
2218 [
2219 'label' => esc_html__( 'Section Title', 'the-post-grid' ),
2220 'tab' => Controls_Manager::TAB_SETTINGS,
2221 'condition' => [
2222 'show_section_title' => 'show',
2223 ],
2224 ]
2225 );
2226
2227 $ref->add_control(
2228 'section_title_style',
2229 [
2230 'label' => esc_html__( 'Section Title Style', 'the-post-grid' ),
2231 'type' => Controls_Manager::SELECT,
2232 'default' => 'style1',
2233 'options' => [
2234 'default' => esc_html__( 'Default - Text', 'the-post-grid' ),
2235 'style1' => esc_html__( 'Style 1 - Dot & Border', 'the-post-grid' ),
2236 'style2' => esc_html__( 'Style 2 - BG & Border', 'the-post-grid' ),
2237 'style3' => esc_html__( 'Style 3 - BG & Border - 2', 'the-post-grid' ),
2238 'style4' => esc_html__( 'Style 4 - Border Bottom', 'the-post-grid' ),
2239 ],
2240 'prefix_class' => 'section-title-style-',
2241 'render_type' => 'template',
2242 'condition' => [
2243 'show_section_title' => 'show',
2244 ],
2245 ]
2246 );
2247
2248 if ( 'single' === $layout_type ) {
2249 $ref->add_control(
2250 'section_title_source',
2251 [
2252 'label' => esc_html__( 'Title source', 'the-post-grid' ),
2253 'type' => Controls_Manager::HIDDEN,
2254 'default' => 'custom_title',
2255 ]
2256 );
2257 } else {
2258 $ref->add_control(
2259 'section_title_source',
2260 [
2261 'label' => esc_html__( 'Title Source', 'the-post-grid' ),
2262 'type' => Controls_Manager::SELECT,
2263 'default' => 'custom_title',
2264 'options' => [
2265 'page_title' => esc_html__( 'Page Title', 'the-post-grid' ),
2266 'custom_title' => esc_html__( 'Custom Title', 'the-post-grid' ),
2267 ],
2268 'condition' => [
2269 'show_section_title' => 'show',
2270 ],
2271 ]
2272 );
2273 }
2274
2275 $ref->add_control(
2276 'section_title_text',
2277 [
2278 'label' => esc_html__( 'Title', 'the-post-grid' ),
2279 'type' => Controls_Manager::TEXT,
2280 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ),
2281 'default' => $default,
2282 'label_block' => true,
2283 'condition' => [
2284 'section_title_source' => 'custom_title',
2285 'show_section_title' => 'show',
2286 ],
2287 ]
2288 );
2289
2290 $ref->add_control(
2291 'title_prefix',
2292 [
2293 'label' => esc_html__( 'Title Prefix Text', 'the-post-grid' ),
2294 'type' => Controls_Manager::TEXT,
2295 'placeholder' => esc_html__( 'Title prefix text', 'the-post-grid' ),
2296 'condition' => [
2297 'section_title_source' => 'page_title',
2298 ],
2299 ]
2300 );
2301
2302 $ref->add_control(
2303 'title_suffix',
2304 [
2305 'label' => esc_html__( 'Title Suffix Text', 'the-post-grid' ),
2306 'type' => Controls_Manager::TEXT,
2307 'placeholder' => esc_html__( 'Title suffix text', 'the-post-grid' ),
2308 'condition' => [
2309 'section_title_source' => 'page_title',
2310 ],
2311 ]
2312 );
2313
2314 $ref->add_control(
2315 'section_title_tag',
2316 [
2317 'label' => esc_html__( 'Title Tag', 'the-post-grid' ),
2318 'type' => Controls_Manager::SELECT,
2319 'default' => 'h2',
2320 'options' => [
2321 'h1' => esc_html__( 'H1', 'the-post-grid' ),
2322 'h2' => esc_html__( 'H2', 'the-post-grid' ),
2323 'h3' => esc_html__( 'H3', 'the-post-grid' ),
2324 'h4' => esc_html__( 'H4', 'the-post-grid' ),
2325 'h5' => esc_html__( 'H5', 'the-post-grid' ),
2326 'h6' => esc_html__( 'H6', 'the-post-grid' ),
2327 ],
2328 'condition' => [
2329 'show_section_title' => 'show',
2330 ],
2331 ]
2332 );
2333
2334 $ref->add_control(
2335 'enable_external_link',
2336 [
2337 'label' => esc_html__( 'Enable External Link', 'the-post-grid' ),
2338 'type' => Controls_Manager::SWITCHER,
2339 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2340 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2341 'return_value' => 'show',
2342 'default' => false,
2343 ]
2344 );
2345
2346 $ref->add_control(
2347 'section_external_url',
2348 [
2349 'label' => esc_html__( 'External Link', 'the-post-grid' ),
2350 'type' => Controls_Manager::URL,
2351 'placeholder' => esc_html__( 'https://your-link.com', 'the-post-grid' ),
2352 'options' => [ 'url', 'is_external', 'nofollow' ],
2353 'default' => [
2354 'url' => '',
2355 'is_external' => true,
2356 'nofollow' => true,
2357 ],
2358 'label_block' => true,
2359 'condition' => [
2360 'enable_external_link' => 'show',
2361 ],
2362 ]
2363 );
2364
2365 $ref->add_control(
2366 'section_external_text',
2367 [
2368 'label' => esc_html__( 'Link Text', 'the-post-grid' ),
2369 'type' => Controls_Manager::TEXT,
2370 'default' => esc_html__( 'See More', 'the-post-grid' ),
2371 'condition' => [
2372 'enable_external_link' => 'show',
2373 ],
2374 ]
2375 );
2376
2377 if ( 'archive' == $layout_type ) {
2378 $ref->add_control(
2379 'show_cat_desc',
2380 [
2381 'label' => esc_html__( 'Show Archive Description', 'the-post-grid' ),
2382 'type' => Controls_Manager::SWITCHER,
2383 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2384 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2385 'return_value' => 'yes',
2386 'default' => false,
2387 ]
2388 );
2389 }
2390
2391 $ref->end_controls_section();
2392 }
2393
2394 /**
2395 * Thumbnail Settings
2396 *
2397 * @param $ref
2398 */
2399 public static function post_thumbnail_settings( $ref ) {
2400 $prefix = $ref->prefix;
2401 $ref->start_controls_section(
2402 'post_thumbnail_settings',
2403 [
2404 'label' => esc_html__( 'Thumbnail', 'the-post-grid' ),
2405 'tab' => Controls_Manager::TAB_SETTINGS,
2406 'condition' => [
2407 'show_thumb' => 'show',
2408 ],
2409 ]
2410 );
2411
2412 $ref->add_control(
2413 'media_source',
2414 [
2415 'label' => esc_html__( 'Media Source', 'the-post-grid' ),
2416 'type' => Controls_Manager::SELECT,
2417 'default' => 'feature_image',
2418 'options' => [
2419 'feature_image' => esc_html__( 'Feature Image', 'the-post-grid' ),
2420 'first_image' => esc_html__( 'First Image from content', 'the-post-grid' ),
2421 ],
2422 ]
2423 );
2424
2425 $thumb_exclude = '';
2426 if ( ! rtTPG()->hasPro() ) {
2427 $thumb_exclude = 'custom';
2428 }
2429
2430 // Default Image
2431 $ref->add_group_control(
2432 \Elementor\Group_Control_Image_Size::get_type(),
2433 [
2434 'name' => 'image',
2435 'exclude' => [ $thumb_exclude ],
2436 'default' => 'medium_large',
2437 'label' => $ref->get_pro_message( 'custom dimension.' ),
2438 'condition' => [
2439 'media_source' => 'feature_image',
2440 ],
2441 ]
2442 );
2443
2444 $ref->add_control(
2445 'img_crop_style',
2446 [
2447 'label' => esc_html__( 'Image Crop Style', 'the-post-grid' ),
2448 'type' => Controls_Manager::SELECT,
2449 'default' => 'hard',
2450 'options' => [
2451 'soft' => esc_html__( 'Soft Crop', 'the-post-grid' ),
2452 'hard' => esc_html__( 'Hard Crop', 'the-post-grid' ),
2453 ],
2454 'condition' => [
2455 'image_size' => 'custom',
2456 'media_source' => 'feature_image',
2457 ],
2458 ]
2459 );
2460
2461 $thumb_condition = [
2462 'media_source' => 'feature_image',
2463 'grid_layout' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ],
2464 ];
2465
2466 if ( $ref->prefix === 'list' ) {
2467 $thumb_condition = [
2468 'media_source' => 'feature_image',
2469 'list_layout' => [ 'list-layout2', 'list-layout3', 'list-layout2-2', 'list-layout3-2' ],
2470 ];
2471 }
2472
2473 if ( $ref->prefix === 'grid_hover' ) {
2474 $thumb_condition = [
2475 'media_source' => 'feature_image',
2476 'grid_hover_layout' => [
2477 'grid_hover-layout4',
2478 'grid_hover-layout4-2',
2479 'grid_hover-layout5',
2480 'grid_hover-layout5-2',
2481 'grid_hover-layout6',
2482 'grid_hover-layout6-2',
2483 'grid_hover-layout7',
2484 'grid_hover-layout7-2',
2485 'grid_hover-layout9',
2486 'grid_hover-layout9-2',
2487 ],
2488 ];
2489 }
2490 if ( $ref->prefix === 'slider' ) {
2491 $thumb_condition = [
2492 'media_source' => 'feature_image',
2493 'slider_layout' => [ 'slider-layout10' ],
2494 ];
2495 }
2496
2497 // Offset Image
2498 $ref->add_group_control(
2499 \Elementor\Group_Control_Image_Size::get_type(),
2500 [
2501 'name' => 'image_offset',
2502 'exclude' => [ 'custom' ],
2503 'default' => 'medium_large',
2504 'condition' => $thumb_condition,
2505 'classes' => 'tpg-offset-thumb-size',
2506 ]
2507 );
2508
2509 if ( 'list' == $prefix ) {
2510 $ref->add_responsive_control(
2511 'list_image_side_width',
2512 [
2513 'label' => esc_html__( 'List Image Width', 'the-post-grid' ),
2514 'type' => Controls_Manager::SLIDER,
2515 'size_units' => [ 'px', '%' ],
2516 'range' => [
2517 'px' => [
2518 'min' => 0,
2519 'max' => 700,
2520 'step' => 5,
2521 ],
2522 '%' => [
2523 'min' => 0,
2524 'max' => 100,
2525 ],
2526 ],
2527 'selectors' => [
2528 '{{WRAPPER}} .rt-tpg-container .list-layout-wrapper [class*="rt-col"]:not(.offset-left) .rt-holder .tpg-el-image-wrap' => 'flex: 0 0 {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
2529 ],
2530 'condition' => [
2531 'list_layout!' => [ 'list-layout4' ],
2532 ],
2533 ]
2534 );
2535 }
2536
2537 if ( rtTPG()->hasPro() ) {
2538 $ref->add_responsive_control(
2539 'image_height',
2540 [
2541 'label' => esc_html__( 'Image Height', 'the-post-grid' ),
2542 'type' => Controls_Manager::SLIDER,
2543 'size_units' => [ '%', 'px' ],
2544 'range' => [
2545 '%' => [
2546 'min' => 0,
2547 'max' => 100,
2548 ],
2549 'px' => [
2550 'min' => 0,
2551 'max' => 1000,
2552 'step' => 1,
2553 ],
2554 ],
2555 'selectors' => [
2556 '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader > :not(.offset-right) .tpg-el-image-wrap' => 'height: {{SIZE}}{{UNIT}};',
2557 '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader > :not(.offset-right) .tpg-el-image-wrap img' => 'height: {{SIZE}}{{UNIT}};',
2558 '{{WRAPPER}} .tpg-el-main-wrapper.slider-layout11-main .rt-grid-hover-item .rt-holder .rt-el-content-wrapper' => 'height: {{SIZE}}{{UNIT}};',
2559 '{{WRAPPER}} .tpg-el-main-wrapper.slider-layout12-main .rt-grid-hover-item .rt-holder .rt-el-content-wrapper' => 'height: {{SIZE}}{{UNIT}};',
2560 ],
2561 ]
2562 );
2563
2564 $ref->add_responsive_control(
2565 'offset_image_height',
2566 [
2567 'label' => esc_html__( 'Offset Image Height', 'the-post-grid' ),
2568 'type' => Controls_Manager::SLIDER,
2569 'size_units' => [ '%', 'px' ],
2570 'range' => [
2571 '%' => [
2572 'min' => 0,
2573 'max' => 100,
2574 ],
2575 'px' => [
2576 'min' => 0,
2577 'max' => 1000,
2578 'step' => 1,
2579 ],
2580 ],
2581 'condition' => $thumb_condition,
2582 'selectors' => [
2583 '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader .offset-right .tpg-el-image-wrap' => 'height: {{SIZE}}{{UNIT}};',
2584 '{{WRAPPER}} .tpg-el-main-wrapper .rt-content-loader .offset-right .tpg-el-image-wrap img' => 'height: {{SIZE}}{{UNIT}};',
2585 ],
2586 ]
2587 );
2588 }
2589
2590 $ref->add_control(
2591 'hover_animation',
2592 [
2593 'label' => esc_html__( 'Image Hover Animation', 'the-post-grid' ),
2594 'type' => Controls_Manager::SELECT,
2595 'default' => 'default',
2596 'options' => [
2597 'default' => esc_html__( 'Default', 'the-post-grid' ),
2598 'img_zoom_in' => esc_html__( 'Zoom In', 'the-post-grid' ),
2599 'img_zoom_out' => esc_html__( 'Zoom Out', 'the-post-grid' ),
2600 'slide_to_right' => esc_html__( 'Slide to Right', 'the-post-grid' ),
2601 'slide_to_left' => esc_html__( 'Slide to Left', 'the-post-grid' ),
2602 'img_no_effect' => esc_html__( 'None', 'the-post-grid' ),
2603 ],
2604 'render_type' => 'template',
2605 'prefix_class' => 'img_hover_animation_',
2606 ]
2607 );
2608
2609 $ref->add_control(
2610 'is_thumb_lightbox',
2611 [
2612 'label' => esc_html__( 'Light Box', 'the-post-grid' ) . $ref->pro_label,
2613 'type' => Controls_Manager::SELECT,
2614 'default' => 'default',
2615 'options' => [
2616 'default' => esc_html__( 'Default', 'the-post-grid' ),
2617 'show' => esc_html__( 'Show', 'the-post-grid' ),
2618 'hide' => esc_html__( 'Hide', 'the-post-grid' ),
2619 ],
2620 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
2621 ]
2622 );
2623
2624 $ref->add_control(
2625 'light_box_icon',
2626 [
2627 'label' => esc_html__( 'Light Box Icon', 'the-post-grid' ),
2628 'type' => Controls_Manager::ICONS,
2629 'default' => [
2630 'value' => 'fas fa-plus',
2631 'library' => 'solid',
2632 ],
2633 'condition' => [
2634 'is_thumb_lightbox' => 'show',
2635 ],
2636 ]
2637 );
2638
2639 $ref->add_control(
2640 'is_default_img',
2641 [
2642 'label' => esc_html__( 'Enable Default Image', 'the-post-grid' ) . $ref->pro_label,
2643 'type' => Controls_Manager::SWITCHER,
2644 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2645 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2646 'return_value' => 'yes',
2647 'default' => false,
2648 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
2649 ]
2650 );
2651
2652 $ref->add_control(
2653 'default_image',
2654 [
2655 'label' => esc_html__( 'Default Image', 'the-post-grid' ) . $ref->pro_label,
2656 'type' => Controls_Manager::MEDIA,
2657 'default' => [
2658 'url' => rtTPG()->get_assets_uri( 'images/placeholder.jpg' ),
2659 ],
2660 'condition' => [
2661 'is_default_img' => 'yes',
2662 ],
2663 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
2664 ]
2665 );
2666
2667 $ref->end_controls_section();
2668 }
2669
2670 /**
2671 * Post Title Settings
2672 *
2673 * @param $ref
2674 */
2675 public static function post_title_settings( $ref ) {
2676 $prefix = $ref->prefix;
2677
2678 $ref->start_controls_section(
2679 'post_title_settings',
2680 [
2681 'label' => esc_html__( 'Post Title', 'the-post-grid' ),
2682 'tab' => Controls_Manager::TAB_SETTINGS,
2683 'condition' => [
2684 'show_title' => 'show',
2685 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2686 ],
2687 ]
2688 );
2689
2690 $ref->add_control(
2691 'title_tag',
2692 [
2693 'label' => esc_html__( 'Title Tag', 'the-post-grid' ),
2694 'type' => Controls_Manager::SELECT,
2695 'default' => 'h3',
2696 'options' => [
2697 'h1' => esc_html__( 'H1', 'the-post-grid' ),
2698 'h2' => esc_html__( 'H2', 'the-post-grid' ),
2699 'h3' => esc_html__( 'H3', 'the-post-grid' ),
2700 'h4' => esc_html__( 'H4', 'the-post-grid' ),
2701 'h5' => esc_html__( 'H5', 'the-post-grid' ),
2702 'h6' => esc_html__( 'H6', 'the-post-grid' ),
2703 ],
2704 ]
2705 );
2706
2707 $title_position = [
2708 'default' => esc_html__( 'Default', 'the-post-grid' ),
2709 ];
2710 if ( rtTPG()->hasPro() ) {
2711 $title_position_pro = [
2712 'above_image' => esc_html__( 'Above Image', 'the-post-grid' ),
2713 'below_image' => esc_html__( 'Below Image', 'the-post-grid' ),
2714 ];
2715 $title_position = array_merge( $title_position, $title_position_pro );
2716 }
2717
2718 $ref->add_control(
2719 'title_position',
2720 [
2721 'label' => esc_html__( 'Title Position', 'the-post-grid' ) . $ref->pro_label,
2722 'type' => Controls_Manager::SELECT,
2723 'default' => 'default',
2724 'prefix_class' => 'title_position_',
2725 'render_type' => 'template',
2726 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field',
2727 'options' => $title_position,
2728 'description' => $ref->get_pro_message( 'more position (above/below image)' ),
2729 'condition' => [
2730 $prefix . '_layout' => [
2731 'grid-layout1',
2732 'grid-layout2',
2733 'grid-layout3',
2734 'grid-layout4',
2735 'slider-layout1',
2736 'slider-layout2',
2737 'slider-layout3',
2738 ],
2739 ],
2740 ]
2741 );
2742
2743 $ref->add_control(
2744 'title_position_hidden',
2745 [
2746 'label' => esc_html__( 'Title Position', 'the-post-grid' ),
2747 'type' => Controls_Manager::SELECT,
2748 'default' => 'default',
2749 'prefix_class' => 'title_position_',
2750 'render_type' => 'template',
2751 'classes' => 'tpg-should-hide-field',
2752 'options' => [
2753 'default' => esc_html__( 'Default', 'the-post-grid' ),
2754 ],
2755 'condition' => [
2756 $prefix . '_layout!' => [
2757 'grid-layout1',
2758 'grid-layout2',
2759 'grid-layout3',
2760 'grid-layout4',
2761 'slider-layout1',
2762 'slider-layout2',
2763 'slider-layout3',
2764 ],
2765 ],
2766 ]
2767 );
2768
2769 $ref->add_control(
2770 'title_hover_underline',
2771 [
2772 'label' => esc_html__( 'Title Hover Underline', 'the-post-grid' ),
2773 'type' => Controls_Manager::SELECT,
2774 'default' => 'default',
2775 'prefix_class' => 'title_hover_border_',
2776 'render_type' => 'template',
2777 'options' => [
2778 'default' => esc_html__( 'Default', 'the-post-grid' ),
2779 'enable' => esc_html__( 'Enable', 'the-post-grid' ),
2780 'disable' => esc_html__( 'Disable', 'the-post-grid' ),
2781 ],
2782 ]
2783 );
2784
2785 $ref->add_control(
2786 'title_visibility_style',
2787 [
2788 'label' => esc_html__( 'Title Visibility Style', 'the-post-grid' ),
2789 'type' => Controls_Manager::SELECT,
2790 'default' => 'default',
2791 'options' => [
2792 'default' => esc_html__( 'Default', 'the-post-grid' ),
2793 'one-line' => esc_html__( 'Show in 1 line', 'the-post-grid' ),
2794 'two-line' => esc_html__( 'Show in 2 lines', 'the-post-grid' ),
2795 'three-line' => esc_html__( 'Show in 3 lines', 'the-post-grid' ),
2796 ],
2797 'render_type' => 'template',
2798 'prefix_class' => 'title-',
2799 ]
2800 );
2801
2802 $ref->add_control(
2803 'title_limit',
2804 [
2805 'label' => esc_html__( 'Title Length', 'the-post-grid' ),
2806 'type' => Controls_Manager::NUMBER,
2807 'step' => 1,
2808 ]
2809 );
2810
2811 $ref->add_control(
2812 'title_limit_type',
2813 [
2814 'label' => esc_html__( 'Title trimming by', 'the-post-grid' ),
2815 'type' => Controls_Manager::SELECT,
2816 'default' => 'word',
2817 'options' => [
2818 'word' => esc_html__( 'Words', 'the-post-grid' ),
2819 'character' => esc_html__( 'Characters', 'the-post-grid' ),
2820 ],
2821 ]
2822 );
2823
2824 $ref->end_controls_section();
2825 }
2826
2827 /**
2828 * Post Excerpt Settings
2829 *
2830 * @param $ref
2831 */
2832 public static function post_excerpt_settings( $ref ) {
2833 $prefix = $ref->prefix;
2834
2835 $ref->start_controls_section(
2836 'post_excerpt_settings',
2837 [
2838 'label' => esc_html__( 'Excerpt / Content', 'the-post-grid' ),
2839 'tab' => Controls_Manager::TAB_SETTINGS,
2840 'condition' => [
2841 'show_excerpt' => 'show',
2842 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2843 ],
2844 ]
2845 );
2846
2847 $excerpt_type = [
2848 'character' => esc_html__( 'Character', 'the-post-grid' ),
2849 'word' => esc_html__( 'Word', 'the-post-grid' ),
2850 ];
2851
2852 if ( in_array( $prefix, [ 'grid', 'list' ] ) ) {
2853 $excerpt_type['full'] = esc_html__( 'Full Content', 'the-post-grid' );
2854 }
2855
2856 $ref->add_control(
2857 'excerpt_type',
2858 [
2859 'label' => esc_html__( 'Excerpt Type', 'the-post-grid' ),
2860 'type' => Controls_Manager::SELECT,
2861 'default' => 'character',
2862 'options' => $excerpt_type,
2863 ]
2864 );
2865
2866 $default_excerpt_limit = 100;
2867 if ( 'grid' == $prefix ) {
2868 $default_excerpt_limit = 200;
2869 }
2870
2871 $ref->add_control(
2872 'excerpt_limit',
2873 [
2874 'label' => esc_html__( 'Excerpt Limit', 'the-post-grid' ),
2875 'type' => Controls_Manager::NUMBER,
2876 'step' => 1,
2877 'default' => $default_excerpt_limit,
2878 'condition' => [
2879 'excerpt_type' => [ 'character', 'word' ],
2880 ],
2881 ]
2882 );
2883
2884 $ref->add_control(
2885 'excerpt_more_text',
2886 [
2887 'label' => esc_html__( 'Expansion Indicator', 'the-post-grid' ),
2888 'type' => Controls_Manager::TEXT,
2889 'default' => '...',
2890 'condition' => [
2891 'excerpt_type' => [ 'character', 'word' ],
2892 ],
2893 ]
2894 );
2895
2896 $ref->end_controls_section();
2897 }
2898
2899 /**
2900 * Post Meta Settings
2901 *
2902 * @param $ref
2903 */
2904 public static function post_meta_settings( $ref ) {
2905 $prefix = $ref->prefix;
2906
2907 $ref->start_controls_section(
2908 'post_meta_settings',
2909 [
2910 'label' => esc_html__( 'Meta Data', 'the-post-grid' ),
2911 'tab' => Controls_Manager::TAB_SETTINGS,
2912 'conditions' => [
2913 'relation' => 'or',
2914 'terms' => [
2915 [
2916 'name' => 'show_date',
2917 'operator' => '==',
2918 'value' => 'show',
2919 ],
2920 [
2921 'name' => 'show_category',
2922 'operator' => '==',
2923 'value' => 'show',
2924 ],
2925 [
2926 'name' => 'show_author',
2927 'operator' => '==',
2928 'value' => 'show',
2929 ],
2930 [
2931 'name' => 'show_tags',
2932 'operator' => '==',
2933 'value' => 'show',
2934 ],
2935 [
2936 'name' => 'show_comment_count',
2937 'operator' => '==',
2938 'value' => 'show',
2939 ],
2940 [
2941 'name' => 'show_post_count',
2942 'operator' => '==',
2943 'value' => 'show',
2944 ],
2945 ],
2946 ],
2947 'condition' => [
2948 'show_meta' => 'show',
2949 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
2950 ],
2951 ]
2952 );
2953
2954 $meta_position = [
2955 'default' => esc_html__( 'Default', 'the-post-grid' ),
2956 ];
2957 if ( rtTPG()->hasPro() ) {
2958 $meta_position_pro = [
2959 'above_title' => esc_html__( 'Above Title', 'the-post-grid' ),
2960 'below_title' => esc_html__( 'Below Title', 'the-post-grid' ),
2961 'above_excerpt' => esc_html__( 'Above excerpt', 'the-post-grid' ),
2962 'below_excerpt' => esc_html__( 'Below excerpt', 'the-post-grid' ),
2963 ];
2964 $meta_position = array_merge( $meta_position, $meta_position_pro );
2965 }
2966
2967 $ref->add_control(
2968 'meta_position',
2969 [
2970 'label' => esc_html__( 'Meta Position', 'the-post-grid' ) . $ref->pro_label,
2971 'type' => Controls_Manager::SELECT,
2972 'default' => 'default',
2973 'prefix_class' => 'meta_position_',
2974 'render_type' => 'template',
2975 'options' => $meta_position,
2976 'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field',
2977 ]
2978 );
2979
2980 $ref->add_control(
2981 'show_meta_icon',
2982 [
2983 'label' => esc_html__( 'Show Meta Icon', 'the-post-grid' ),
2984 'type' => Controls_Manager::SWITCHER,
2985 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
2986 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
2987 'return_value' => 'yes',
2988 'default' => 'yes',
2989 ]
2990 );
2991
2992 $ref->add_control(
2993 'meta_separator',
2994 [
2995 'label' => esc_html__( 'Meta Separator', 'the-post-grid' ),
2996 'type' => Controls_Manager::SELECT,
2997 'default' => 'default',
2998 'options' => [
2999 'default' => esc_html__( 'Default - None', 'the-post-grid' ),
3000 '.' => esc_html__( 'Dot ( . )', 'the-post-grid' ),
3001 '/' => esc_html__( 'Single Slash ( / )', 'the-post-grid' ),
3002 '//' => esc_html__( 'Double Slash ( // )', 'the-post-grid' ),
3003 '-' => esc_html__( 'Hyphen ( - )', 'the-post-grid' ),
3004 '|' => esc_html__( 'Vertical Pipe ( | )', 'the-post-grid' ),
3005 ],
3006 ]
3007 );
3008
3009 $ref->add_control(
3010 'meta_popover_toggle',
3011 [
3012 'label' => esc_html__( 'Change Meta Icon', 'the-post-grid' ),
3013 'type' => Controls_Manager::POPOVER_TOGGLE,
3014 'label_off' => esc_html__( 'Default', 'the-post-grid' ),
3015 'label_on' => esc_html__( 'Custom', 'the-post-grid' ),
3016 'return_value' => 'yes',
3017 'condition' => [
3018 'show_meta_icon' => 'yes',
3019 ],
3020 ]
3021 );
3022
3023 $ref->start_popover();
3024
3025 $ref->add_control(
3026 'user_icon',
3027 [
3028 'label' => esc_html__( 'Author Icon', 'the-post-grid' ),
3029 'type' => Controls_Manager::ICONS,
3030 'condition' => [
3031 'show_author_image!' => 'icon',
3032 ],
3033 ]
3034 );
3035
3036 $ref->add_control(
3037 'cat_icon',
3038 [
3039 'label' => esc_html__( 'Category Icon', 'the-post-grid' ),
3040 'type' => Controls_Manager::ICONS,
3041 'condition' => [
3042 'show_category' => 'show',
3043 ],
3044 ]
3045 );
3046
3047 $ref->add_control(
3048 'date_icon',
3049 [
3050 'label' => esc_html__( 'Date Icon', 'the-post-grid' ),
3051 'type' => Controls_Manager::ICONS,
3052 'condition' => [
3053 'show_date' => 'show',
3054 ],
3055 ]
3056 );
3057
3058 $ref->add_control(
3059 'tag_icon',
3060 [
3061 'label' => esc_html__( 'Tags Icon', 'the-post-grid' ),
3062 'type' => Controls_Manager::ICONS,
3063 'condition' => [
3064 'show_tags' => 'show',
3065 ],
3066 ]
3067 );
3068
3069 $ref->add_control(
3070 'comment_icon',
3071 [
3072 'label' => esc_html__( 'Comment Icon', 'the-post-grid' ),
3073 'type' => Controls_Manager::ICONS,
3074 'condition' => [
3075 'show_comment_count' => 'show',
3076 ],
3077 ]
3078 );
3079
3080 $ref->add_control(
3081 'post_count_icon',
3082 [
3083 'label' => esc_html__( 'Post Count Icon', 'the-post-grid' ),
3084 'type' => Controls_Manager::ICONS,
3085 'condition' => [
3086 'show_post_count' => 'show',
3087 ],
3088 ]
3089 );
3090
3091 $ref->end_popover();
3092
3093 /**
3094 * Author Style
3095 * ********************
3096 */
3097
3098 $ref->add_control(
3099 'meta_author_divider',
3100 [
3101 'type' => Controls_Manager::DIVIDER,
3102 'condition' => [
3103 'show_author!' => '',
3104 ],
3105 ]
3106 );
3107
3108 $ref->add_control(
3109 'meta_author_heading',
3110 [
3111 'label' => esc_html__( 'Author Setting:', 'the-post-grid' ),
3112 'type' => Controls_Manager::HEADING,
3113 'classes' => 'tpg-control-type-heading',
3114 'condition' => [
3115 'show_author!' => '',
3116 ],
3117 ]
3118 );
3119
3120 $ref->add_control(
3121 'author_prefix',
3122 [
3123 'label' => esc_html__( 'Author Prefix', 'the-post-grid' ),
3124 'type' => Controls_Manager::TEXT,
3125 'default' => 'By',
3126 'placeholder' => esc_html__( 'By', 'the-post-grid' ),
3127 'condition' => [
3128 'show_author!' => '',
3129 ],
3130 ]
3131 );
3132
3133 $ref->add_control(
3134 'author_icon_visibility',
3135 [
3136 'label' => esc_html__( 'Author Icon Visibility', 'the-post-grid' ),
3137 'type' => Controls_Manager::SELECT,
3138 'default' => 'show',
3139 'options' => [
3140 'default' => esc_html__( 'Default', 'the-post-grid' ),
3141 'hide' => esc_html__( 'Hide', 'the-post-grid' ),
3142 'show' => esc_html__( 'Show', 'the-post-grid' ),
3143 ],
3144 'condition' => [
3145 'show_author!' => '',
3146 ],
3147 'prefix_class' => 'tpg-is-author-icon-',
3148 ]
3149 );
3150
3151 $ref->add_control(
3152 'show_author_image',
3153 [
3154 'label' => esc_html__( 'Author Image / Icon', 'the-post-grid' ),
3155 'type' => Controls_Manager::SELECT,
3156 'default' => 'icon',
3157 'options' => [
3158 'image' => esc_html__( 'Image', 'the-post-grid' ),
3159 'icon' => esc_html__( 'Icon', 'the-post-grid' ),
3160 ],
3161 'render_type' => 'template',
3162 'prefix_class' => 'author-image-visibility-',
3163 'condition' => [
3164 'show_author!' => '',
3165 'author_icon_visibility!' => 'hide',
3166 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
3167 ],
3168 ]
3169 );
3170
3171 $ref->add_responsive_control(
3172 'author_icon_width',
3173 [
3174 'label' => esc_html__( 'Author Image Width', 'the-post-grid' ),
3175 'type' => Controls_Manager::SLIDER,
3176 'size_units' => [ 'px' ],
3177 'range' => [
3178 'px' => [
3179 'min' => 10,
3180 'max' => 100,
3181 'step' => 1,
3182 ],
3183 ],
3184 'selectors' => [
3185 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span img' => 'width: {{SIZE}}{{UNIT}} !important;max-width:{{SIZE}}{{UNIT}};height:{{SIZE}}{{UNIT}} !important;',
3186 ],
3187 'condition' => [
3188 'show_author!' => '',
3189 'author_icon_visibility!' => 'hide',
3190 'show_author_image!' => 'icon',
3191 ],
3192 ]
3193 );
3194
3195 /**
3196 * Category Style
3197 * ********************
3198 */
3199
3200 $ref->add_control(
3201 'category_heading',
3202 [
3203 'label' => esc_html__( 'Category and Tags Setting:', 'the-post-grid' ),
3204 'type' => Controls_Manager::HEADING,
3205 'classes' => 'tpg-control-type-heading',
3206 'conditions' => [
3207 'relation' => 'or',
3208 'terms' => [
3209 [
3210 'name' => 'show_category',
3211 'operator' => '==',
3212 'value' => 'show',
3213 ],
3214 [
3215 'name' => 'show_tags',
3216 'operator' => '==',
3217 'value' => 'show',
3218 ],
3219 ],
3220 ],
3221 ]
3222 );
3223
3224 $ref->add_control(
3225 'category_position',
3226 [
3227 'label' => esc_html__( 'Category Position', 'the-post-grid' ) . $ref->pro_label,
3228 'type' => Controls_Manager::SELECT,
3229 'default' => 'default',
3230 'options' => [
3231 'default' => esc_html__( 'Default', 'the-post-grid' ),
3232 'above_title' => esc_html__( 'Above Title', 'the-post-grid' ),
3233 'with_meta' => esc_html__( 'With Meta', 'the-post-grid' ),
3234 'top_left' => esc_html__( 'Over image (Top Left)', 'the-post-grid' ),
3235 'top_right' => esc_html__( 'Over image (Top Right)', 'the-post-grid' ),
3236 'bottom_left' => esc_html__( 'Over image (Bottom Left)', 'the-post-grid' ),
3237 'bottom_right' => esc_html__( 'Over image (Bottom Right)', 'the-post-grid' ),
3238 'image_center' => esc_html__( 'Over image (Center)', 'the-post-grid' ),
3239 ],
3240 'condition' => [
3241 'show_category' => 'show',
3242 ],
3243 'render_type' => 'template',
3244 'divider' => 'before',
3245 'prefix_class' => 'tpg-category-position-',
3246 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
3247 ]
3248 );
3249
3250 $category_style_condition = [
3251 'relation' => 'or',
3252 'terms' => [
3253 [
3254 'name' => 'category_position',
3255 'operator' => '!=',
3256 'value' => 'default',
3257 ],
3258 [
3259 'name' => $prefix . '_layout',
3260 'operator' => 'in',
3261 'value' => [ 'grid-layout5', 'grid-layout5-2', 'grid-layout6', 'grid-layout6-2' ],
3262 ],
3263 ],
3264 ];
3265
3266 $ref->add_control(
3267 'category_style',
3268 [
3269 'label' => esc_html__( 'Category Style', 'the-post-grid' ) . $ref->pro_label,
3270 'type' => Controls_Manager::SELECT,
3271 'default' => 'style1',
3272 'options' => [
3273 'style1' => esc_html__( 'Style 1 - Only Text', 'the-post-grid' ),
3274 'style2' => esc_html__( 'Style 2 - Background', 'the-post-grid' ),
3275 'style3' => esc_html__( 'Style 3 - Fold edge', 'the-post-grid' ),
3276 'style4' => esc_html__( 'Style 4 - Different Color', 'the-post-grid' ),
3277 ],
3278 'prefix_class' => 'tpg-cat-',
3279 'render_type' => 'template',
3280 'description' => rtTPG()->hasPro() ? esc_html( 'Different background color will work if you use style 1 and 2' ) : '',
3281 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
3282 'conditions' => $category_style_condition,
3283 ]
3284 );
3285
3286 if ( rtTPG()->hasPro() ) {
3287 $ref->add_control(
3288 'important_note',
3289 [
3290 'raw' => esc_html__( 'NB. If you use different background color for category then please choose style 2 or 3 from above', 'the-post-grid' ),
3291 'type' => Controls_Manager::RAW_HTML,
3292 ]
3293 );
3294 }
3295
3296 if ( rtTPG()->hasPro() ) {
3297 $ref->add_control(
3298 'show_cat_icon',
3299 [
3300 'label' => esc_html__( 'Show Over Image Category Icon', 'the-post-grid' ),
3301 'type' => Controls_Manager::SWITCHER,
3302 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
3303 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
3304 'return_value' => 'yes',
3305 'default' => false,
3306 'conditions' => $category_style_condition,
3307 ]
3308 );
3309 }
3310
3311 $post_types = Fns::get_post_types();
3312
3313 foreach ( $post_types as $post_type => $label ) {
3314 $_taxonomies = get_object_taxonomies( $post_type, 'object' );
3315 if ( empty( $_taxonomies ) ) {
3316 continue;
3317 }
3318 $term_options = [];
3319 foreach ( $_taxonomies as $tax ) {
3320 if ( 'post_format' == $tax->name ) {
3321 continue;
3322 }
3323 $term_options[ $tax->name ] = $tax->label;
3324 }
3325
3326 if ( 'post' === $post_type ) {
3327 $default_cat = 'category';
3328 $default_tag = 'post_tag';
3329 } elseif ( 'product' === $post_type ) {
3330 $default_cat = 'product_cat';
3331 $default_tag = 'product_tag';
3332 } elseif ( 'download' === $post_type ) {
3333 $default_cat = 'download_category';
3334 $default_tag = 'download_tag';
3335 } elseif ( 'docs' === $post_type ) {
3336 $default_cat = 'doc_category';
3337 $default_tag = 'doc_tag';
3338 } elseif ( 'lp_course' === $post_type ) {
3339 $default_cat = 'course_category';
3340 $default_tag = 'course_tag';
3341 } else {
3342 $taxonomie_keys = array_keys( $_taxonomies );
3343 $filter_cat = array_filter(
3344 $taxonomie_keys,
3345 function ( $item ) {
3346 return strpos( $item, 'cat' ) !== false;
3347 }
3348 );
3349 $filter_tag = array_filter(
3350 $taxonomie_keys,
3351 function ( $item ) {
3352 return strpos( $item, 'tag' ) !== false;
3353 }
3354 );
3355
3356 if ( is_array( $filter_cat ) && ! empty( $filter_cat ) ) {
3357 $default_cat = array_shift( $filter_cat );
3358 }
3359 if ( is_array( $filter_tag ) && ! empty( $filter_tag ) ) {
3360 $default_tag = array_shift( $filter_tag );
3361 }
3362 }
3363
3364 $ref->add_control(
3365 $post_type . '_taxonomy',
3366 [
3367 'label' => esc_html__( 'Category Source', 'the-post-grid' ),
3368 'type' => Controls_Manager::SELECT,
3369 'default' => $default_cat,
3370 'options' => $term_options,
3371 'condition' => [
3372 'show_category' => 'show',
3373 'post_type' => $post_type,
3374 ],
3375 'description' => esc_html__( 'Select which taxonomy should sit in the place of categories. Default: Category', 'the-post-grid' ),
3376 ]
3377 );
3378
3379 $ref->add_control(
3380 $post_type . '_tags',
3381 [
3382 'label' => esc_html__( 'Tags Source', 'the-post-grid' ),
3383 'type' => Controls_Manager::SELECT,
3384 'default' => $default_tag,
3385 'options' => $term_options,
3386 'condition' => [
3387 'show_category' => 'show',
3388 'post_type' => $post_type,
3389 ],
3390 'description' => esc_html__( 'Select which taxonomy should sit in the place of tags. Default: Tags', 'the-post-grid' ),
3391 ]
3392 );
3393 }
3394
3395 $ref->add_control(
3396 'comment_count_heading',
3397 [
3398 'label' => esc_html__( 'Comment Count ', 'the-post-grid' ),
3399 'type' => Controls_Manager::HEADING,
3400 'classes' => 'tpg-control-type-heading',
3401 'condition' => [
3402 'show_comment_count' => 'show',
3403 ],
3404 ]
3405 );
3406
3407 $ref->add_control(
3408 'show_comment_count_label',
3409 [
3410 'label' => esc_html__( 'Show Comment Label', 'the-post-grid' ),
3411 'type' => Controls_Manager::SWITCHER,
3412 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
3413 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
3414 'return_value' => 'yes',
3415 'default' => 'yes',
3416 'condition' => [
3417 'show_comment_count' => 'show',
3418 ],
3419 ]
3420 );
3421
3422 $ref->add_control(
3423 'comment_count_label_singular',
3424 [
3425 'label' => esc_html__( 'Comment Label Singular', 'the-post-grid' ),
3426 'type' => Controls_Manager::TEXT,
3427 'default' => esc_html__( 'Comment', 'the-post-grid' ),
3428 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ),
3429 'condition' => [
3430 'show_comment_count' => 'show',
3431 'show_comment_count_label' => 'yes',
3432 ],
3433 ]
3434 );
3435
3436 $ref->add_control(
3437 'comment_count_label_plural',
3438 [
3439 'label' => esc_html__( 'Comment Label Plural', 'the-post-grid' ),
3440 'type' => Controls_Manager::TEXT,
3441 'default' => esc_html__( 'Comments', 'the-post-grid' ),
3442 'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ),
3443 'condition' => [
3444 'show_comment_count' => 'show',
3445 'show_comment_count_label' => 'yes',
3446 ],
3447 ]
3448 );
3449
3450 $ref->add_control(
3451 'date_meta_heading',
3452 [
3453 'label' => esc_html__( 'Date Settings', 'the-post-grid' ),
3454 'type' => Controls_Manager::HEADING,
3455 'classes' => 'tpg-control-type-heading',
3456 'condition' => [
3457 'show_date' => 'show',
3458 ],
3459 ]
3460 );
3461
3462 $ref->add_control(
3463 'date_archive_link',
3464 [
3465 'label' => esc_html__( 'Date Archive Link', 'the-post-grid' ),
3466 'type' => Controls_Manager::SWITCHER,
3467 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
3468 'label_off' => esc_html__( 'No', 'the-post-grid' ),
3469 'return_value' => 'yes',
3470 'default' => 'yes',
3471 'condition' => [
3472 'show_date' => 'show',
3473 ],
3474 ]
3475 );
3476
3477 $ref->add_control(
3478 'meta_ordering_heading',
3479 [
3480 'label' => esc_html__( 'Meta Ordering', 'the-post-grid' ),
3481 'type' => Controls_Manager::HEADING,
3482 'classes' => 'tpg-control-type-heading',
3483 ]
3484 );
3485
3486 $repeater = new \Elementor\Repeater();
3487
3488 $repeater->add_control(
3489 'repeater_hidden',
3490 [
3491 'type' => Controls_Manager::HIDDEN,
3492 ]
3493 );
3494
3495 $ref->add_control(
3496 'meta_ordering',
3497 [
3498 'label' => esc_html__( 'Meta Ordering (Drag and Drop)', 'the-post-grid' ),
3499 'type' => Controls_Manager::REPEATER,
3500 'fields' => $repeater->get_controls(),
3501 'default' => [
3502 [
3503 'meta_title' => esc_html__( 'Author', 'the-post-grid' ),
3504 'meta_name' => 'author',
3505 ],
3506 [
3507 'meta_title' => esc_html__( 'Date', 'the-post-grid' ),
3508 'meta_name' => 'date',
3509 ],
3510 [
3511 'meta_title' => esc_html__( 'Category', 'the-post-grid' ),
3512 'meta_name' => 'category',
3513 ],
3514 [
3515 'meta_title' => esc_html__( 'Tags', 'the-post-grid' ),
3516 'meta_name' => 'tags',
3517 ],
3518 [
3519 'meta_title' => esc_html__( 'Comment Count', 'the-post-grid' ),
3520 'meta_name' => 'comment_count',
3521 ],
3522 [
3523 'meta_title' => esc_html__( 'Post Count', 'the-post-grid' ),
3524 'meta_name' => 'post_count',
3525 ],
3526 [
3527 'meta_title' => esc_html__( 'Post Like', 'the-post-grid' ),
3528 'meta_name' => 'post_like',
3529 ],
3530 ],
3531 'classes' => 'tpg-item-order-repeater',
3532 'title_field' => '{{{ meta_title }}}',
3533 ]
3534 );
3535
3536 $ref->end_controls_section();
3537 }
3538
3539 /**
3540 * Read More Settings
3541 *
3542 * @param $ref
3543 */
3544 public static function post_readmore_settings( $ref ) {
3545 $prefix = $ref->prefix;
3546
3547 $ref->start_controls_section(
3548 'post_readmore_settings',
3549 [
3550 'label' => esc_html__( 'Read More', 'the-post-grid' ),
3551 'tab' => Controls_Manager::TAB_SETTINGS,
3552 'condition' => [
3553 'show_read_more' => 'show',
3554 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
3555 ],
3556 ]
3557 );
3558
3559 $ref->add_control(
3560 'readmore_btn_style',
3561 [
3562 'label' => esc_html__( 'Button Style', 'the-post-grid' ),
3563 'type' => Controls_Manager::SELECT,
3564 'default' => 'default-style',
3565 'options' => [
3566 'default-style' => esc_html__( 'Default from style', 'the-post-grid' ),
3567 'only-text' => esc_html__( 'Only Text Button', 'the-post-grid' ),
3568 ],
3569 'prefix_class' => 'readmore-btn-',
3570 ]
3571 );
3572
3573 $ref->add_control(
3574 'read_more_label',
3575 [
3576 'label' => esc_html__( 'Read More Label', 'the-post-grid' ),
3577 'type' => Controls_Manager::TEXT,
3578 'default' => esc_html__( 'Read More', 'the-post-grid' ),
3579 'placeholder' => esc_html__( 'Type Read More Label here', 'the-post-grid' ),
3580 ]
3581 );
3582
3583 $ref->add_control(
3584 'show_btn_icon',
3585 [
3586 'label' => esc_html__( 'Show Button Icon', 'the-post-grid' ),
3587 'type' => Controls_Manager::SWITCHER,
3588 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
3589 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
3590 'return_value' => 'yes',
3591 'default' => false,
3592 ]
3593 );
3594
3595 $ref->add_control(
3596 'readmore_btn_icon',
3597 [
3598 'label' => esc_html__( 'Choose Icon', 'the-post-grid' ),
3599 'type' => Controls_Manager::ICONS,
3600 'condition' => [
3601 'show_btn_icon' => 'yes',
3602 ],
3603 ]
3604 );
3605
3606 $ref->add_control(
3607 'readmore_icon_position',
3608 [
3609 'label' => esc_html__( 'Icon Position', 'the-post-grid' ),
3610 'type' => Controls_Manager::SELECT,
3611 'default' => 'right',
3612 'options' => [
3613 'left' => esc_html__( 'Left', 'the-post-grid' ),
3614 'right' => esc_html__( 'Right', 'the-post-grid' ),
3615 ],
3616 'condition' => [
3617 'show_btn_icon' => 'yes',
3618 ],
3619 ]
3620 );
3621
3622 $ref->end_controls_section();
3623
3624 self::post_event_settings( $ref );
3625 }
3626
3627
3628 public static function post_event_settings( $ref ) {
3629 $prefix = $ref->prefix;
3630 $ref->start_controls_section(
3631 'post_event_settings',
3632 [
3633 'label' => esc_html__( 'Event Settings', 'the-post-grid' ),
3634 'tab' => Controls_Manager::TAB_SETTINGS,
3635 'condition' => [
3636 'show_event_date' => 'on',
3637 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
3638 ],
3639 ]
3640 );
3641 $ref->add_control(
3642 'event_title',
3643 [
3644 'label' => esc_html__( 'Event Title', 'the-post-grid' ),
3645 'type' => \Elementor\Controls_Manager::TEXT,
3646 'default' => esc_html__( 'Event Information:', 'the-post-grid' ),
3647 ]
3648 );
3649 $ref->add_control(
3650 'start_date_label',
3651 [
3652 'label' => esc_html__( 'Start Date Label', 'the-post-grid' ),
3653 'type' => \Elementor\Controls_Manager::TEXT,
3654 'default' => esc_html__( 'Start Date:', 'the-post-grid' ),
3655 ]
3656 );
3657
3658 $ref->add_control(
3659 'end_date_label',
3660 [
3661 'label' => esc_html__( 'End Date Label', 'the-post-grid' ),
3662 'type' => \Elementor\Controls_Manager::TEXT,
3663 'default' => esc_html__( 'End Date:', 'the-post-grid' ),
3664 ]
3665 );
3666
3667
3668 $ref->add_control(
3669 'event_date_format',
3670 [
3671 'label' => esc_html__( 'Date Format', 'the-post-grid' ),
3672 'type' => \Elementor\Controls_Manager::SELECT,
3673 'default' => 'F j, Y g:i a',
3674 'options' => [
3675 'F j, Y g:i a' => date( 'F j, Y g:i a' ),
3676 'M j, Y' => date( 'M j, Y' ),
3677 'Y-m-d H:i:s' => date( 'Y-m-d H:i:s' ),
3678 'm/d/Y g:i a' => date( 'm/d/Y g:i a' ),
3679 'custom' => esc_html__( 'Custom Format', 'the-post-grid' ),
3680 ],
3681 ]
3682 );
3683
3684
3685 $ref->add_control(
3686 'custom_event_date_format',
3687 [
3688 'label' => esc_html__( 'Custom Date Format', 'the-post-grid' ),
3689 'type' => \Elementor\Controls_Manager::TEXT,
3690 'description' => sprintf(
3691 wp_kses(
3692 __( 'Use PHP date format — e.g. <code>Y-m-d g:i a</code>. <a href="%s" target="_blank">Learn more</a>', 'the-post-grid' ),
3693 [ 'code' => [], 'a' => [ 'href' => [], 'target' => [] ] ]
3694 ),
3695 'https://www.php.net/manual/en/datetime.format.php'
3696 ),
3697 'condition' => [
3698 'show_event_date' => 'on',
3699 'event_date_format' => 'custom',
3700 ],
3701 ]
3702 );
3703 $ref->end_controls_section();
3704 }
3705
3706 /**
3707 * Advanced Custom Field ACF Settings
3708 *
3709 * @param $ref
3710 */
3711 public static function tpg_acf_settings( $ref ) {
3712 $prefix = $ref->prefix;
3713 $cf = Fns::is_acf();
3714
3715 if ( ! $cf || ! rtTPG()->hasPro() ) {
3716 return;
3717 }
3718
3719 $ref->start_controls_section(
3720 'tgp_acf_settings',
3721 [
3722 'label' => esc_html__( 'ACF Settings', 'the-post-grid' ),
3723 'tab' => Controls_Manager::TAB_SETTINGS,
3724 'condition' => [
3725 'show_acf' => 'show',
3726 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
3727 ],
3728 ]
3729 );
3730
3731 self::get_tpg_acf_settings( $ref );
3732
3733 $ref->end_controls_section();
3734 }
3735
3736 public static function get_tpg_acf_settings( $ref, $is_archive = false ) {
3737 $post_types = Fns::get_post_types();
3738
3739 if ( $is_archive ) {
3740 $get_acf_field = Fns::get_groups_by_post_type( 'post' );
3741 $selected_acf_id = '';
3742 if ( ! empty( $get_acf_field ) && is_array( $get_acf_field ) ) {
3743 $selected_acf_id = array_key_first( $get_acf_field );
3744 }
3745
3746 $ref->add_control(
3747 'cf_group',
3748 [
3749 'label' => esc_html__( 'Choose Advanced Custom Field (ACF)', 'the-post-grid' ),
3750 'type' => Controls_Manager::SELECT2,
3751 'label_block' => true,
3752 'multiple' => true,
3753 'default' => [ $selected_acf_id ],
3754 'options' => Fns::get_groups_by_post_type( 'post' ),
3755 ]
3756 );
3757 } else {
3758 foreach ( $post_types as $post_type => $post_type_title ) {
3759 $get_acf_field = Fns::get_groups_by_post_type( $post_type );
3760 $selected_acf_id = '';
3761 if ( ! empty( $get_acf_field ) && is_array( $get_acf_field ) ) {
3762 $selected_acf_id = array_key_first( $get_acf_field );
3763 }
3764
3765 $ref->add_control(
3766 $post_type . '_cf_group',
3767 [
3768 'label' => esc_html__( 'Choose Advanced Custom Field (ACF)', 'the-post-grid' ),
3769 'type' => Controls_Manager::SELECT2,
3770 'label_block' => true,
3771 'multiple' => true,
3772 'default' => [ $selected_acf_id ],
3773 'options' => Fns::get_groups_by_post_type( $post_type ),
3774 'condition' => [
3775 'post_type' => $post_type,
3776 ],
3777 ]
3778 );
3779 }
3780 }
3781
3782 $ref->add_control(
3783 'cf_hide_empty_value',
3784 [
3785 'label' => esc_html__( 'Hide field with empty value?', 'the-post-grid' ),
3786 'type' => Controls_Manager::SWITCHER,
3787 'label_on' => esc_html__( 'No', 'the-post-grid' ),
3788 'label_off' => esc_html__( 'Yes', 'the-post-grid' ),
3789 'return_value' => 'yes',
3790 'default' => 'yes',
3791 ]
3792 );
3793
3794 $ref->add_control(
3795 'cf_hide_group_title',
3796 [
3797 'label' => esc_html__( 'Show group title?', 'the-post-grid' ),
3798 'type' => Controls_Manager::SWITCHER,
3799 'label_on' => esc_html__( 'No', 'the-post-grid' ),
3800 'label_off' => esc_html__( 'Yes', 'the-post-grid' ),
3801 'return_value' => 'yes',
3802 'default' => 'yes',
3803 ]
3804 );
3805
3806 $ref->add_control(
3807 'cf_show_only_value',
3808 [
3809 'label' => esc_html__( 'Show label?', 'the-post-grid' ),
3810 'type' => Controls_Manager::SWITCHER,
3811 'label_on' => esc_html__( 'No', 'the-post-grid' ),
3812 'label_off' => esc_html__( 'Yes', 'the-post-grid' ),
3813 'return_value' => 'yes',
3814 'default' => 'yes',
3815 ]
3816 );
3817 }
3818
3819 /**
3820 * Links Settings
3821 *
3822 * @param $ref
3823 * @param $cbf it's a callback for push some extra fields thought the main class
3824 */
3825 public static function links( $ref ) {
3826 $prefix = $ref->prefix;
3827
3828 $ref->start_controls_section(
3829 'tpg_links_settings',
3830 [
3831 'label' => esc_html__( 'Links', 'the-post-grid' ),
3832 'tab' => Controls_Manager::TAB_CONTENT,
3833 'condition' => [
3834 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
3835 ],
3836
3837 ]
3838 );
3839
3840 $link_type = [
3841 'default' => esc_html__( 'Link to details page', 'the-post-grid' ),
3842 ];
3843 if ( rtTPG()->hasPro() ) {
3844 $link_type['popup'] = esc_html__( 'Single Popup', 'the-post-grid' );
3845 $link_type['multi_popup'] = esc_html__( 'Multi Popup', 'the-post-grid' );
3846 }
3847 $link_type['none'] = esc_html__( 'No Link', 'the-post-grid' );
3848
3849 $ref->add_control(
3850 'post_link_type',
3851 [
3852 'label' => esc_html__( 'Post link type', 'the-post-grid' ),
3853 'type' => Controls_Manager::SELECT,
3854 'default' => 'default',
3855 'options' => $link_type,
3856 'description' => $ref->get_pro_message( 'popup options' ),
3857 ]
3858 );
3859
3860 $ref->add_control(
3861 'link_target',
3862 [
3863 'label' => esc_html__( 'Link Target', 'the-post-grid' ),
3864 'type' => Controls_Manager::SELECT,
3865 'default' => '_self',
3866 'options' => [
3867 '_self' => esc_html__( 'Same Window', 'the-post-grid' ),
3868 '_blank' => esc_html__( 'New Window', 'the-post-grid' ),
3869 ],
3870 'condition' => [
3871 'post_link_type' => 'default',
3872 ],
3873 ]
3874 );
3875
3876 $ref->add_control(
3877 'is_thumb_linked',
3878 [
3879 'label' => esc_html__( 'Thumbnail Link', 'the-post-grid' ),
3880 'type' => Controls_Manager::SWITCHER,
3881 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
3882 'label_off' => esc_html__( 'No', 'the-post-grid' ),
3883 'return_value' => 'yes',
3884 'default' => 'yes',
3885 ]
3886 );
3887
3888 $ref->end_controls_section();
3889 }
3890
3891 /**
3892 * Promotions
3893 *
3894 * @param $ref
3895 */
3896 public static function promotions( $ref ) {
3897 if ( rtTPG()->hasPro() ) {
3898 return;
3899 }
3900 $pro_url = '//www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/';
3901
3902 $ref->start_controls_section(
3903 'tpg_pro_alert',
3904 [
3905 'label' => sprintf(
3906 '<span style="color: #f54">%s</span>',
3907 __( 'Go Premium for More Features', 'the-post-grid' )
3908 ),
3909 ]
3910 );
3911
3912 $ref->add_control(
3913 'tpg_control_get_pro',
3914 [
3915 'type' => Controls_Manager::RAW_HTML,
3916 'raw' => '<div class="elementor-nerd-box"><div class="elementor-nerd-box-title" style="margin-top: 0; margin-bottom: 20px;">Unlock more possibilities</div><div class="elementor-nerd-box-message"><span class="pro-feature" style="font-size: 13px;"> Get the <a href="'
3917 . $pro_url
3918 . '" target="_blank" style="color: #f54">Pro version</a> for more stunning layouts and customization options.</span></div><a class="elementor-nerd-box-link elementor-button elementor-button-default elementor-button-go-pro" href="'
3919 . $pro_url . '" target="_blank">Get Pro</a></div>',
3920 ]
3921 );
3922
3923 $ref->end_controls_section();
3924 }
3925
3926 /**
3927 * Section Title Style
3928 *
3929 * @param $ref
3930 */
3931 public static function sectionTitle( $ref, $layout_type = '' ) {
3932 $prefix = $ref->prefix;
3933 $ref->start_controls_section(
3934 'tpg_section_title_style',
3935 [
3936 'label' => esc_html__( 'Section Title', 'the-post-grid' ),
3937 'tab' => Controls_Manager::TAB_STYLE,
3938 'condition' => [
3939 'show_section_title' => 'show',
3940 ],
3941 ]
3942 );
3943
3944 $ref->add_control(
3945 'section_title_alignment',
3946 [
3947 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
3948 'type' => Controls_Manager::CHOOSE,
3949 'options' => [
3950 'left' => [
3951 'title' => esc_html__( 'Left', 'the-post-grid' ),
3952 'icon' => 'eicon-text-align-left',
3953 ],
3954 'center' => [
3955 'title' => esc_html__( 'Center', 'the-post-grid' ),
3956 'icon' => 'eicon-text-align-center',
3957 ],
3958 'right' => [
3959 'title' => esc_html__( 'Right', 'the-post-grid' ),
3960 'icon' => 'eicon-text-align-right',
3961 ],
3962 ],
3963 'render_type' => 'template',
3964 'prefix_class' => 'section-title-align-',
3965 ]
3966 );
3967
3968 $ref->add_responsive_control(
3969 'section_title_margin',
3970 [
3971 'label' => esc_html__( 'Margin', 'the-post-grid' ),
3972 'type' => Controls_Manager::DIMENSIONS,
3973 'size_units' => [ 'px' ],
3974 'default' => [
3975 'top' => '',
3976 'right' => '',
3977 'bottom' => '',
3978 'left' => '',
3979 'isLinked' => false,
3980 ],
3981 'selectors' => [
3982 '{{WRAPPER}} .tpg-widget-heading-wrapper' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3983 ],
3984 ]
3985 );
3986
3987 $ref->add_responsive_control(
3988 'section_title_radius',
3989 [
3990 'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
3991 'type' => Controls_Manager::DIMENSIONS,
3992 'size_units' => [ 'px' ],
3993 'default' => [
3994 'top' => '',
3995 'right' => '',
3996 'bottom' => '',
3997 'left' => '',
3998 'isLinked' => false,
3999 ],
4000 'selectors' => [
4001 '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4002 ],
4003 ]
4004 );
4005
4006 if ( 'slider' === $prefix ) {
4007 $ref->add_responsive_control(
4008 'section_title_padding',
4009 [
4010 'label' => esc_html__( 'Padding', 'the-post-grid' ),
4011 'type' => Controls_Manager::DIMENSIONS,
4012 'size_units' => [ 'px' ],
4013 'allowed_dimensions' => 'all', // horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
4014 'default' => [
4015 'top' => '',
4016 'right' => '',
4017 'bottom' => '',
4018 'left' => '',
4019 'isLinked' => false,
4020 ],
4021 'selectors' => [
4022 '{{WRAPPER}} .slider-layout-main .tpg-widget-heading-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4023 ],
4024 ]
4025 );
4026 }
4027
4028 $ref->add_group_control(
4029 Group_Control_Typography::get_type(),
4030 [
4031 'name' => 'section_title_typography',
4032 'label' => esc_html__( 'Typography', 'the-post-grid' ),
4033 'selector' => '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading',
4034 ]
4035 );
4036
4037 $ref->add_control(
4038 'section_title_color',
4039 [
4040 'label' => esc_html__( 'Title Color', 'the-post-grid' ),
4041 'type' => Controls_Manager::COLOR,
4042 'selectors' => [
4043 '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading' => 'color: {{VALUE}}',
4044 ],
4045 ]
4046 );
4047
4048 $ref->add_control(
4049 'section_title_bg_color',
4050 [
4051 'label' => esc_html__( 'Title Background Color', 'the-post-grid' ),
4052 'type' => Controls_Manager::COLOR,
4053 'selectors' => [
4054 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading' => 'background-color: {{VALUE}}',
4055 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading::after, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading::before' => 'border-color: {{VALUE}} transparent',
4056 ],
4057 'condition' => [
4058 'section_title_style' => [ 'style2', 'style3' ],
4059 ],
4060 ]
4061 );
4062
4063 $ref->add_control(
4064 'section_title_dot_color',
4065 [
4066 'label' => esc_html__( 'Dot / Bar Color', 'the-post-grid' ),
4067 'type' => Controls_Manager::COLOR,
4068 'selectors' => [
4069 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before' => 'background-color: {{VALUE}}',
4070 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style4::before' => 'background-color: {{VALUE}}',
4071 ],
4072 'condition' => [
4073 'section_title_style' => [ 'style1', 'style4' ],
4074 ],
4075 ]
4076 );
4077
4078 $ref->add_control(
4079 'section_title_line_color',
4080 [
4081 'label' => esc_html__( 'Line / Border Color', 'the-post-grid' ),
4082 'type' => Controls_Manager::COLOR,
4083 'selectors' => [
4084 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line' => 'border-color: {{VALUE}}',
4085 '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper:not(.carousel) .tpg-widget-heading-wrapper,{{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper:not(.carousel) .tpg-widget-heading-wrapper,{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper.carousel' => 'border-bottom-color: {{VALUE}}',
4086 '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide.selected, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide.selected' => 'color: {{VALUE}}',
4087 '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide:hover, {{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide:hover' => 'color: {{VALUE}}',
4088 '{{WRAPPER}}.section-title-style-style2 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide::before, {{WRAPPER}}.section-title-style-style3 .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide::before' => 'border-bottom-color: {{VALUE}}',
4089 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style4::after' => 'background-color: {{VALUE}}',
4090 ],
4091 'condition' => [
4092 'section_title_style!' => 'default',
4093 ],
4094 ]
4095 );
4096
4097 $ref->add_responsive_control(
4098 'section_title_line_width',
4099 [
4100 'label' => esc_html__( 'Line Width', 'the-post-grid' ),
4101 'type' => Controls_Manager::SLIDER,
4102 'size_units' => [ 'px' ],
4103 'range' => [
4104 'px' => [
4105 'min' => 0,
4106 'max' => 1200,
4107 'step' => 1,
4108 ],
4109 ],
4110 'selectors' => [
4111 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style4::before' => 'width: {{SIZE}}px;',
4112 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style4::after' => 'width: calc(100% - calc({{SIZE}}px + 10px))',
4113 ],
4114 'condition' => [
4115 'section_title_style' => [ 'style4' ],
4116 ],
4117 ]
4118 );
4119
4120 $ref->add_responsive_control(
4121 'section_title_line_spacing',
4122 [
4123 'label' => esc_html__( 'Line Spacing', 'the-post-grid' ),
4124 'type' => Controls_Manager::SLIDER,
4125 'size_units' => [ 'px' ],
4126 'range' => [
4127 'px' => [
4128 'min' => - 300,
4129 'max' => 300,
4130 'step' => 1,
4131 ],
4132 ],
4133 'default' => [
4134 'unit' => 'px',
4135 'size' => - 17,
4136 ],
4137 'selectors' => [
4138 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style4::before' => 'bottom: {{SIZE}}px;',
4139 '{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style4::after' => 'bottom: calc({{SIZE}}px + 2px)',
4140 ],
4141 'condition' => [
4142 'section_title_style' => [ 'style4' ],
4143 ],
4144 ]
4145 );
4146
4147 $ref->add_control(
4148 'prefix_text_color',
4149 [
4150 'label' => esc_html__( 'Prefix Color', 'the-post-grid' ),
4151 'type' => Controls_Manager::COLOR,
4152 'selectors' => [
4153 '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .prefix-text' => 'color: {{VALUE}}',
4154 ],
4155 'condition' => [
4156 'section_title_source' => 'page_title',
4157 ],
4158 ]
4159 );
4160 $ref->add_control(
4161 'suffix_text_color',
4162 [
4163 'label' => esc_html__( 'Suffix Color', 'the-post-grid' ),
4164 'type' => Controls_Manager::COLOR,
4165 'selectors' => [
4166 '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .suffix-text' => 'color: {{VALUE}}',
4167 ],
4168 'condition' => [
4169 'section_title_source' => 'page_title',
4170 ],
4171 ]
4172 );
4173
4174 $ref->add_control(
4175 'external_icon_color',
4176 [
4177 'label' => esc_html__( 'External Link Color', 'the-post-grid' ),
4178 'type' => Controls_Manager::COLOR,
4179 'selectors' => [
4180 '{{WRAPPER}} .tpg-widget-heading-wrapper .external-link' => 'color: {{VALUE}}',
4181 ],
4182 ]
4183 );
4184
4185 $ref->add_control(
4186 'external_icon_color_hover',
4187 [
4188 'label' => esc_html__( 'External Link Color - Hover', 'the-post-grid' ),
4189 'type' => Controls_Manager::COLOR,
4190 'selectors' => [
4191 '{{WRAPPER}} .tpg-widget-heading-wrapper .external-link:hover' => 'color: {{VALUE}}',
4192 ],
4193 ]
4194 );
4195
4196 $ref->add_responsive_control(
4197 'external_icon_size',
4198 [
4199 'label' => esc_html__( 'External Icon Size', 'the-post-grid' ),
4200 'type' => Controls_Manager::SLIDER,
4201 'size_units' => [ 'px' ],
4202 'range' => [
4203 'px' => [
4204 'min' => 0,
4205 'max' => 50,
4206 'step' => 1,
4207 ],
4208 ],
4209 'selectors' => [
4210 '{{WRAPPER}} .tpg-widget-heading-wrapper .external-link' => 'font-size: {{SIZE}}px;',
4211 ],
4212 ]
4213 );
4214
4215 $ref->add_responsive_control(
4216 'external_icon_position',
4217 [
4218 'label' => esc_html__( 'External Icon Y Position', 'the-post-grid' ),
4219 'type' => Controls_Manager::SLIDER,
4220 'size_units' => [ 'px' ],
4221 'range' => [
4222 'px' => [
4223 'min' => - 70,
4224 'max' => 70,
4225 'step' => 1,
4226 ],
4227 ],
4228 'selectors' => [
4229 '{{WRAPPER}} .tpg-widget-heading-wrapper .external-link' => 'top: {{SIZE}}px;',
4230 ],
4231 ]
4232 );
4233
4234 if ( 'archive' == $layout_type ) {
4235 $ref->add_control(
4236 'cat_tag_description_heading',
4237 [
4238 'label' => esc_html__( 'Category / Tag Description', 'the-post-grid' ),
4239 'type' => Controls_Manager::HEADING,
4240 'classes' => 'tpg-control-type-heading',
4241 'condition' => [
4242 'show_cat_desc' => 'yes',
4243 ],
4244 ]
4245 );
4246
4247 $ref->add_group_control(
4248 Group_Control_Typography::get_type(),
4249 [
4250 'name' => 'taxonomy_des_typography',
4251 'label' => esc_html__( 'Description Typography', 'the-post-grid' ),
4252 'selector' => '{{WRAPPER}} .tpg-category-description',
4253 'condition' => [
4254 'show_cat_desc' => 'yes',
4255 ],
4256 ]
4257 );
4258
4259 $ref->add_responsive_control(
4260 'taxonomy_des_alignment',
4261 [
4262 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
4263 'type' => Controls_Manager::CHOOSE,
4264 'options' => [
4265 'left' => [
4266 'title' => esc_html__( 'Left', 'the-post-grid' ),
4267 'icon' => 'eicon-text-align-left',
4268 ],
4269 'center' => [
4270 'title' => esc_html__( 'Center', 'the-post-grid' ),
4271 'icon' => 'eicon-text-align-center',
4272 ],
4273 'right' => [
4274 'title' => esc_html__( 'Right', 'the-post-grid' ),
4275 'icon' => 'eicon-text-align-right',
4276 ],
4277 ],
4278 'selectors' => [
4279 '{{WRAPPER}} .tpg-category-description' => 'text-align: {{VALUE}}',
4280 ],
4281 'condition' => [
4282 'show_cat_desc' => 'yes',
4283 ],
4284 ]
4285 );
4286
4287 $ref->add_control(
4288 'taxonomy_des_color',
4289 [
4290 'label' => esc_html__( 'Title Color', 'the-post-grid' ),
4291 'type' => Controls_Manager::COLOR,
4292 'selectors' => [
4293 '{{WRAPPER}} .tpg-category-description' => 'color: {{VALUE}}',
4294 ],
4295 'condition' => [
4296 'show_cat_desc' => 'yes',
4297 ],
4298 ]
4299 );
4300
4301 $ref->add_responsive_control(
4302 'taxonomy_des_dimension',
4303 [
4304 'label' => esc_html__( 'Padding', 'the-post-grid' ),
4305 'type' => Controls_Manager::DIMENSIONS,
4306 'size_units' => [ 'px' ],
4307 'selectors' => [
4308 '{{WRAPPER}} .tpg-category-description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4309 ],
4310 'condition' => [
4311 'show_cat_desc' => 'yes',
4312 ],
4313 ]
4314 );
4315 }
4316
4317 $ref->end_controls_section();
4318 }
4319
4320 /**
4321 * Thumbnail Style Tab
4322 *
4323 * @param $ref
4324 */
4325 public static function thumbnailStyle( $ref ) {
4326 $prefix = $ref->prefix;
4327 // Thumbnail style
4328 // ========================================================
4329 $ref->start_controls_section(
4330 'thumbnail_style',
4331 [
4332 'label' => esc_html__( 'Thumbnail', 'the-post-grid' ),
4333 'tab' => Controls_Manager::TAB_STYLE,
4334 'condition' => [
4335 'show_thumb' => 'show',
4336 ],
4337 ]
4338 );
4339
4340 $ref->add_responsive_control(
4341 'img_border_radius',
4342 [
4343 'label' => esc_html__( 'Border Radius', 'the-post-grid' ) . $ref->pro_label,
4344 'type' => Controls_Manager::DIMENSIONS,
4345 'size_units' => [ 'px', '%', 'em' ],
4346 'allowed_dimensions' => 'all', // horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
4347 'default' => [
4348 'top' => '',
4349 'right' => '',
4350 'bottom' => '',
4351 'left' => '',
4352 'isLinked' => true,
4353 ],
4354 'selectors' => [
4355 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap, {{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img, {{WRAPPER}} .rt-grid-hover-item .grid-hover-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
4356 ],
4357 'description' => $ref->get_pro_message( 'image radius.' ),
4358 'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
4359 ]
4360 );
4361
4362 $ref->add_control(
4363 'image_width',
4364 [
4365 'label' => esc_html__( 'Image Width (Optional)', 'the-post-grid' ),
4366 'type' => Controls_Manager::SELECT,
4367 'default' => 'inherit',
4368 'options' => [
4369 'inherit' => esc_html__( 'Default', 'the-post-grid' ),
4370 '100%' => esc_html__( '100%', 'the-post-grid' ),
4371 'auto' => esc_html__( 'Auto', 'the-post-grid' ),
4372 ],
4373 'selectors' => [
4374 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'width: {{VALUE}};',
4375 ],
4376 ]
4377 );
4378
4379 $ref->add_responsive_control(
4380 'thumbnail_content_width',
4381 [
4382 'label' => esc_html__( 'Thumbnail Content Width', 'the-post-grid' ),
4383 'type' => Controls_Manager::SLIDER,
4384 'size_units' => [ 'px' ],
4385 'range' => [
4386 'px' => [
4387 'min' => 100,
4388 'max' => 2000,
4389 'step' => 1,
4390 ],
4391 ],
4392 'selectors' => [
4393 '{{WRAPPER}} .tpg-el-main-wrapper .rt-grid-hover-item .rt-holder .grid-hover-content' => 'width: {{SIZE}}{{UNIT}};margin-left:auto;margin-right:auto;',
4394 ],
4395 'condition' => [
4396 $prefix . '_layout' => 'slider-layout7',
4397 ],
4398 ]
4399 );
4400
4401 $ref->add_responsive_control(
4402 'thumbnail_content_margin',
4403 [
4404 'label' => esc_html__( 'Thumbnail Content Margin', 'the-post-grid' ),
4405 'type' => Controls_Manager::DIMENSIONS,
4406 'size_units' => [ 'px', 'custom' ],
4407 'allowed_dimensions' => 'all',
4408 'selectors' => [
4409 '{{WRAPPER}} .tpg-el-main-wrapper .rt-grid-hover-item .rt-holder .grid-hover-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4410 ],
4411 'condition' => [
4412 $prefix . '_layout' => 'slider-layout7',
4413 ],
4414 'default' => [
4415 'top' => '',
4416 'right' => '',
4417 'bottom' => '',
4418 'left' => '',
4419 'isLinked' => false,
4420 ],
4421 ]
4422 );
4423
4424 if ( 'grid_hover' != $prefix ) {
4425 $ref->add_responsive_control(
4426 'thumbnail_spacing',
4427 [
4428 'label' => esc_html__( 'Thumbnail Margin', 'the-post-grid' ),
4429 'type' => Controls_Manager::DIMENSIONS,
4430 'size_units' => [ 'px' ],
4431 'selectors' => [
4432 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4433 ],
4434 'default' => [
4435 'top' => '',
4436 'right' => '',
4437 'bottom' => '',
4438 'left' => '',
4439 'isLinked' => false,
4440 ],
4441 ]
4442 );
4443 }
4444
4445 if ( in_array( $prefix, [ 'grid_hover', 'slider' ] ) ) {
4446 if ( 'slider' == $prefix ) {
4447 $thumbnail_padding_condition = [
4448 'slider_layout' => [
4449 'slider-layout4',
4450 'slider-layout5',
4451 'slider-layout6',
4452 'slider-layout7',
4453 'slider-layout8',
4454 'slider-layout9',
4455 'slider-layout10',
4456 ],
4457 ];
4458 } else {
4459 $thumbnail_padding_condition = [
4460 'grid_hover_layout!' => '',
4461 ];
4462 }
4463 $ref->add_responsive_control(
4464 'grid_hover_thumbnail_margin',
4465 [
4466 'label' => esc_html__( 'Thumbnail padding', 'the-post-grid' ),
4467 'type' => Controls_Manager::DIMENSIONS,
4468 'size_units' => [ 'px' ],
4469 'selectors' => [
4470 '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4471 '{{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper .gallery-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4472 ],
4473 'condition' => $thumbnail_padding_condition,
4474 ]
4475 );
4476 }
4477
4478 // Overlay Style Heading
4479
4480 $ref->add_control(
4481 'thumb_overlay_style_heading',
4482 [
4483 'label' => esc_html__( 'Overlay Style:', 'the-post-grid' ),
4484 'type' => Controls_Manager::HEADING,
4485 'classes' => 'tpg-control-type-heading',
4486 ]
4487 );
4488
4489 // Tab normal
4490 $ref->start_controls_tabs(
4491 'grid_hover_style_tabs'
4492 );
4493
4494 $ref->start_controls_tab(
4495 'grid_hover_style_normal_tab',
4496 [
4497 'label' => esc_html__( 'Normal', 'the-post-grid' ),
4498 ]
4499 );
4500
4501 $ref->add_group_control(
4502 \Elementor\Group_Control_Background::get_type(),
4503 [
4504 'name' => 'grid_hover_overlay_color',
4505 'label' => esc_html__( 'Overlay BG', 'the-post-grid' ),
4506 'types' => [ 'classic', 'gradient' ],
4507 'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:before, {{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap .overlay',
4508 'exclude' => [ 'image' ],
4509 'fields_options' => [
4510 'background' => [
4511 'label' => esc_html__( 'Overlay Background Type', 'the-post-grid' ),
4512 ],
4513 'color' => [
4514 'label' => 'Background Color',
4515 ],
4516 'color_b' => [
4517 'label' => 'Background Color 2',
4518 ],
4519 ],
4520 ]
4521 );
4522
4523 $ref->add_control(
4524 'thumb_lightbox_bg',
4525 [
4526 'label' => esc_html__( 'Light Box Background', 'the-post-grid' ),
4527 'type' => Controls_Manager::COLOR,
4528 'selectors' => [
4529 '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom i' => 'background-color: {{VALUE}}',
4530 ],
4531 'condition' => [
4532 'is_thumb_lightbox' => 'show',
4533 ],
4534 ]
4535 );
4536
4537 $ref->add_control(
4538 'thumb_lightbox_color',
4539 [
4540 'label' => esc_html__( 'Light Box Color', 'the-post-grid' ),
4541 'type' => Controls_Manager::COLOR,
4542 'selectors' => [
4543 '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom i' => 'color: {{VALUE}}',
4544 ],
4545 'condition' => [
4546 'is_thumb_lightbox' => 'show',
4547 ],
4548 ]
4549 );
4550
4551 $ref->add_control(
4552 'thumbnail_position',
4553 [
4554 'label' => esc_html__( 'Thumb Position', 'the-post-grid' ),
4555 'type' => Controls_Manager::SELECT,
4556 'default' => 'inherit',
4557 'options' => [
4558 '' => esc_html__( 'Center Center', 'the-post-grid' ),
4559 'top center' => esc_html__( 'Top Center', 'the-post-grid' ),
4560 'bottom center' => esc_html__( 'Bottom Center', 'the-post-grid' ),
4561 'center left' => esc_html__( 'Left Center', 'the-post-grid' ),
4562 'center right' => esc_html__( 'Right Center', 'the-post-grid' ),
4563 ],
4564 'selectors' => [
4565 '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder .tpg-el-image-wrap img' => 'object-position: {{VALUE}};',
4566 ],
4567 ]
4568 );
4569
4570 $ref->add_responsive_control(
4571 'thumbnail_opacity',
4572 [
4573 'label' => esc_html__( 'Thumbnail Opacity', 'the-post-grid' ),
4574 'type' => Controls_Manager::SLIDER,
4575 'size_units' => [ 'px' ],
4576 'range' => [
4577 'px' => [
4578 'min' => 0,
4579 'max' => 1,
4580 'step' => 0.1,
4581 ],
4582 ],
4583 'selectors' => [
4584 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'opacity: {{SIZE}};',
4585 ],
4586 ]
4587 );
4588
4589 $ref->end_controls_tab();
4590
4591 // Tab Hover
4592 $ref->start_controls_tab(
4593 'grid_hover_style_hover_tab',
4594 [
4595 'label' => esc_html__( 'Hover', 'the-post-grid' ),
4596 ]
4597 );
4598
4599 $ref->add_group_control(
4600 \Elementor\Group_Control_Background::get_type(),
4601 [
4602 'name' => 'grid_hover_overlay_color_hover',
4603 'label' => esc_html__( 'Overlay BG - Hover', 'the-post-grid' ),
4604 'types' => [ 'classic', 'gradient' ],
4605 'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:after, {{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap .overlay',
4606 'exclude' => [ 'image' ],
4607 'fields_options' => [
4608 'background' => [
4609 'label' => esc_html__( 'Overlay Background Type - Hover', 'the-post-grid' ),
4610 ],
4611 'color' => [
4612 'label' => 'Background Color',
4613 ],
4614 'color_b' => [
4615 'label' => 'Background Color 2',
4616 ],
4617 ],
4618 ]
4619 );
4620
4621 $ref->add_control(
4622 'thumb_lightbox_bg_hover',
4623 [
4624 'label' => esc_html__( 'Light Box Background - Hover', 'the-post-grid' ),
4625 'type' => Controls_Manager::COLOR,
4626 'selectors' => [
4627 '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}',
4628 ],
4629 'condition' => [
4630 'is_thumb_lightbox' => 'show',
4631 ],
4632 ]
4633 );
4634
4635 $ref->add_control(
4636 'thumb_lightbox_color_hover',
4637 [
4638 'label' => esc_html__( 'Light Box Color - Hover', 'the-post-grid' ),
4639 'type' => Controls_Manager::COLOR,
4640 'selectors' => [
4641 '{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}',
4642 ],
4643 'condition' => [
4644 'is_thumb_lightbox' => 'show',
4645 ],
4646 ]
4647 );
4648
4649 $ref->add_control(
4650 'thumbnail_position_hover',
4651 [
4652 'label' => esc_html__( 'Thumb Position - Hover', 'the-post-grid' ),
4653 'type' => Controls_Manager::SELECT,
4654 'default' => 'inherit',
4655 'options' => [
4656 '' => esc_html__( 'Center Center', 'the-post-grid' ),
4657 'top center' => esc_html__( 'Top Center', 'the-post-grid' ),
4658 'bottom center' => esc_html__( 'Bottom Center', 'the-post-grid' ),
4659 'center left' => esc_html__( 'Left Center', 'the-post-grid' ),
4660 'center right' => esc_html__( 'Right Center', 'the-post-grid' ),
4661 ],
4662 'selectors' => [
4663 '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap img' => 'object-position: {{VALUE}};',
4664 ],
4665 ]
4666 );
4667
4668 $ref->add_responsive_control(
4669 'thumbnail_opacity_hover',
4670 [
4671 'label' => esc_html__( 'Thumbnail Opacity - Hover', 'the-post-grid' ),
4672 'type' => Controls_Manager::SLIDER,
4673 'size_units' => [ 'px' ],
4674 'range' => [
4675 'px' => [
4676 'min' => 0,
4677 'max' => 1,
4678 'step' => 0.1,
4679 ],
4680 ],
4681 'selectors' => [
4682 '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap img ' => 'opacity: {{SIZE}};',
4683 ],
4684 ]
4685 );
4686
4687 $ref->end_controls_tab();
4688
4689 $ref->end_controls_tabs();
4690
4691 // End Tab Hover
4692
4693 $ref->add_responsive_control(
4694 'thumbnail_transition_duration',
4695 [
4696 'label' => esc_html__( 'Thumbnail Transition Duration', 'the-post-grid' ),
4697 'type' => Controls_Manager::SLIDER,
4698 'size_units' => [ 'px' ],
4699 'range' => [
4700 'px' => [
4701 'min' => 0,
4702 'max' => 10,
4703 'step' => 0.1,
4704 ],
4705 ],
4706 'selectors' => [
4707 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img ' => 'transition-duration: {{SIZE}}s;',
4708 ],
4709 ]
4710 );
4711
4712 $ref->add_control(
4713 'hr_for_overlay',
4714 [
4715 'type' => Controls_Manager::DIVIDER,
4716 ]
4717 );
4718
4719 $overlay_type_opt = [
4720 'always' => esc_html__( 'Show Always', 'the-post-grid' ),
4721 'fadein-on-hover' => esc_html__( 'FadeIn on hover', 'the-post-grid' ),
4722 'fadeout-on-hover' => esc_html__( 'FadeOut on hover', 'the-post-grid' ),
4723 'slidein-on-hover' => esc_html__( 'SlideIn on hover', 'the-post-grid' ),
4724 'slideout-on-hover' => esc_html__( 'SlideOut on hover', 'the-post-grid' ),
4725 'zoomin-on-hover' => esc_html__( 'ZoomIn on hover', 'the-post-grid' ),
4726 'zoomout-on-hover' => esc_html__( 'ZoomOut on hover', 'the-post-grid' ),
4727 'zoominall-on-hover' => esc_html__( 'ZoomIn Content on hover', 'the-post-grid' ),
4728 'zoomoutall-on-hover' => esc_html__( 'ZoomOut Content on hover', 'the-post-grid' ),
4729 ];
4730
4731 if ( $ref->prefix == 'grid_hover' || $ref->prefix == 'slider' ) {
4732 $overlay_type_opt2 = [
4733 'flipin-on-hover' => esc_html__( 'FlipIn on hover', 'the-post-grid' ),
4734 'flipout-on-hover' => esc_html__( 'FlipOut on hover', 'the-post-grid' ),
4735 ];
4736 $overlay_type_opt = array_merge( $overlay_type_opt, $overlay_type_opt2 );
4737 }
4738
4739 $ref->add_control(
4740 'grid_hover_overlay_type',
4741 [
4742 'label' => esc_html__( 'Overlay Interaction', 'the-post-grid' ),
4743 'type' => Controls_Manager::SELECT,
4744 'default' => 'always',
4745 'options' => $overlay_type_opt,
4746 'description' => esc_html__( 'If you don\'t choose overlay background then it will work only for some selected layout ', 'the-post-grid' ),
4747 'prefix_class' => 'grid-hover-overlay-type-',
4748 ]
4749 );
4750
4751 $overlay_height_condition = [
4752 'grid_hover_layout!' => [ 'grid_hover-layout3' ],
4753 ];
4754 if ( $ref->prefix === 'slider' ) {
4755 $overlay_height_condition = [
4756 'slider_layout!' => [ '' ],
4757 ];
4758 }
4759 $ref->add_control(
4760 'grid_hover_overlay_height',
4761 [
4762 'label' => esc_html__( 'Overlay Height', 'the-post-grid' ),
4763 'type' => Controls_Manager::SELECT,
4764 'default' => 'default',
4765 'options' => [
4766 'default' => esc_html__( 'Default', 'the-post-grid' ),
4767 'full' => esc_html__( '100%', 'the-post-grid' ),
4768 'auto' => esc_html__( 'Auto', 'the-post-grid' ),
4769 ],
4770 'condition' => $overlay_height_condition,
4771 'prefix_class' => 'grid-hover-overlay-height-',
4772 ]
4773 );
4774
4775 $ref->add_control(
4776 'on_hover_overlay',
4777 [
4778 'label' => esc_html__( 'Overlay Height on hover', 'the-post-grid' ),
4779 'type' => Controls_Manager::SELECT,
4780 'default' => 'default',
4781 'options' => [
4782 'default' => esc_html__( 'Default', 'the-post-grid' ),
4783 'full' => esc_html__( '100%', 'the-post-grid' ),
4784 'auto' => esc_html__( 'Auto', 'the-post-grid' ),
4785 ],
4786 'condition' => $overlay_height_condition,
4787 'prefix_class' => 'hover-overlay-height-',
4788 ]
4789 );
4790
4791 $ref->end_controls_section();
4792 }
4793
4794 /**
4795 * Post Title Style
4796 *
4797 * @param $ref
4798 */
4799 public static function titleStyle( $ref ) {
4800 $prefix = $ref->prefix;
4801
4802 $ref->start_controls_section(
4803 'title_style',
4804 [
4805 'label' => esc_html__( 'Post Title', 'the-post-grid' ),
4806 'tab' => Controls_Manager::TAB_STYLE,
4807 'condition' => [
4808 'show_title' => 'show',
4809 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
4810 ],
4811 ]
4812 );
4813
4814 $ref->add_responsive_control(
4815 'title_spacing',
4816 [
4817 'label' => esc_html__( 'Title Margin', 'the-post-grid' ),
4818 'type' => Controls_Manager::DIMENSIONS,
4819 'size_units' => [ 'px' ],
4820 'selectors' => [
4821 '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4822 ],
4823 'allowed_dimensions' => 'all',
4824 'default' => [
4825 'top' => '',
4826 'right' => '',
4827 'bottom' => '',
4828 'left' => '',
4829 'isLinked' => false,
4830 ],
4831 ]
4832 );
4833
4834 $ref->add_responsive_control(
4835 'title_padding',
4836 [
4837 'label' => esc_html__( 'Title Padding', 'the-post-grid' ),
4838 'type' => Controls_Manager::DIMENSIONS,
4839 'size_units' => [ 'px' ],
4840 'selectors' => [
4841 '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
4842 ],
4843 'allowed_dimensions' => 'all',
4844 'default' => [
4845 'top' => '',
4846 'right' => '',
4847 'bottom' => '',
4848 'left' => '',
4849 'isLinked' => false,
4850 ],
4851 ]
4852 );
4853
4854 $ref->add_responsive_control(
4855 'title_min_height',
4856 [
4857 'label' => esc_html__( 'Title Minimum Height (Optional)', 'the-post-grid' ),
4858 'type' => Controls_Manager::SLIDER,
4859 'size_units' => [ 'px' ],
4860 'range' => [
4861 'px' => [
4862 'min' => 0,
4863 'max' => 300,
4864 'step' => 1,
4865 ],
4866 ],
4867 'selectors' => [
4868 '{{WRAPPER}} .rt-tpg-container .entry-title-wrapper' => 'min-height: {{SIZE}}{{UNIT}};',
4869 ],
4870 ]
4871 );
4872
4873 $ref->add_group_control(
4874 Group_Control_Typography::get_type(),
4875 [
4876 'name' => 'title_typography',
4877 'label' => esc_html__( 'Typography', 'the-post-grid' ),
4878 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .entry-title-wrapper .entry-title',
4879 ]
4880 );
4881
4882 // Offset Title
4883 $ref->add_group_control(
4884 Group_Control_Typography::get_type(),
4885 [
4886 'name' => 'title_offset_typography',
4887 'label' => esc_html__( 'Offset Typography', 'the-post-grid' ),
4888 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .offset-left .entry-title-wrapper .entry-title',
4889 'description' => esc_html__( 'You can overwrite offset title font style', 'the-post-grid' ),
4890 'condition' => [
4891 $prefix . '_layout' => [
4892 'grid-layout5',
4893 'grid-layout5-2',
4894 'grid-layout6',
4895 'grid-layout6-2',
4896 'list-layout2',
4897 'list-layout3',
4898 'list-layout2-2',
4899 'list-layout3-2',
4900 'grid_hover-layout4',
4901 'grid_hover-layout4-2',
4902 'grid_hover-layout5',
4903 'grid_hover-layout5-2',
4904 'grid_hover-layout6',
4905 'grid_hover-layout6-2',
4906 'grid_hover-layout7',
4907 'grid_hover-layout7-2',
4908 'grid_hover-layout9',
4909 'grid_hover-layout9-2',
4910 ],
4911 ],
4912 ]
4913 );
4914
4915 $ref->add_control(
4916 'title_border_visibility',
4917 [
4918 'label' => esc_html__( 'Title Border Bottom', 'the-post-grid' ),
4919 'type' => Controls_Manager::SELECT,
4920 'default' => 'default',
4921 'options' => [
4922 'default' => esc_html__( 'Default', 'the-post-grid' ),
4923 'show' => esc_html__( 'Show', 'the-post-grid' ),
4924 'hide' => esc_html__( 'Hide', 'the-post-grid' ),
4925 ],
4926 'prefix_class' => 'tpg-title-border-',
4927 'condition' => [
4928 $prefix . '_layout' => 'grid_hover-layout3',
4929 ],
4930 ]
4931 );
4932
4933 $ref->add_responsive_control(
4934 'title_alignment',
4935 [
4936 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
4937 'type' => Controls_Manager::CHOOSE,
4938 'options' => [
4939 'left' => [
4940 'title' => esc_html__( 'Left', 'the-post-grid' ),
4941 'icon' => 'eicon-text-align-left',
4942 ],
4943 'center' => [
4944 'title' => esc_html__( 'Center', 'the-post-grid' ),
4945 'icon' => 'eicon-text-align-center',
4946 ],
4947 'right' => [
4948 'title' => esc_html__( 'Right', 'the-post-grid' ),
4949 'icon' => 'eicon-text-align-right',
4950 ],
4951 'justify' => [
4952 'title' => esc_html__( 'Justify', 'the-post-grid' ),
4953 'icon' => 'eicon-text-align-justify',
4954 ],
4955 ],
4956 'prefix_class' => 'title-alignment-',
4957 'toggle' => true,
4958 'selectors' => [
4959 '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'text-align: {{VALUE}};',
4960 ],
4961 ]
4962 );
4963
4964 // Start Title Style Tba
4965 $ref->start_controls_tabs(
4966 'title_style_tabs'
4967 );
4968
4969 $ref->start_controls_tab(
4970 'title_normal_tab',
4971 [
4972 'label' => esc_html__( 'Normal', 'the-post-grid' ),
4973 ]
4974 );
4975 // Normal Tab
4976 $ref->add_control(
4977 'title_color',
4978 [
4979 'label' => esc_html__( 'Title Color', 'the-post-grid' ),
4980 'type' => Controls_Manager::COLOR,
4981 'selectors' => [
4982 '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'color: {{VALUE}}',
4983 ],
4984 ]
4985 );
4986
4987 $ref->add_control(
4988 'title_bg_color',
4989 [
4990 'label' => esc_html__( 'Title Background', 'the-post-grid' ),
4991 'type' => Controls_Manager::COLOR,
4992 'selectors' => [
4993 '{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'background-color: {{VALUE}}',
4994 ],
4995 ]
4996 );
4997
4998 $ref->add_control(
4999 'title_border_color',
5000 [
5001 'label' => esc_html__( 'Title Separator Color', 'the-post-grid' ),
5002 'type' => Controls_Manager::COLOR,
5003 'selectors' => [
5004 '{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}',
5005 ],
5006 'condition' => [
5007 $prefix . '_layout' => 'grid_hover-layout3',
5008 'title_border_visibility!' => 'hide',
5009 ],
5010 ]
5011 );
5012
5013 $ref->end_controls_tab();
5014
5015 $ref->start_controls_tab(
5016 'title_hover_tab',
5017 [
5018 'label' => esc_html__( 'Hover', 'the-post-grid' ),
5019 ]
5020 );
5021
5022 // Hover Tab
5023 $ref->add_control(
5024 'title_hover_color',
5025 [
5026 'label' => esc_html__( 'Title Color on Hover', 'the-post-grid' ),
5027 'type' => Controls_Manager::COLOR,
5028 'selectors' => [
5029 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title:hover' => 'color: {{VALUE}} !important',
5030 ],
5031 ]
5032 );
5033
5034 $ref->add_control(
5035 'title_bg_color_hover',
5036 [
5037 'label' => esc_html__( 'Title Background on hover', 'the-post-grid' ),
5038 'type' => Controls_Manager::COLOR,
5039 'selectors' => [
5040 '{{WRAPPER}} .tpg-el-main-wrapper .entry-title:hover' => 'background-color: {{VALUE}} !important',
5041 ],
5042 ]
5043 );
5044
5045 $ref->add_control(
5046 'title_hover_border_color',
5047 [
5048 'label' => esc_html__( 'Title Hover Border Color', 'the-post-grid' ),
5049 'type' => Controls_Manager::COLOR,
5050 'selectors' => [
5051 '{{WRAPPER}}' => '--tpg-primary-color: {{VALUE}}',
5052 ],
5053 'condition' => [
5054 'title_hover_underline' => 'enable',
5055 ],
5056 ]
5057 );
5058
5059 $ref->end_controls_tab();
5060
5061 $ref->start_controls_tab(
5062 'title_box_hover_tab',
5063 [
5064 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
5065 ]
5066 );
5067
5068 // Box Hover Tab
5069 $ref->add_control(
5070 'title_color_box_hover',
5071 [
5072 'label' => esc_html__( 'Title color on boxhover', 'the-post-grid' ),
5073 'type' => Controls_Manager::COLOR,
5074 'selectors' => [
5075 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'color: {{VALUE}}',
5076 ],
5077 ]
5078 );
5079
5080 $ref->add_control(
5081 'title_bg_color_box_hover',
5082 [
5083 'label' => esc_html__( 'Title Background on boxhover', 'the-post-grid' ),
5084 'type' => Controls_Manager::COLOR,
5085 'selectors' => [
5086 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'background-color: {{VALUE}}',
5087 ],
5088 ]
5089 );
5090
5091 $ref->add_control(
5092 'title_border_color_hover',
5093 [
5094 'label' => esc_html__( 'Title Separator color - boxhover', 'the-post-grid' ),
5095 'type' => Controls_Manager::COLOR,
5096 'selectors' => [
5097 '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}',
5098 ],
5099 'condition' => [
5100 $prefix . '_layout' => 'grid_hover-layout3',
5101 'title_border_visibility!' => 'hide',
5102 ],
5103 ]
5104 );
5105
5106 $ref->end_controls_tab();
5107
5108 $ref->end_controls_tabs();
5109
5110 $ref->end_controls_section();
5111 }
5112
5113 /**
5114 * Content Style / Excerpt Style Tab
5115 *
5116 * @param $ref
5117 */
5118 public static function contentStyle( $ref ) {
5119 $prefix = $ref->prefix;
5120
5121 $ref->start_controls_section(
5122 'excerpt_style',
5123 [
5124 'label' => esc_html__( 'Excerpt / Content', 'the-post-grid' ),
5125 'tab' => Controls_Manager::TAB_STYLE,
5126 'condition' => [
5127 'show_excerpt' => 'show',
5128 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
5129 ],
5130 ]
5131 );
5132
5133 $ref->add_group_control(
5134 Group_Control_Typography::get_type(),
5135 [
5136 'name' => 'content_typography',
5137 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner',
5138 ]
5139 );
5140
5141 $ref->add_responsive_control(
5142 'excerpt_spacing',
5143 [
5144 'label' => esc_html__( 'Excerpt Spacing', 'the-post-grid' ),
5145 'type' => Controls_Manager::DIMENSIONS,
5146 'size_units' => [ 'px' ],
5147 'selectors' => [
5148 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5149 ],
5150 'allowed_dimensions' => 'all',
5151 'default' => [
5152 'top' => '',
5153 'right' => '',
5154 'bottom' => '',
5155 'left' => '',
5156 'isLinked' => false,
5157 ],
5158 ]
5159 );
5160
5161 $ref->add_responsive_control(
5162 'content_alignment',
5163 [
5164 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
5165 'type' => Controls_Manager::CHOOSE,
5166 'options' => [
5167 'left' => [
5168 'title' => esc_html__( 'Left', 'the-post-grid' ),
5169 'icon' => 'eicon-text-align-left',
5170 ],
5171 'center' => [
5172 'title' => esc_html__( 'Center', 'the-post-grid' ),
5173 'icon' => 'eicon-text-align-center',
5174 ],
5175 'right' => [
5176 'title' => esc_html__( 'Right', 'the-post-grid' ),
5177 'icon' => 'eicon-text-align-right',
5178 ],
5179 'justify' => [
5180 'title' => esc_html__( 'Justify', 'the-post-grid' ),
5181 'icon' => 'eicon-text-align-justify',
5182 ],
5183 ],
5184 'toggle' => true,
5185 'selectors' => [
5186 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'text-align: {{VALUE}}',
5187 ],
5188 ]
5189 );
5190
5191 // Start Content Tab
5192
5193 $ref->start_controls_tabs(
5194 'excerpt_style_tabs'
5195 );
5196
5197 $ref->start_controls_tab(
5198 'excerpt_normal_tab',
5199 [
5200 'label' => esc_html__( 'Normal', 'the-post-grid' ),
5201 ]
5202 );
5203
5204 // Normal Tab
5205 $ref->add_control(
5206 'excerpt_color',
5207 [
5208 'label' => esc_html__( 'Excerpt color', 'the-post-grid' ),
5209 'type' => Controls_Manager::COLOR,
5210 'selectors' => [
5211 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}}',
5212 ],
5213 ]
5214 );
5215
5216 $ref->add_control(
5217 'excerpt_border',
5218 [
5219 'label' => esc_html__( 'Border color', 'the-post-grid' ),
5220 'type' => Controls_Manager::COLOR,
5221 'selectors' => [
5222 '{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder .rt-el-post-meta::before' => 'background: {{VALUE}}',
5223 ],
5224 'condition' => [
5225 'meta_position' => 'default',
5226 $prefix . '_layout' => [ 'grid-layout3' ],
5227 ],
5228 ]
5229 );
5230
5231 $ref->end_controls_tab();
5232
5233 $ref->start_controls_tab(
5234 'excerpt_hover_tab',
5235 [
5236 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
5237 ]
5238 );
5239
5240 // Hover Tab
5241 $ref->add_control(
5242 'excerpt_hover_color',
5243 [
5244 'label' => esc_html__( 'Excerpt color on hover', 'the-post-grid' ),
5245 'type' => Controls_Manager::COLOR,
5246 'selectors' => [
5247 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}} !important',
5248 ],
5249 ]
5250 );
5251
5252 $ref->add_control(
5253 'excerpt_border_hover',
5254 [
5255 'label' => esc_html__( 'Border color - Hover', 'the-post-grid' ),
5256 'type' => Controls_Manager::COLOR,
5257 'selectors' => [
5258 '{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder:hover .rt-el-post-meta::before' => 'background: {{VALUE}}',
5259 ],
5260 'condition' => [
5261 'meta_position' => 'default',
5262 $prefix . '_layout' => [ 'grid-layout3' ],
5263 ],
5264 ]
5265 );
5266
5267 $ref->end_controls_tab();
5268
5269 $ref->end_controls_tabs();
5270
5271 $ref->end_controls_section();
5272 }
5273
5274 /**
5275 * Post Meta Style
5276 *
5277 * @param $ref
5278 */
5279 public static function metaInfoStyle( $ref ) {
5280 $prefix = $ref->prefix;
5281
5282 $ref->start_controls_section(
5283 'post_meta_style',
5284 [
5285 'label' => esc_html__( 'Meta Data', 'the-post-grid' ),
5286 'tab' => Controls_Manager::TAB_STYLE,
5287 'condition' => [
5288 'show_meta' => 'show',
5289 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
5290 ],
5291 ]
5292 );
5293
5294 $ref->add_group_control(
5295 Group_Control_Typography::get_type(),
5296 [
5297 'name' => 'post_meta_typography',
5298 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-el-post-meta, {{WRAPPER}} .tpg-post-holder .tpg-separate-category .categories-links a',
5299 ]
5300 );
5301 $ref->add_responsive_control(
5302 'post_meta_alignment',
5303 [
5304 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
5305 'type' => Controls_Manager::CHOOSE,
5306 'options' => [
5307 'left' => [
5308 'title' => esc_html__( 'Left', 'the-post-grid' ),
5309 'icon' => 'eicon-text-align-left',
5310 ],
5311 'center' => [
5312 'title' => esc_html__( 'Center', 'the-post-grid' ),
5313 'icon' => 'eicon-text-align-center',
5314 ],
5315 'right' => [
5316 'title' => esc_html__( 'Right', 'the-post-grid' ),
5317 'icon' => 'eicon-text-align-right',
5318 ],
5319 ],
5320 'toggle' => true,
5321 'selectors' => [
5322 '{{WRAPPER}} .rt-tpg-container .rt-el-post-meta' => 'text-align: {{VALUE}};justify-content: {{VALUE}}',
5323 ],
5324 ]
5325 );
5326
5327 $ref->add_responsive_control(
5328 'meta_spacing',
5329 [
5330 'label' => esc_html__( 'Meta Spacing', 'the-post-grid' ),
5331 'type' => Controls_Manager::DIMENSIONS,
5332 'size_units' => [ 'px' ],
5333 'selectors' => [
5334 '{{WRAPPER}} .tpg-el-main-wrapper .rt-holder .rt-el-post-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5335 ],
5336 'allowed_dimensions' => 'all',
5337 'default' => [
5338 'top' => '',
5339 'right' => '',
5340 'bottom' => '',
5341 'left' => '',
5342 'isLinked' => false,
5343 ],
5344 ]
5345 );
5346
5347 // Start Content Tab
5348
5349 $ref->start_controls_tabs(
5350 'meta_info_style_tabs'
5351 );
5352
5353 $ref->start_controls_tab(
5354 'meta_info_normal_tab',
5355 [
5356 'label' => esc_html__( 'Normal', 'the-post-grid' ),
5357 ]
5358 );
5359
5360 // Normal Tab
5361
5362 $ref->add_control(
5363 'meta_info_color',
5364 [
5365 'label' => esc_html__( 'Meta Color', 'the-post-grid' ),
5366 'type' => Controls_Manager::COLOR,
5367 'selectors' => [
5368 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span' => 'color: {{VALUE}}',
5369 ],
5370 ]
5371 );
5372
5373 $ref->add_control(
5374 'meta_link_color',
5375 [
5376 'label' => esc_html__( 'Meta Link Color', 'the-post-grid' ),
5377 'type' => Controls_Manager::COLOR,
5378 'selectors' => [
5379 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags a' => 'color: {{VALUE}}',
5380 ],
5381 ]
5382 );
5383
5384 $ref->add_control(
5385 'meta_separator_color',
5386 [
5387 'label' => esc_html__( 'Separator Color', 'the-post-grid' ),
5388 'type' => Controls_Manager::COLOR,
5389 'selectors' => [
5390 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .separator' => 'color: {{VALUE}}',
5391 ],
5392 'condition' => [
5393 'meta_separator!' => 'default',
5394 ],
5395 ]
5396 );
5397
5398 $ref->add_control(
5399 'meta_icon_color',
5400 [
5401 'label' => esc_html__( 'Icon Color', 'the-post-grid' ),
5402 'type' => Controls_Manager::COLOR,
5403 'selectors' => [
5404 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags i' => 'color: {{VALUE}}',
5405 ],
5406 ]
5407 );
5408
5409 $ref->end_controls_tab();
5410
5411 $ref->start_controls_tab(
5412 'meta_info_hover_tab',
5413 [
5414 'label' => esc_html__( 'Hover', 'the-post-grid' ),
5415 ]
5416 );
5417
5418 // Hover Tab
5419
5420 $ref->add_control(
5421 'meta_link_colo_hover',
5422 [
5423 'label' => esc_html__( 'Meta Link Color - Hover', 'the-post-grid' ),
5424 'type' => Controls_Manager::COLOR,
5425 'selectors' => [
5426 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .post-meta-tags a:hover' => 'color: {{VALUE}}',
5427 ],
5428 ]
5429 );
5430
5431 $ref->end_controls_tab();
5432
5433 $ref->start_controls_tab(
5434 'meta_info_box_hover_tab',
5435 [
5436 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
5437 ]
5438 );
5439
5440 // Box Hover Tab
5441
5442 $ref->add_control(
5443 'meta_link_colo_box_hover',
5444 [
5445 'label' => esc_html__( 'Meta Color - Box Hover', 'the-post-grid' ),
5446 'type' => Controls_Manager::COLOR,
5447 'selectors' => [
5448 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags *' => 'color: {{VALUE}}',
5449 ],
5450 ]
5451 );
5452
5453 $ref->end_controls_tab();
5454
5455 $ref->end_controls_tabs();
5456
5457 // Separate Category style
5458
5459 $ref->add_control(
5460 'separator_cat_heading',
5461 [
5462 'label' => esc_html__( 'Separate Category', 'the-post-grid' ),
5463 'description' => esc_html__( 'Separate Category', 'the-post-grid' ),
5464 'type' => Controls_Manager::HEADING,
5465 'classes' => 'tpg-control-type-heading',
5466 ]
5467 );
5468
5469 $ref->add_group_control(
5470 Group_Control_Typography::get_type(),
5471 [
5472 'name' => 'separator_cat_typography',
5473 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .categories-links a',
5474 ]
5475 );
5476
5477 $ref->add_control(
5478 'category_margin_bottom',
5479 [
5480 'label' => esc_html__( 'Category Margin Bottom', 'the-post-grid' ),
5481 'type' => Controls_Manager::NUMBER,
5482 'min' => 0,
5483 'max' => 50,
5484 'step' => 1,
5485 'condition' => [
5486 'category_position' => 'above_title',
5487 ],
5488 'selectors' => [
5489 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.above_title' => 'margin-bottom: {{VALUE}}px;',
5490 ],
5491 ]
5492 );
5493
5494 $ref->add_responsive_control(
5495 'category_radius',
5496 [
5497 'label' => esc_html__( 'Category Border Radius', 'the-post-grid' ),
5498 'type' => Controls_Manager::DIMENSIONS,
5499 'size_units' => [ 'px' ],
5500 'selectors' => [
5501 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5502 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5503 ],
5504 ]
5505 );
5506
5507 $ref->start_controls_tabs(
5508 'separate_cat_info_style_tabs'
5509 );
5510
5511 $ref->start_controls_tab(
5512 'separate_cat_normal_tab',
5513 [
5514 'label' => esc_html__( 'Normal', 'the-post-grid' ),
5515 ]
5516 );
5517
5518 // Normal Tab
5519
5520 $ref->add_control(
5521 'separate_category_color',
5522 [
5523 'label' => esc_html__( 'Category Color', 'the-post-grid' ),
5524 'type' => Controls_Manager::COLOR,
5525 'selectors' => [
5526 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links' => 'color: {{VALUE}}',
5527 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a' => 'color: {{VALUE}}',
5528 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'color: {{VALUE}}',
5529 ],
5530 ]
5531 );
5532 $ref->add_control(
5533 'separate_category_bg',
5534 [
5535 'label' => esc_html__( 'Category Background', 'the-post-grid' ),
5536 'type' => Controls_Manager::COLOR,
5537 'selectors' => [
5538 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links a' => 'background-color: {{VALUE}};padding: 3px 8px 1px;',
5539 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a' => 'background-color: {{VALUE}}',
5540 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category:not(.style1) .categories-links a:after' => 'border-top-color: {{VALUE}}',
5541 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a' => 'background-color: {{VALUE}}',
5542 ],
5543 'description' => rtTPG()->hasPro() ? esc_html__( 'If you use different background color then avoid this color', 'the-post-grid' ) : esc_html__( 'Choose separate category background', 'the-post-grid' ),
5544 ]
5545 );
5546 $ref->add_control(
5547 'separate_category_icon_color',
5548 [
5549 'label' => esc_html__( 'Category Icon Color', 'the-post-grid' ),
5550 'type' => Controls_Manager::COLOR,
5551 'selectors' => [
5552 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links i' => 'color: {{VALUE}}',
5553 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links i' => 'color: {{VALUE}}',
5554 ],
5555 'condition' => [
5556 'show_cat_icon' => 'yes',
5557 ],
5558 ]
5559 );
5560
5561 $ref->end_controls_tab();
5562
5563 $ref->start_controls_tab(
5564 'separate_cat_hover_tab',
5565 [
5566 'label' => esc_html__( 'Hover', 'the-post-grid' ),
5567 ]
5568 );
5569
5570 // Hover Tab
5571
5572 $ref->add_control(
5573 'separate_category_color_hover',
5574 [
5575 'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ),
5576 'type' => Controls_Manager::COLOR,
5577 'selectors' => [
5578 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links a:hover' => 'color: {{VALUE}} !important',
5579 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a:hover' => 'color: {{VALUE}} !important',
5580 ],
5581 ]
5582 );
5583
5584 $ref->add_control(
5585 'separate_category_bg_hover',
5586 [
5587 'label' => esc_html__( 'Category Background - Hover', 'the-post-grid' ),
5588 'type' => Controls_Manager::COLOR,
5589 'selectors' => [
5590 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links:hover' => 'background-color: {{VALUE}};padding: 3px 8px;',
5591 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links:not(.style1) a:hover' => 'background-color: {{VALUE}}',
5592 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links:not(.style1) a:hover::after' => 'border-top-color: {{VALUE}}',
5593 '{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .categories-links a:hover' => 'background-color: {{VALUE}}',
5594 ],
5595 ]
5596 );
5597
5598 $ref->end_controls_tab();
5599
5600 $ref->start_controls_tab(
5601 'separate_cat_box_hover_tab',
5602 [
5603 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
5604 ]
5605 );
5606
5607 // Box Hover Tab
5608
5609 $ref->add_control(
5610 'separate_category_color_box_hover',
5611 [
5612 'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ),
5613 'type' => Controls_Manager::COLOR,
5614 'selectors' => [
5615 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links a' => 'color: {{VALUE}}',
5616 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links a' => 'color: {{VALUE}}',
5617 ],
5618 ]
5619 );
5620 $ref->add_control(
5621 'separate_category_bg_box_hover',
5622 [
5623 'label' => esc_html__( 'Category Background - Box Hover', 'the-post-grid' ),
5624 'type' => Controls_Manager::COLOR,
5625 'selectors' => [
5626 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px;',
5627 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category:not(.style1) .categories-links a' => 'background-color: {{VALUE}}',
5628 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category:not(.style1) .categories-links a::after' => 'border-top-color: {{VALUE}}',
5629 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links a' => 'background-color: {{VALUE}}',
5630 ],
5631 ]
5632 );
5633
5634 $ref->add_control(
5635 'separate_category_icon_color_box_hover',
5636 [
5637 'label' => esc_html__( 'Category Icon Color - Box Hover', 'the-post-grid' ),
5638 'type' => Controls_Manager::COLOR,
5639 'selectors' => [
5640 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links i' => 'color: {{VALUE}}',
5641 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags .categories-links i' => 'color: {{VALUE}}',
5642 ],
5643 'condition' => [
5644 'show_cat_icon' => 'yes',
5645 ],
5646 ]
5647 );
5648
5649 $ref->end_controls_tab();
5650
5651 $ref->end_controls_tabs();
5652
5653 $ref->end_controls_section();
5654 }
5655
5656 /**
5657 * Read More style
5658 *
5659 * @param $ref
5660 */
5661 public static function readmoreStyle( $ref ) {
5662 $prefix = $ref->prefix;
5663
5664 $ref->start_controls_section(
5665 'readmore_button_style',
5666 [
5667 'label' => esc_html__( 'Read More', 'the-post-grid' ),
5668 'tab' => Controls_Manager::TAB_STYLE,
5669 'condition' => [
5670 'show_read_more' => 'show',
5671 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
5672 ],
5673 ]
5674 );
5675
5676 $ref->add_group_control(
5677 Group_Control_Typography::get_type(),
5678 [
5679 'name' => 'readmore_typography',
5680 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a',
5681 ]
5682 );
5683
5684 $ref->add_responsive_control(
5685 'readmore_spacing',
5686 [
5687 'label' => esc_html__( 'Button Spacing', 'the-post-grid' ),
5688 'type' => Controls_Manager::DIMENSIONS,
5689 'size_units' => [ 'px' ],
5690 'allowed_dimensions' => 'all',
5691 'default' => [
5692 'top' => '',
5693 'right' => '',
5694 'bottom' => '',
5695 'left' => '',
5696 'isLinked' => false,
5697 ],
5698 'selectors' => [
5699 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5700 ],
5701 ]
5702 );
5703
5704 $ref->add_responsive_control(
5705 'readmore_padding',
5706 [
5707 'label' => esc_html__( 'Button Padding', 'the-post-grid' ),
5708 'type' => Controls_Manager::DIMENSIONS,
5709 'size_units' => [ 'px' ],
5710 'selectors' => [
5711 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5712 ],
5713 'condition' => [
5714 'readmore_btn_style' => 'default-style',
5715 ],
5716 ]
5717 );
5718
5719 $ref->add_responsive_control(
5720 'readmore_btn_alignment',
5721 [
5722 'label' => esc_html__( 'Button Alignment', 'the-post-grid' ),
5723 'type' => Controls_Manager::CHOOSE,
5724 'options' => [
5725 'left' => [
5726 'title' => esc_html__( 'Left', 'the-post-grid' ),
5727 'icon' => 'eicon-text-align-left',
5728 ],
5729 'center' => [
5730 'title' => esc_html__( 'Center', 'the-post-grid' ),
5731 'icon' => 'eicon-text-align-center',
5732 ],
5733 'right' => [
5734 'title' => esc_html__( 'Right', 'the-post-grid' ),
5735 'icon' => 'eicon-text-align-right',
5736 ],
5737 ],
5738 'selectors' => [
5739 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more' => 'text-align:{{VALUE}}',
5740 ],
5741 'toggle' => true,
5742 ]
5743 );
5744
5745 $ref->add_responsive_control(
5746 'readmore_icon_size',
5747 [
5748 'label' => esc_html__( 'Icon Size', 'the-post-grid' ),
5749 'type' => Controls_Manager::SLIDER,
5750 'size_units' => [ 'px' ],
5751 'range' => [
5752 'px' => [
5753 'min' => 10,
5754 'max' => 50,
5755 'step' => 1,
5756 ],
5757 ],
5758 'selectors' => [
5759 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'font-size: {{SIZE}}{{UNIT}};',
5760 ],
5761 'condition' => [
5762 'show_btn_icon' => 'yes',
5763 ],
5764 ]
5765 );
5766
5767 $ref->add_responsive_control(
5768 'readmore_icon_y_position',
5769 [
5770 'label' => esc_html__( 'Icon Vertical Position', 'the-post-grid' ),
5771 'type' => Controls_Manager::SLIDER,
5772 'size_units' => [ 'px' ],
5773 'range' => [
5774 'px' => [
5775 'min' => - 20,
5776 'max' => 20,
5777 'step' => 1,
5778 ],
5779 ],
5780 'selectors' => [
5781 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'transform: translateY( {{SIZE}}{{UNIT}} );',
5782 ],
5783 'condition' => [
5784 'show_btn_icon' => 'yes',
5785 ],
5786 ]
5787 );
5788
5789 // Button style Tabs
5790 $ref->start_controls_tabs(
5791 'readmore_style_tabs'
5792 );
5793
5794 $ref->start_controls_tab(
5795 'readmore_style_normal_tab',
5796 [
5797 'label' => esc_html__( 'Normal', 'the-post-grid' ),
5798 ]
5799 );
5800
5801 $ref->add_control(
5802 'readmore_text_color',
5803 [
5804 'label' => esc_html__( 'Text Color', 'the-post-grid' ),
5805 'type' => Controls_Manager::COLOR,
5806 'selectors' => [
5807 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'color: {{VALUE}}',
5808 ],
5809 ]
5810 );
5811
5812 $ref->add_control(
5813 'readmore_icon_color',
5814 [
5815 'label' => esc_html__( 'Icon Color', 'the-post-grid' ),
5816 'type' => Controls_Manager::COLOR,
5817 'selectors' => [
5818 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'color: {{VALUE}}',
5819 ],
5820 'condition' => [
5821 'show_btn_icon' => 'yes',
5822 ],
5823 ]
5824 );
5825
5826 $ref->add_control(
5827 'readmore_bg',
5828 [
5829 'label' => esc_html__( 'Background Color', 'the-post-grid' ),
5830 'type' => Controls_Manager::COLOR,
5831 'selectors' => [
5832 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'background-color: {{VALUE}}',
5833 ],
5834 'condition' => [
5835 'readmore_btn_style' => 'default-style',
5836 ],
5837 ]
5838 );
5839
5840 $ref->add_responsive_control(
5841 'readmore_icon_margin',
5842 [
5843 'label' => esc_html__( 'Icon Spacing', 'the-post-grid' ),
5844 'type' => Controls_Manager::DIMENSIONS,
5845 'size_units' => [ 'px' ],
5846 'allowed_dimensions' => 'horizontal',
5847 'default' => [
5848 'top' => '',
5849 'right' => '',
5850 'bottom' => '',
5851 'left' => '',
5852 'isLinked' => false,
5853 ],
5854 'selectors' => [
5855 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5856 ],
5857 'condition' => [
5858 'show_btn_icon' => 'yes',
5859 ],
5860 ]
5861 );
5862
5863 $ref->add_responsive_control(
5864 'border_radius',
5865 [
5866 'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
5867 'type' => Controls_Manager::DIMENSIONS,
5868 'size_units' => [ 'px', '%', 'em' ],
5869 'allowed_dimensions' => 'all',
5870 'selectors' => [
5871 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5872 ],
5873 'condition' => [
5874 'readmore_btn_style' => 'default-style',
5875 ],
5876 ]
5877 );
5878
5879 $ref->add_group_control(
5880 \Elementor\Group_Control_Border::get_type(),
5881 [
5882 'name' => 'readmore_border',
5883 'label' => esc_html__( 'Button Border', 'the-post-grid' ),
5884 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a',
5885 'fields_options' => [
5886 'border' => [
5887 'default' => 'solid',
5888 ],
5889 'width' => [
5890 'default' => [
5891 'top' => '1',
5892 'right' => '1',
5893 'bottom' => '1',
5894 'left' => '1',
5895 'isLinked' => true,
5896 ],
5897 ],
5898 'color' => [
5899 'default' => '#D4D4D4',
5900 ],
5901 ],
5902 'condition' => [
5903 'readmore_btn_style' => 'default-style',
5904 ],
5905 ]
5906 );
5907
5908 $ref->end_controls_tab();
5909
5910 // Hover Tab
5911
5912 $ref->start_controls_tab(
5913 'readmore_style_hover_tab',
5914 [
5915 'label' => esc_html__( 'Hover', 'the-post-grid' ),
5916 ]
5917 );
5918
5919 $ref->add_control(
5920 'readmore_text_color_hover',
5921 [
5922 'label' => esc_html__( 'Text Color hover', 'the-post-grid' ),
5923 'type' => Controls_Manager::COLOR,
5924 'selectors' => [
5925 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'color: {{VALUE}}',
5926 ],
5927 ]
5928 );
5929
5930 $ref->add_control(
5931 'readmore_icon_color_hover',
5932 [
5933 'label' => esc_html__( 'Icon Color Hover', 'the-post-grid' ),
5934 'type' => Controls_Manager::COLOR,
5935 'selectors' => [
5936 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'color: {{VALUE}}',
5937 ],
5938 'condition' => [
5939 'show_btn_icon' => 'yes',
5940 ],
5941 ]
5942 );
5943
5944 $ref->add_control(
5945 'readmore_bg_hover',
5946 [
5947 'label' => esc_html__( 'Background Color hover', 'the-post-grid' ),
5948 'type' => Controls_Manager::COLOR,
5949 'selectors' => [
5950 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'background-color: {{VALUE}}',
5951 ],
5952 'condition' => [
5953 'readmore_btn_style' => 'default-style',
5954 ],
5955 ]
5956 );
5957
5958 $ref->add_responsive_control(
5959 'readmore_icon_margin_hover',
5960 [
5961 'label' => esc_html__( 'Icon Spacing - Hover', 'the-post-grid' ),
5962 'type' => Controls_Manager::DIMENSIONS,
5963 'size_units' => [ 'px' ],
5964 'allowed_dimensions' => 'horizontal',
5965 'default' => [
5966 'top' => '',
5967 'right' => '',
5968 'bottom' => '',
5969 'left' => '',
5970 'isLinked' => false,
5971 ],
5972 'selectors' => [
5973 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5974 ],
5975 'condition' => [
5976 'show_btn_icon' => 'yes',
5977 ],
5978 ]
5979 );
5980
5981 $ref->add_responsive_control(
5982 'border_radius_hover',
5983 [
5984 'label' => esc_html__( 'Border Radius - Hover', 'the-post-grid' ),
5985 'type' => Controls_Manager::DIMENSIONS,
5986 'size_units' => [ 'px', '%', 'em' ],
5987 'allowed_dimensions' => 'all',
5988 'selectors' => [
5989 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5990 ],
5991 'condition' => [
5992 'readmore_btn_style' => 'default-style',
5993 ],
5994 ]
5995 );
5996
5997 $ref->add_group_control(
5998 \Elementor\Group_Control_Border::get_type(),
5999 [
6000 'name' => 'readmore_border_hover',
6001 'label' => esc_html__( 'Button Border - Hover', 'the-post-grid' ),
6002 'selector' => 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover',
6003 'fields_options' => [
6004 'border' => [
6005 'default' => 'solid',
6006 ],
6007 'width' => [
6008 'default' => [
6009 'top' => '1',
6010 'right' => '1',
6011 'bottom' => '1',
6012 'left' => '1',
6013 'isLinked' => true,
6014 ],
6015 ],
6016 'color' => [
6017 'default' => '#7a64f2',
6018 ],
6019 ],
6020 'condition' => [
6021 'readmore_btn_style' => 'default-style',
6022 ],
6023 ]
6024 );
6025
6026 $ref->end_controls_tab();
6027
6028 // Box Hover Tab
6029
6030 $ref->start_controls_tab(
6031 'readmore_style_box_hover_tab',
6032 [
6033 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
6034 ]
6035 );
6036
6037 $ref->add_control(
6038 'readmore_text_color_box_hover',
6039 [
6040 'label' => esc_html__( 'Text Color - BoxHover', 'the-post-grid' ),
6041 'type' => Controls_Manager::COLOR,
6042 'selectors' => [
6043 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'color: {{VALUE}}',
6044 ],
6045 ]
6046 );
6047
6048 $ref->add_control(
6049 'readmore_icon_color_box_hover',
6050 [
6051 'label' => esc_html__( 'Icon Color - BoxHover', 'the-post-grid' ),
6052 'type' => Controls_Manager::COLOR,
6053 'selectors' => [
6054 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a i' => 'color: {{VALUE}}',
6055 ],
6056 'condition' => [
6057 'show_btn_icon' => 'yes',
6058 ],
6059 ]
6060 );
6061
6062 $ref->add_control(
6063 'readmore_bg_box_hover',
6064 [
6065 'label' => esc_html__( 'Background Color - BoxHover', 'the-post-grid' ),
6066 'type' => Controls_Manager::COLOR,
6067 'selectors' => [
6068 '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'background-color: {{VALUE}}',
6069 ],
6070 'condition' => [
6071 'readmore_btn_style' => 'default-style',
6072 ],
6073 ]
6074 );
6075
6076 $ref->add_group_control(
6077 \Elementor\Group_Control_Border::get_type(),
6078 [
6079 'name' => 'readmore_border_box_hover',
6080 'label' => esc_html__( 'Button Border - Box Hover', 'the-post-grid' ),
6081 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a',
6082 'condition' => [
6083 'readmore_btn_style' => 'default-style',
6084 ],
6085 ]
6086 );
6087
6088 $ref->end_controls_tab();
6089
6090 $ref->end_controls_tabs();
6091
6092 $ref->end_controls_section();
6093
6094 self::event_style( $ref );
6095 }
6096
6097 public static function event_style( $ref ) {
6098 $prefix = $ref->prefix;
6099
6100 $ref->start_controls_section(
6101 'event_button_style',
6102 [
6103 'label' => esc_html__( 'Event Style', 'the-post-grid' ),
6104 'tab' => Controls_Manager::TAB_STYLE,
6105 'condition' => [
6106 'show_event_date' => 'on',
6107 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
6108 ],
6109 ]
6110 );
6111
6112 $ref->add_group_control(
6113 Group_Control_Typography::get_type(),
6114 [
6115 'name' => 'event_typography',
6116 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-event-date',
6117 ]
6118 );
6119
6120 $ref->add_responsive_control(
6121 'event_spacing',
6122 [
6123 'label' => esc_html__( 'Spacing', 'the-post-grid' ),
6124 'type' => Controls_Manager::DIMENSIONS,
6125 'size_units' => [ 'px' ],
6126 'allowed_dimensions' => 'all',
6127 'default' => [
6128 'top' => '',
6129 'right' => '',
6130 'bottom' => '',
6131 'left' => '',
6132 'isLinked' => false,
6133 ],
6134 'selectors' => [
6135 '{{WRAPPER}} .rt-tpg-container .tpg-event-date' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6136 ],
6137 ]
6138 );
6139
6140 $ref->add_responsive_control(
6141 'event_padding',
6142 [
6143 'label' => esc_html__( 'Padding', 'the-post-grid' ),
6144 'type' => Controls_Manager::DIMENSIONS,
6145 'size_units' => [ 'px' ],
6146 'selectors' => [
6147 '{{WRAPPER}} .rt-tpg-container .tpg-event-date' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6148 ],
6149 ]
6150 );
6151
6152 $ref->add_control( 'event_label_color', [
6153 'label' => __( 'Label Color', 'the-post-grid' ),
6154 'type' => Controls_Manager::COLOR,
6155 'selectors' => [
6156 '{{WRAPPER}} .rt-tpg-container .tpg-event-date .label' => 'color: {{VALUE}}',
6157 ],
6158 ] );
6159 $ref->add_control( 'event_date_color', [
6160 'label' => __( 'Date Color', 'the-post-grid' ),
6161 'type' => Controls_Manager::COLOR,
6162 'selectors' => [
6163 '{{WRAPPER}} .rt-tpg-container .tpg-event-date .date' => 'color: {{VALUE}}',
6164 ],
6165 ] );
6166 $ref->add_control( 'event_wrapper_bg', [
6167 'label' => __( 'Background Color', 'the-post-grid' ),
6168 'type' => Controls_Manager::COLOR,
6169 'selectors' => [
6170 '{{WRAPPER}} .rt-tpg-container .tpg-event-date' => 'background-color: {{VALUE}}',
6171 ],
6172 ] );
6173 $ref->add_group_control(
6174 Group_Control_Border::get_type(),
6175 [
6176 'name' => 'event_border',
6177 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-event-date',
6178 ]
6179 );
6180
6181 $ref->add_responsive_control(
6182 'event_radius',
6183 [
6184 'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
6185 'type' => Controls_Manager::DIMENSIONS,
6186 'size_units' => [ 'px' ],
6187 'selectors' => [
6188 '{{WRAPPER}} .rt-tpg-container .tpg-event-date' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6189 ],
6190 ]
6191 );
6192
6193 $ref->end_controls_section();
6194 }
6195
6196 /**
6197 * Pagination and Load more style tab
6198 *
6199 * @param $ref
6200 */
6201 public static function paginationStyle( $ref ) {
6202 $ref->start_controls_section(
6203 'pagination_loadmore_style',
6204 [
6205 'label' => esc_html__( 'Pagination / Load More', 'the-post-grid' ),
6206 'tab' => Controls_Manager::TAB_STYLE,
6207 'condition' => [
6208 'show_pagination' => 'show',
6209 ],
6210 ]
6211 );
6212
6213 $ref->add_group_control(
6214 Group_Control_Typography::get_type(),
6215 [
6216 'name' => 'pagination_typography',
6217 'selector' => '{{WRAPPER}} .rt-pagination .pagination-list > li > a, {{WRAPPER}} .rt-pagination .pagination-list > li > span',
6218
6219 ]
6220 );
6221
6222 $ref->add_responsive_control(
6223 'pagination_text_align',
6224 [
6225 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
6226 'type' => Controls_Manager::CHOOSE,
6227 'options' => [
6228 'flex-start' => [
6229 'title' => esc_html__( 'Left', 'the-post-grid' ),
6230 'icon' => 'eicon-text-align-left',
6231 ],
6232 'center' => [
6233 'title' => esc_html__( 'Center', 'the-post-grid' ),
6234 'icon' => 'eicon-text-align-center',
6235 ],
6236 'flex-end' => [
6237 'title' => esc_html__( 'Right', 'the-post-grid' ),
6238 'icon' => 'eicon-text-align-right',
6239 ],
6240 ],
6241 'selectors' => [
6242 '{{WRAPPER}} .rt-pagination-wrap' => 'justify-content: {{VALUE}};',
6243 ],
6244 'default' => 'center',
6245 'toggle' => true,
6246 ]
6247 );
6248
6249 $ref->add_responsive_control(
6250 'pagination_spacing',
6251 [
6252 'label' => esc_html__( 'Button Vertical Spacing', 'the-post-grid' ),
6253 'type' => Controls_Manager::DIMENSIONS,
6254 'size_units' => [ 'px' ],
6255 'allowed_dimensions' => 'vertical',
6256 'default' => [
6257 'top' => '',
6258 'right' => '',
6259 'bottom' => '',
6260 'left' => '',
6261 'isLinked' => false,
6262 ],
6263 'selectors' => [
6264 '{{WRAPPER}} .rt-pagination-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6265 ],
6266 'condition' => [
6267 'pagination_type!' => 'load_on_scroll',
6268 ],
6269 ]
6270 );
6271
6272 $ref->add_responsive_control(
6273 'pagination_padding',
6274 [
6275 'label' => esc_html__( 'Button Padding', 'the-post-grid' ),
6276 'type' => Controls_Manager::DIMENSIONS,
6277 'size_units' => [ 'px' ],
6278 'allowed_dimensions' => 'all',
6279 'selectors' => [
6280 '{{WRAPPER}} .rt-pagination .pagination-list > li > a, {{WRAPPER}} .rt-pagination .pagination-list > li > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6281 ],
6282 'condition' => [
6283 'pagination_type!' => 'load_on_scroll',
6284 ],
6285 ]
6286 );
6287
6288 $ref->add_responsive_control(
6289 'pagination_border_radius',
6290 [
6291 'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
6292 'type' => Controls_Manager::SLIDER,
6293 'size_units' => [ 'px', '%' ],
6294 'range' => [
6295 'px' => [
6296 'min' => 0,
6297 'max' => 100,
6298 'step' => 1,
6299 ],
6300 '%' => [
6301 'min' => 0,
6302 'max' => 100,
6303 ],
6304 ],
6305 'selectors' => [
6306 '{{WRAPPER}} .rt-pagination .pagination-list > li:first-child > a, {{WRAPPER}} .rt-pagination .pagination-list > li:first-child > span' => 'border-bottom-left-radius: {{SIZE}}{{UNIT}}; border-top-left-radius: {{SIZE}}{{UNIT}};',
6307 '{{WRAPPER}} .rt-pagination .pagination-list > li:last-child > a, {{WRAPPER}} .rt-pagination .pagination-list > li:last-child > span' => 'border-bottom-right-radius: {{SIZE}}{{UNIT}}; border-top-right-radius: {{SIZE}}{{UNIT}};',
6308 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'border-radius: {{SIZE}}{{UNIT}};',
6309 ],
6310 'condition' => [
6311 'pagination_type!' => 'load_on_scroll',
6312 ],
6313 ]
6314 );
6315
6316 // Button style Tabs
6317 $ref->start_controls_tabs(
6318 'pagination_style_tabs',
6319 [
6320 'condition' => [
6321 'pagination_type!' => 'load_on_scroll',
6322 ],
6323 ]
6324 );
6325
6326 // Normal Tab
6327 $ref->start_controls_tab(
6328 'pagination_style_normal_tab',
6329 [
6330 'label' => esc_html__( 'Normal', 'the-post-grid' ),
6331 ]
6332 );
6333
6334 $ref->add_control(
6335 'pagination_color',
6336 [
6337 'label' => esc_html__( 'Color', 'the-post-grid' ),
6338 'type' => Controls_Manager::COLOR,
6339 'selectors' => [
6340 '{{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > a, {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'color: {{VALUE}}',
6341 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'color: {{VALUE}}',
6342 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover)' => 'color: {{VALUE}}',
6343 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'color: {{VALUE}}',
6344 ],
6345 ]
6346 );
6347
6348 $ref->add_control(
6349 'pagination_bg',
6350 [
6351 'label' => esc_html__( 'Background Color', 'the-post-grid' ),
6352 'type' => Controls_Manager::COLOR,
6353 'selectors' => [
6354 '{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'background-color: {{VALUE}}',
6355 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'background-color: {{VALUE}}',
6356 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'background-color: {{VALUE}}',
6357 ],
6358
6359 ]
6360 );
6361
6362 $ref->add_control(
6363 'pagination_border_color',
6364 [
6365 'label' => esc_html__( 'Border Color', 'the-post-grid' ),
6366 'type' => Controls_Manager::COLOR,
6367 'selectors' => [
6368 '{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'border-color: {{VALUE}}',
6369 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:not(:hover) > a' => 'border-color: {{VALUE}}',
6370 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn' => 'border-color: {{VALUE}}',
6371 ],
6372 ]
6373 );
6374
6375 $ref->end_controls_tab();
6376
6377 // Hover Tab
6378 $ref->start_controls_tab(
6379 'pagination_style_hover_tab',
6380 [
6381 'label' => esc_html__( 'Hover', 'the-post-grid' ),
6382 ]
6383 );
6384
6385 $ref->add_control(
6386 'pagination_color_hover',
6387 [
6388 'label' => esc_html__( 'Color - hover', 'the-post-grid' ),
6389 'type' => Controls_Manager::COLOR,
6390 'selectors' => [
6391 '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'color: {{VALUE}} !important',
6392 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'color: {{VALUE}} !important',
6393 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'color: {{VALUE}} !important',
6394 ],
6395 ]
6396 );
6397
6398 $ref->add_control(
6399 'pagination_bg_hover',
6400 [
6401 'label' => esc_html__( 'Background Color - Hover', 'the-post-grid' ),
6402 'type' => Controls_Manager::COLOR,
6403 'selectors' => [
6404 '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'background-color: {{VALUE}} !important',
6405 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'background-color: {{VALUE}} !important',
6406 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'background-color: {{VALUE}} !important',
6407 ],
6408 ]
6409 );
6410
6411 $ref->add_control(
6412 'pagination_border_color_hover',
6413 [
6414 'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ),
6415 'type' => Controls_Manager::COLOR,
6416 'selectors' => [
6417 '{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'border-color: {{VALUE}} !important',
6418 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li:hover > a' => 'border-color: {{VALUE}} !important',
6419 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover' => 'border-color: {{VALUE}} !important',
6420 ],
6421 ]
6422 );
6423
6424 $ref->end_controls_tab();
6425
6426 // Active Tab
6427 $ref->start_controls_tab(
6428 'pagination_style_active_tab',
6429 [
6430 'label' => esc_html__( 'Active', 'the-post-grid' ),
6431 ]
6432 );
6433
6434 $ref->add_control(
6435 'pagination_color_active',
6436 [
6437 'label' => esc_html__( 'Color - Active', 'the-post-grid' ),
6438 'type' => Controls_Manager::COLOR,
6439 'selectors' => [
6440 '{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
6441 {{WRAPPER}} .rt-pagination .pagination-list > .active > span,
6442 {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
6443 {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
6444 {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
6445 {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'color: {{VALUE}} !important',
6446 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'color: {{VALUE}}',
6447 ],
6448 ]
6449 );
6450
6451 $ref->add_control(
6452 'pagination_bg_active',
6453 [
6454 'label' => esc_html__( 'Background Color - Active', 'the-post-grid' ),
6455 'type' => Controls_Manager::COLOR,
6456 'selectors' => [
6457 '{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
6458 {{WRAPPER}} .rt-pagination .pagination-list > .active > span,
6459 {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
6460 {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
6461 {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
6462 {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'background-color: {{VALUE}} !important',
6463 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'background-color: {{VALUE}}',
6464 ],
6465 ]
6466 );
6467
6468 $ref->add_control(
6469 'pagination_border_color_active',
6470 [
6471 'label' => esc_html__( 'Border Color - Active', 'the-post-grid' ),
6472 'type' => Controls_Manager::COLOR,
6473 'selectors' => [
6474 '{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
6475 {{WRAPPER}} .rt-pagination .pagination-list > .active > span,
6476 {{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
6477 {{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
6478 {{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
6479 {{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'border-color: {{VALUE}} !important',
6480 '{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'border-color: {{VALUE}}',
6481 ],
6482 ]
6483 );
6484
6485 $ref->end_controls_tab();
6486
6487 $ref->end_controls_tabs();
6488
6489 $ref->end_controls_section();
6490 }
6491
6492 /**
6493 * Front-end Filter style / frontend style
6494 *
6495 * @param $ref
6496 */
6497 public static function frontEndFilter( $ref ) {
6498 if ( ! rtTPG()->hasPro() ) {
6499 return;
6500 }
6501 $ref->start_controls_section(
6502 'front_end_filter_style',
6503 [
6504 'label' => esc_html__( 'Front-End Filter', 'the-post-grid' ),
6505 'tab' => Controls_Manager::TAB_STYLE,
6506 'conditions' => [
6507 'relation' => 'or',
6508 'terms' => [
6509 [
6510 'name' => 'show_taxonomy_filter',
6511 'operator' => '==',
6512 'value' => 'show',
6513 ],
6514 [
6515 'name' => 'show_author_filter',
6516 'operator' => '==',
6517 'value' => 'show',
6518 ],
6519 [
6520 'name' => 'show_order_by',
6521 'operator' => '==',
6522 'value' => 'show',
6523 ],
6524 [
6525 'name' => 'show_sort_order',
6526 'operator' => '==',
6527 'value' => 'show',
6528 ],
6529 [
6530 'name' => 'show_search',
6531 'operator' => '==',
6532 'value' => 'show',
6533 ],
6534 ],
6535 ],
6536 ]
6537 );
6538
6539 $ref->add_group_control(
6540 Group_Control_Typography::get_type(),
6541 [
6542 'name' => 'front_filter_typography',
6543 'label' => esc_html__( 'Filter Typography', 'the-post-grid' ),
6544 'selector' => '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap, {{WRAPPER}} .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide',
6545 ]
6546 );
6547
6548 $ref->add_responsive_control(
6549 'filter_item_width',
6550 [
6551 'label' => esc_html__( 'Filter Item Width', 'the-post-grid' ),
6552 'type' => Controls_Manager::SLIDER,
6553 'size_units' => [ 'px' ],
6554 'range' => [
6555 'px' => [
6556 'min' => 0,
6557 'max' => 600,
6558 'step' => 1,
6559 ],
6560 ],
6561 'selectors' => [
6562 '{{WRAPPER}} .rt-filter-wrap .rt-filter-dropdown' => 'width: {{SIZE}}px;',
6563 ],
6564 'condition' => [
6565 'filter_type' => 'dropdown',
6566 ],
6567 ]
6568 );
6569
6570 $ref->add_control(
6571 'filter_dropdown_align',
6572 [
6573 'label' => esc_html__( 'Dropdown Alignment', 'the-post-grid' ),
6574 'type' => \Elementor\Controls_Manager::CHOOSE,
6575 'options' => [
6576 'left' => [
6577 'title' => esc_html__( 'Left', 'the-post-grid' ),
6578 'icon' => 'eicon-text-align-left',
6579 ],
6580 'center' => [
6581 'title' => esc_html__( 'Center', 'the-post-grid' ),
6582 'icon' => 'eicon-text-align-center',
6583 ],
6584 'right' => [
6585 'title' => esc_html__( 'Right', 'the-post-grid' ),
6586 'icon' => 'eicon-text-align-right',
6587 ],
6588 ],
6589 'render_type' => 'template',
6590 'prefix_class' => 'section-title-align-',
6591 'condition' => [
6592 'filter_type' => 'dropdown',
6593 ],
6594 'selectors' => [
6595 '{{WRAPPER}} .rt-filter-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'text-align: {{VALUE}};',
6596 ],
6597 ]
6598 );
6599
6600 $ref->add_responsive_control(
6601 'filter_text_alignment',
6602 [
6603 'label' => esc_html__( 'Alignment', 'the-post-grid' ),
6604 'type' => Controls_Manager::CHOOSE,
6605 'options' => [
6606 'left' => [
6607 'title' => esc_html__( 'Left', 'the-post-grid' ),
6608 'icon' => 'eicon-text-align-left',
6609 ],
6610 'center' => [
6611 'title' => esc_html__( 'Center', 'the-post-grid' ),
6612 'icon' => 'eicon-text-align-center',
6613 ],
6614 'right' => [
6615 'title' => esc_html__( 'Right', 'the-post-grid' ),
6616 'icon' => 'eicon-text-align-right',
6617 ],
6618 ],
6619 'condition' => [
6620 'filter_type' => 'button',
6621 'filter_btn_style' => 'default',
6622 ],
6623 'toggle' => true,
6624 'selectors' => [
6625 '{{WRAPPER}} .tpg-el-main-wrapper .rt-layout-filter-container .rt-filter-wrap' => 'text-align: {{VALUE}};justify-content:{{VALUE}}',
6626 ],
6627 ]
6628 );
6629
6630 $ref->add_control(
6631 'filter_v_alignment',
6632 [
6633 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ),
6634 'type' => Controls_Manager::CHOOSE,
6635 'options' => [
6636 'left' => [
6637 'title' => esc_html__( 'Top', 'the-post-grid' ),
6638 'icon' => 'eicon-v-align-top',
6639 ],
6640 'center' => [
6641 'title' => esc_html__( 'Center', 'the-post-grid' ),
6642 'icon' => 'eicon-v-align-middle',
6643 ],
6644 'right' => [
6645 'title' => esc_html__( 'Right', 'the-post-grid' ),
6646 'icon' => 'eicon-v-align-bottom',
6647 ],
6648 ],
6649 'condition' => [
6650 'filter_type' => 'button',
6651 'filter_btn_style' => 'default',
6652 ],
6653 'prefix_class' => 'tpg-filter-alignment-',
6654 'toggle' => true,
6655 ]
6656 );
6657
6658 $ref->add_responsive_control(
6659 'filter_button_width',
6660 [
6661 'label' => esc_html__( 'Filter Width', 'the-post-grid' ),
6662 'type' => Controls_Manager::SLIDER,
6663 'size_units' => [ 'px', '%' ],
6664 'range' => [
6665 'px' => [
6666 'min' => 0,
6667 'max' => 1000,
6668 'step' => 5,
6669 ],
6670 '%' => [
6671 'min' => 0,
6672 'max' => 100,
6673 ],
6674 ],
6675 'selectors' => [
6676 '{{WRAPPER}} .tpg-header-wrapper.carousel .rt-layout-filter-container' => 'flex: 0 0 {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
6677 ],
6678 'condition' => [
6679 'filter_type' => 'button',
6680 'filter_btn_style' => 'carousel',
6681 ],
6682 ]
6683 );
6684
6685 $ref->add_control(
6686 'border_style',
6687 [
6688 'label' => esc_html__( 'Filter Border', 'the-post-grid' ),
6689 'type' => Controls_Manager::SELECT,
6690 'default' => 'disable',
6691 'options' => [
6692 'disable' => esc_html__( 'Disable', 'the-post-grid' ),
6693 'enable' => esc_html__( 'Enable', 'the-post-grid' ),
6694 ],
6695 'condition' => [
6696 'filter_type' => 'button',
6697 'filter_btn_style' => 'carousel',
6698 'section_title_style!' => [ 'style2', 'style3' ],
6699 ],
6700 'prefix_class' => 'filter-button-border-',
6701 ]
6702 );
6703
6704 $ref->add_control(
6705 'filter_next_prev_btn',
6706 [
6707 'label' => esc_html__( 'Next/Prev Button', 'the-post-grid' ),
6708 'type' => Controls_Manager::SELECT,
6709 'default' => 'visible',
6710 'options' => [
6711 'visible' => esc_html__( 'Visible', 'the-post-grid' ),
6712 'hidden' => esc_html__( 'Hidden', 'the-post-grid' ),
6713 ],
6714 'condition' => [
6715 'filter_type' => 'button',
6716 'filter_btn_style' => 'carousel',
6717 ],
6718 'prefix_class' => 'filter-nex-prev-btn-',
6719 ]
6720 );
6721
6722 $ref->add_control(
6723 'filter_h_alignment',
6724 [
6725 'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ),
6726 'type' => Controls_Manager::CHOOSE,
6727 'options' => [
6728 'left' => [
6729 'title' => esc_html__( 'Top', 'the-post-grid' ),
6730 'icon' => 'eicon-justify-start-h',
6731 ],
6732 'center' => [
6733 'title' => esc_html__( 'Center', 'the-post-grid' ),
6734 'icon' => 'eicon-justify-center-h',
6735 ],
6736 'right' => [
6737 'title' => esc_html__( 'Right', 'the-post-grid' ),
6738 'icon' => 'eicon-justify-end-h',
6739 ],
6740 'space-between' => [
6741 'title' => esc_html__( 'Space Between', 'the-post-grid' ),
6742 'icon' => 'eicon-justify-space-between-h',
6743 ],
6744 ],
6745 'condition' => [
6746 'filter_type!' => 'button',
6747 ],
6748 'prefix_class' => 'tpg-filter-h-alignment-',
6749 'toggle' => true,
6750 ]
6751 );
6752
6753 $ref->add_responsive_control(
6754 'filter_btn_radius',
6755 [
6756 'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
6757 'type' => Controls_Manager::DIMENSIONS,
6758 'size_units' => [ 'px' ],
6759 'selectors' => [
6760 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6761 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6762 '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6763 ],
6764 'condition' => [
6765 'filter_btn_style' => 'default',
6766 ],
6767 ]
6768 );
6769
6770 $ref->add_responsive_control(
6771 'filter_btn_spacing',
6772 [
6773 'label' => esc_html__( 'Filter wrapper Spacing', 'the-post-grid' ),
6774 'type' => Controls_Manager::DIMENSIONS,
6775 'size_units' => [ 'px' ],
6776 'selectors' => [
6777 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
6778 ],
6779 'condition' => [
6780 'filter_btn_style' => 'default',
6781 ],
6782 ]
6783 );
6784
6785 // Start Tab
6786 $ref->start_controls_tabs(
6787 'frontend_filter_style_tabs'
6788 );
6789
6790 $ref->start_controls_tab(
6791 'frontend_filter_style_normal_tab',
6792 [
6793 'label' => esc_html__( 'Normal', 'the-post-grid' ),
6794 ]
6795 );
6796
6797 $ref->add_control(
6798 'filter_color',
6799 [
6800 'label' => esc_html__( 'Filter Color', 'the-post-grid' ),
6801 'type' => Controls_Manager::COLOR,
6802 'selectors' => [
6803 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'color: {{VALUE}}',
6804 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'color: {{VALUE}}',
6805 '{{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action .rt-sort-order-action-arrow > span:before, {{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action .rt-sort-order-action-arrow > span:after' => 'background-color: {{VALUE}}',
6806 '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'color: {{VALUE}}',
6807 ],
6808 ]
6809 );
6810
6811 $ref->add_control(
6812 'filter_bg_color',
6813 [
6814 'label' => esc_html__( 'Filter Background Color', 'the-post-grid' ),
6815 'type' => Controls_Manager::COLOR,
6816 'selectors' => [
6817 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'background-color: {{VALUE}}',
6818 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'background-color: {{VALUE}}',
6819 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action' => 'background-color: {{VALUE}}',
6820 ],
6821 ]
6822 );
6823
6824 $ref->add_control(
6825 'filter_border_color',
6826 [
6827 'label' => esc_html__( 'Filter Border Color', 'the-post-grid' ),
6828 'type' => Controls_Manager::COLOR,
6829 'selectors' => [
6830 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-color: {{VALUE}}',
6831 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap' => 'border-color: {{VALUE}}',
6832 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action' => 'border-color: {{VALUE}}',
6833 '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'border-color: {{VALUE}}',
6834 '{{WRAPPER}}.filter-button-border-enable .tpg-header-wrapper.carousel .rt-layout-filter-container' => 'border-color: {{VALUE}}',
6835 ],
6836 ]
6837 );
6838
6839 $ref->add_control(
6840 'filter_search_bg',
6841 [
6842 'label' => esc_html__( 'Search Background', 'the-post-grid' ),
6843 'type' => Controls_Manager::COLOR,
6844 'selectors' => [
6845 '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'background-color: {{VALUE}}',
6846 ],
6847 'condition' => [
6848 'show_search' => 'show',
6849 'filter_btn_style' => 'default',
6850 ],
6851 ]
6852 );
6853
6854 $ref->add_control(
6855 'sub_menu_color_heading',
6856 [
6857 'label' => esc_html__( 'Sub Menu Options', 'the-post-grid' ),
6858 'type' => Controls_Manager::HEADING,
6859 'separator' => 'before',
6860 'classes' => 'tpg-control-type-heading',
6861 'condition' => [
6862 'filter_type' => 'dropdown',
6863 ],
6864 ]
6865 );
6866
6867 $ref->add_control(
6868 'sub_menu_bg_color',
6869 [
6870 'label' => esc_html__( 'Submenu Background', 'the-post-grid' ),
6871 'type' => Controls_Manager::COLOR,
6872 'selectors' => [
6873 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown' => 'background-color: {{VALUE}}',
6874 ],
6875 'condition' => [
6876 'filter_type' => 'dropdown',
6877 ],
6878 ]
6879 );
6880
6881 $ref->add_control(
6882 'sub_menu_color',
6883 [
6884 'label' => esc_html__( 'Submenu Color', 'the-post-grid' ),
6885 'type' => Controls_Manager::COLOR,
6886 'selectors' => [
6887 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'color: {{VALUE}}',
6888 ],
6889 'condition' => [
6890 'filter_type' => 'dropdown',
6891 ],
6892 ]
6893 );
6894
6895 $ref->add_control(
6896 'sub_menu_border_bottom',
6897 [
6898 'label' => esc_html__( 'Submenu Border', 'the-post-grid' ),
6899 'type' => Controls_Manager::COLOR,
6900 'selectors' => [
6901 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'border-bottom-color: {{VALUE}}',
6902 ],
6903 'condition' => [
6904 'filter_type' => 'dropdown',
6905 ],
6906 ]
6907 );
6908
6909 $ref->add_control(
6910 'filter_nav_color',
6911 [
6912 'label' => esc_html__( 'Filter Nav Color', 'the-post-grid' ),
6913 'type' => Controls_Manager::COLOR,
6914 'selectors' => [
6915 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}',
6916 ],
6917 'condition' => [
6918 'filter_btn_style' => 'carousel',
6919 'filter_next_prev_btn' => 'visible',
6920 ],
6921 ]
6922 );
6923
6924 $ref->add_control(
6925 'filter_nav_bg',
6926 [
6927 'label' => esc_html__( 'Filter Nav Background', 'the-post-grid' ),
6928 'type' => Controls_Manager::COLOR,
6929 'selectors' => [
6930 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}',
6931 ],
6932 'condition' => [
6933 'filter_btn_style' => 'carousel',
6934 'filter_next_prev_btn' => 'visible',
6935 ],
6936 ]
6937 );
6938
6939 $ref->add_control(
6940 'filter_nav_border',
6941 [
6942 'label' => esc_html__( 'Filter Nav Border', 'the-post-grid' ),
6943 'type' => Controls_Manager::COLOR,
6944 'selectors' => [
6945 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-color: {{VALUE}}',
6946 ],
6947 'condition' => [
6948 'filter_btn_style' => 'carousel',
6949 'filter_next_prev_btn' => 'visible',
6950 ],
6951 ]
6952 );
6953
6954 $ref->end_controls_tab();
6955
6956 // Start Tab Hover
6957 $ref->start_controls_tab(
6958 'frontend_filter_style_hover_tab',
6959 [
6960 'label' => esc_html__( 'Hover / Active', 'the-post-grid' ),
6961 ]
6962 );
6963
6964 $ref->add_control(
6965 'filter_color_hover',
6966 [
6967 'label' => esc_html__( 'Filter Color - Hover', 'the-post-grid' ),
6968 'type' => Controls_Manager::COLOR,
6969 'selectors' => [
6970 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'color: {{VALUE}}',
6971 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'color: {{VALUE}}',
6972 '{{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action:hover .rt-sort-order-action-arrow > span:before, {{WRAPPER}} .rt-filter-item-wrap.rt-sort-order-action:hover .rt-sort-order-action-arrow > span:after' => 'background-color: {{VALUE}}',
6973 ],
6974 ]
6975 );
6976
6977 $ref->add_control(
6978 'filter_bg_color_hover',
6979 [
6980 'label' => esc_html__( 'Filter Background Color - Hover', 'the-post-grid' ),
6981 'type' => Controls_Manager::COLOR,
6982 'selectors' => [
6983 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'background-color: {{VALUE}}',
6984 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'background-color: {{VALUE}}',
6985 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover' => 'background-color: {{VALUE}}',
6986 ],
6987 ]
6988 );
6989
6990 $ref->add_control(
6991 'filter_border_color_hover',
6992 [
6993 'label' => esc_html__( 'Filter Border Color - Hover', 'the-post-grid' ),
6994 'type' => Controls_Manager::COLOR,
6995 'selectors' => [
6996 '{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'border-color: {{VALUE}}',
6997 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap:hover' => 'border-color: {{VALUE}}',
6998 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover' => 'border-color: {{VALUE}}',
6999 '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'border-color: {{VALUE}}',
7000 '{{WRAPPER}}.filter-button-border-enable .tpg-header-wrapper.carousel .rt-layout-filter-container:hover' => 'border-color: {{VALUE}}',
7001 ],
7002 ]
7003 );
7004
7005 $ref->add_control(
7006 'filter_search_bg_hover',
7007 [
7008 'label' => esc_html__( 'Search Background - Hover', 'the-post-grid' ),
7009 'type' => Controls_Manager::COLOR,
7010 'selectors' => [
7011 '{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'background-color: {{VALUE}}',
7012 ],
7013 'condition' => [
7014 'show_search' => 'show',
7015 'filter_btn_style' => 'default',
7016 ],
7017 ]
7018 );
7019
7020 $ref->add_control(
7021 'sub_menu_color_heading_hover',
7022 [
7023 'label' => esc_html__( 'Sub Menu Options - Hover', 'the-post-grid' ),
7024 'type' => Controls_Manager::HEADING,
7025 'separator' => 'before',
7026 'classes' => 'tpg-control-type-heading',
7027 'condition' => [
7028 'filter_type' => 'dropdown',
7029 ],
7030 ]
7031 );
7032
7033 $ref->add_control(
7034 'sub_menu_bg_color_hover',
7035 [
7036 'label' => esc_html__( 'Submenu Background - Hover', 'the-post-grid' ),
7037 'type' => Controls_Manager::COLOR,
7038 'selectors' => [
7039 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'background-color: {{VALUE}}',
7040 ],
7041 'condition' => [
7042 'filter_type' => 'dropdown',
7043 ],
7044 ]
7045 );
7046
7047 $ref->add_control(
7048 'sub_menu_color_hover',
7049 [
7050 'label' => esc_html__( 'Submenu Color - Hover', 'the-post-grid' ),
7051 'type' => Controls_Manager::COLOR,
7052 'selectors' => [
7053 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'color: {{VALUE}}',
7054 ],
7055 'condition' => [
7056 'filter_type' => 'dropdown',
7057 ],
7058 ]
7059 );
7060
7061 $ref->add_control(
7062 'sub_menu_border_bottom_hover',
7063 [
7064 'label' => esc_html__( 'Submenu Border - Hover', 'the-post-grid' ),
7065 'type' => Controls_Manager::COLOR,
7066 'selectors' => [
7067 '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'border-bottom-color: {{VALUE}}',
7068 ],
7069 'condition' => [
7070 'filter_type' => 'dropdown',
7071 ],
7072 ]
7073 );
7074
7075 $ref->add_control(
7076 'filter_nav_color_hover',
7077 [
7078 'label' => esc_html__( 'Filter Nav Color - Hover', 'the-post-grid' ),
7079 'type' => Controls_Manager::COLOR,
7080 'selectors' => [
7081 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}',
7082 ],
7083 'condition' => [
7084 'filter_btn_style' => 'carousel',
7085 'filter_next_prev_btn' => 'visible',
7086 ],
7087 ]
7088 );
7089
7090 $ref->add_control(
7091 'filter_nav_bg_hover',
7092 [
7093 'label' => esc_html__( 'Filter Nav Background - Hover', 'the-post-grid' ),
7094 'type' => Controls_Manager::COLOR,
7095 'selectors' => [
7096 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}',
7097 ],
7098 'condition' => [
7099 'filter_btn_style' => 'carousel',
7100 'filter_next_prev_btn' => 'visible',
7101 ],
7102 ]
7103 );
7104
7105 $ref->add_control(
7106 'filter_nav_border_hover',
7107 [
7108 'label' => esc_html__( 'Filter Nav Border - Hover', 'the-post-grid' ),
7109 'type' => Controls_Manager::COLOR,
7110 'selectors' => [
7111 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'border-color: {{VALUE}}',
7112 ],
7113 'condition' => [
7114 'filter_btn_style' => 'carousel',
7115 'filter_next_prev_btn' => 'visible',
7116 ],
7117 ]
7118 );
7119
7120 $ref->end_controls_tab();
7121
7122 $ref->end_controls_tabs();
7123 // End Tab
7124
7125 $ref->end_controls_section();
7126 }
7127
7128 /**
7129 * Social Share Style
7130 *
7131 * @param $ref
7132 */
7133 public static function socialShareStyle( $ref ) {
7134 $prefix = $ref->prefix;
7135 $ref->start_controls_section(
7136 'social_share_style',
7137 [
7138 'label' => esc_html__( 'Social Share', 'the-post-grid' ),
7139 'tab' => Controls_Manager::TAB_STYLE,
7140 'condition' => [
7141 'show_social_share' => 'show',
7142 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
7143 ],
7144 ]
7145 );
7146
7147 self::get_social_share_control( $ref );
7148
7149 $ref->end_controls_section();
7150 }
7151
7152 /**
7153 * Get Social Share
7154 *
7155 * @param $ref
7156 * @param $prefix
7157 */
7158 public static function get_social_share_control( $ref ) {
7159 $settings = get_option( rtTPG()->options['settings'] );
7160 $ssList = ! empty( $settings['social_share_items'] ) ? $settings['social_share_items'] : [];
7161
7162 $ref->add_responsive_control(
7163 'social_icon_margin',
7164 [
7165 'label' => esc_html__( 'Icon Margin', 'the-post-grid' ),
7166 'type' => Controls_Manager::DIMENSIONS,
7167 'size_units' => [ 'px' ],
7168 'allowed_dimensions' => 'all',
7169 'selectors' => [
7170 '{{WRAPPER}} .rt-tpg-social-share a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
7171 ],
7172 ]
7173 );
7174
7175 $ref->add_responsive_control(
7176 'social_wrapper_margin',
7177 [
7178 'label' => esc_html__( 'Icon Wrapper Spacing', 'the-post-grid' ),
7179 'type' => Controls_Manager::DIMENSIONS,
7180 'size_units' => [ 'px' ],
7181 'allowed_dimensions' => 'all', // horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
7182 'default' => [
7183 'top' => '',
7184 'right' => '',
7185 'bottom' => '',
7186 'left' => '',
7187 'isLinked' => false,
7188 ],
7189 'selectors' => [
7190 '{{WRAPPER}} .rt-tpg-social-share' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
7191 ],
7192 ]
7193 );
7194
7195 $ref->add_responsive_control(
7196 'social_icon_radius',
7197 [
7198 'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
7199 'type' => Controls_Manager::DIMENSIONS,
7200 'size_units' => [ 'px', '%', 'em' ],
7201 'allowed_dimensions' => 'all',
7202 'default' => [
7203 'top' => '',
7204 'right' => '',
7205 'bottom' => '',
7206 'left' => '',
7207 'isLinked' => true,
7208 ],
7209 'selectors' => [
7210 '{{WRAPPER}} .rt-tpg-social-share i' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
7211 ],
7212 ]
7213 );
7214
7215 $ref->add_control(
7216 'icon_width_height',
7217 [
7218 'label' => esc_html__( 'Icon Dimension (px)', 'the-post-grid' ),
7219 'type' => Controls_Manager::IMAGE_DIMENSIONS,
7220 'default' => [
7221 'width' => '',
7222 'height' => '',
7223 ],
7224 'selectors' => [
7225 '{{WRAPPER}} .rt-tpg-social-share a i' => 'width:{{width}}px; height:{{height}}px;',
7226 ],
7227 'description' => esc_html__( 'Just write number. Don\'t use (px or em).', 'the-post-grid' ),
7228 'classes' => 'should-show-title',
7229 ]
7230 );
7231
7232 $ref->add_responsive_control(
7233 'icon_font_size',
7234 [
7235 'label' => esc_html__( 'Icon Font Size', 'the-post-grid' ),
7236 'type' => Controls_Manager::SLIDER,
7237 'size_units' => [ 'px' ],
7238 'range' => [
7239 'px' => [
7240 'min' => 12,
7241 'max' => 50,
7242 'step' => 1,
7243 ],
7244 ],
7245 'selectors' => [
7246 '{{WRAPPER}} .rt-tpg-social-share a i' => 'font-size: {{SIZE}}{{UNIT}};',
7247 ],
7248 ]
7249 );
7250
7251 $ref->add_control(
7252 'social_icon_color_heading',
7253 [
7254 'label' => esc_html__( 'Icon Color:', 'the-post-grid' ),
7255 'type' => Controls_Manager::HEADING,
7256 'separator' => 'before',
7257 'classes' => 'tpg-control-type-heading',
7258 ]
7259 );
7260
7261 $ref->add_control(
7262 'social_icon_style',
7263 [
7264 'label' => esc_html__( 'Icon Color Style', 'the-post-grid' ),
7265 'type' => Controls_Manager::SELECT,
7266 'default' => 'default',
7267 'options' => [
7268 'default' => esc_html__( 'Default (Brand Color)', 'the-post-grid' ),
7269 'different_color' => esc_html__( 'Different Color for each', 'the-post-grid' ),
7270 'custom' => esc_html__( 'Custom color', 'the-post-grid' ),
7271 ],
7272 'description' => esc_html__( 'Select Custom for your own customize', 'the-post-grid' ),
7273 ]
7274 );
7275
7276 // Start Social Share Tabs Tab
7277 $ref->start_controls_tabs(
7278 'social_share_style_tabs'
7279 );
7280
7281 $ref->start_controls_tab(
7282 'social_share_normal_tab',
7283 [
7284 'label' => esc_html__( 'Normal', 'the-post-grid' ),
7285 ]
7286 );
7287 // Normal Tab
7288
7289 $ref->add_control(
7290 'social_icon_color',
7291 [
7292 'label' => esc_html__( 'Social Icon color', 'the-post-grid' ),
7293 'type' => Controls_Manager::COLOR,
7294 'selectors' => [
7295 '{{WRAPPER}} .rt-tpg-social-share a i' => 'color: {{VALUE}}',
7296 ],
7297 'condition' => [
7298 'social_icon_style' => 'custom',
7299 ],
7300 ]
7301 );
7302
7303 $ref->add_control(
7304 'social_icon_bg_color',
7305 [
7306 'label' => esc_html__( 'Social Icon Background', 'the-post-grid' ),
7307 'type' => Controls_Manager::COLOR,
7308 'selectors' => [
7309 '{{WRAPPER}} .rt-tpg-social-share a i' => 'background-color: {{VALUE}}',
7310 ],
7311 'condition' => [
7312 'social_icon_style' => 'custom',
7313 ],
7314 ]
7315 );
7316
7317 foreach ( $ssList as $ss ) {
7318 $ref->add_control(
7319 $ss . '_social_icon_color',
7320 [
7321 'label' => ucwords( $ss ) . esc_html__( ' color', 'the-post-grid' ),
7322 'type' => Controls_Manager::COLOR,
7323 'selectors' => [
7324 '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'color: {{VALUE}}',
7325 ],
7326 'condition' => [
7327 'social_icon_style' => 'different_color',
7328 ],
7329 ]
7330 );
7331
7332 $ref->add_control(
7333 $ss . '_social_icon_bg_color',
7334 [
7335 'label' => ucwords( $ss ) . esc_html__( ' Background', 'the-post-grid' ),
7336 'type' => Controls_Manager::COLOR,
7337 'selectors' => [
7338 '{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'background-color: {{VALUE}}',
7339 ],
7340 'condition' => [
7341 'social_icon_style' => 'different_color',
7342 ],
7343 ]
7344 );
7345 }
7346
7347 $ref->add_group_control(
7348 \Elementor\Group_Control_Border::get_type(),
7349 [
7350 'name' => 'social_icon_border',
7351 'label' => esc_html__( 'Icon Border', 'the-post-grid' ),
7352 'selector' => '{{WRAPPER}} .rt-tpg-social-share a i',
7353 ]
7354 );
7355
7356 $ref->end_controls_tab();
7357
7358 $ref->start_controls_tab(
7359 'socia_hover_tab',
7360 [
7361 'label' => esc_html__( 'Hover', 'the-post-grid' ),
7362 ]
7363 );
7364
7365 // Hover Tab
7366
7367 $ref->add_control(
7368 'social_icon_color_hover',
7369 [
7370 'label' => esc_html__( 'Icon color', 'the-post-grid' ),
7371 'type' => Controls_Manager::COLOR,
7372 'selectors' => [
7373 '{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'color: {{VALUE}} !important',
7374 ],
7375 ]
7376 );
7377
7378 $ref->add_control(
7379 'social_icon_bg_color_hover',
7380 [
7381 'label' => esc_html__( 'Icon Background', 'the-post-grid' ),
7382 'type' => Controls_Manager::COLOR,
7383 'selectors' => [
7384 '{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'background-color: {{VALUE}} !important',
7385 ],
7386 // 'condition' => [
7387 // 'social_icon_style' => 'custom',
7388 // ],
7389 ]
7390 );
7391 $ref->add_group_control(
7392 \Elementor\Group_Control_Border::get_type(),
7393 [
7394 'name' => 'social_icon_border_hover',
7395 'label' => esc_html__( 'Icon Border - Hover', 'the-post-grid' ),
7396 'selector' => '{{WRAPPER}} .rt-tpg-social-share a:hover i',
7397 ]
7398 );
7399
7400 $ref->end_controls_tab();
7401
7402 // ============================
7403 $ref->start_controls_tab(
7404 'socia_box_hover_tab',
7405 [
7406 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
7407 ]
7408 );
7409
7410 $ref->add_control(
7411 'social_icon_color_box_hover',
7412 [
7413 'label' => esc_html__( 'Icon color - BoxHover', 'the-post-grid' ),
7414 'type' => Controls_Manager::COLOR,
7415 'selectors' => [
7416 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .rt-tpg-social-share a i' => 'color: {{VALUE}}',
7417 ],
7418 ]
7419 );
7420
7421 $ref->add_control(
7422 'social_icon_bg_color_box_hover',
7423 [
7424 'label' => esc_html__( 'Icon Background - BoxHover', 'the-post-grid' ),
7425 'type' => Controls_Manager::COLOR,
7426 'selectors' => [
7427 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .rt-tpg-social-share a i' => 'background-color: {{VALUE}}',
7428 ],
7429 ]
7430 );
7431
7432 $ref->end_controls_tab();
7433
7434 $ref->end_controls_tabs();
7435 }
7436
7437 /**
7438 * Box style / Card style
7439 *
7440 * @param $ref
7441 */
7442 public static function articlBoxSettings( $ref ) {
7443 $prefix = $ref->prefix;
7444 $ref->start_controls_section(
7445 'article_box_settings',
7446 [
7447 'label' => esc_html__( 'Card (Post Item)', 'the-post-grid' ),
7448 'tab' => Controls_Manager::TAB_STYLE,
7449 ]
7450 );
7451
7452 if ( 'grid_hover' !== $prefix ) {
7453 $ref->add_control( 'sticky_item_background', [
7454 'label' => __( 'Sticky Item Background', 'the-post-grid' ),
7455 'type' => Controls_Manager::COLOR,
7456 'selectors' => [
7457 '{{WRAPPER}} .rt-tpg-container .rt-holder.rt-sticky' => 'background: {{VALUE}} !important',
7458 ],
7459 ] );
7460 }
7461
7462 if ( 'slider' !== $prefix ) {
7463 $ref->add_responsive_control(
7464 'box_margin',
7465 [
7466 'label' => esc_html__( 'Card Gap', 'the-post-grid' ),
7467 'type' => Controls_Manager::DIMENSIONS,
7468 'size_units' => [ 'px' ],
7469 'render_type' => 'template',
7470 'selectors' => [
7471 '{{WRAPPER}} .tpg-el-main-wrapper .rt-row [class*="rt-col"]' => 'padding-left: {{LEFT}}{{UNIT}} !important; padding-right: {{RIGHT}}{{UNIT}} !important; padding-bottom: calc(2 * {{BOTTOM}}{{UNIT}}) !important;',
7472 '{{WRAPPER}} .tpg-el-main-wrapper .rt-row' => 'margin-left: -{{LEFT}}{{UNIT}}; margin-right: -{{RIGHT}}{{UNIT}}',
7473 '{{WRAPPER}} .tpg-el-main-wrapper .rt-row .rt-row' => 'margin-bottom: -{{RIGHT}}{{UNIT}}',
7474 '{{WRAPPER}} .rt-tpg-container .grid_hover-layout8 .display-grid-wrapper' => 'grid-gap: {{TOP}}{{UNIT}};margin-bottom: {{TOP}}{{UNIT}}',
7475 ],
7476 'condition' => [
7477 $prefix . '_layout!' => [
7478 'grid-layout2',
7479 'grid-layout5',
7480 'grid-layout5-2',
7481 'grid-layout6',
7482 'grid-layout6-2',
7483 'list-layout4',
7484 ],
7485 ],
7486 ]
7487 );
7488 }
7489
7490 if ( in_array( $prefix, [ 'grid', 'list', 'slider' ] ) ) {
7491 if ( 'slider' == $prefix ) {
7492 $box_padding = [
7493 $prefix . '_layout' => [
7494 'slider-layout1',
7495 'slider-layout2',
7496 'slider-layout3',
7497 ],
7498 ];
7499 } else {
7500 $box_padding = [
7501 $prefix . '_layout!' => [
7502 'grid-layout5',
7503 'grid-layout5-2',
7504 'grid-layout6',
7505 'grid-layout6-2',
7506 'grid-layout7',
7507 'list-layout1',
7508 'list-layout2',
7509 'list-layout2-2',
7510 'list-layout3',
7511 'list-layout3-2',
7512 'list-layout4',
7513 'list-layout5',
7514 'slider-layout1',
7515 'slider-layout2',
7516 'slider-layout3',
7517 ],
7518 ];
7519 }
7520 $ref->add_responsive_control(
7521 'content_box_padding',
7522 [
7523 'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
7524 'type' => Controls_Manager::DIMENSIONS,
7525 'size_units' => [ 'px' ],
7526 'allowed_dimensions' => 'all',
7527 'selectors' => [
7528 'body {{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
7529 'body {{WRAPPER}} .rt-tpg-container .rt-el-content-wrapper-flex .post-right-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
7530 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-holder .rt-el-content-wrapper .tpg-el-image-wrap' => 'margin-left: -{{LEFT}}{{UNIT}}; margin-right: -{{RIGHT}}{{UNIT}};',
7531 ],
7532 'condition' => $box_padding,
7533 ]
7534 );
7535
7536 $ref->add_responsive_control(
7537 'content_box_padding_offset',
7538 [
7539 'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
7540 'type' => Controls_Manager::DIMENSIONS,
7541 'size_units' => [ 'px' ],
7542 'allowed_dimensions' => 'all',
7543 'selectors' => [
7544 'body {{WRAPPER}} .tpg-el-main-wrapper .offset-left .tpg-post-holder .offset-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
7545 '{{WRAPPER}} .rt-tpg-container .list-layout4 .post-right-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
7546 ],
7547 'condition' => [
7548 $prefix . '_layout' => [
7549 'grid-layout5',
7550 'grid-layout5-2',
7551 'list-layout4',
7552 ],
7553 ],
7554 ]
7555 );
7556 }
7557
7558 $ref->add_responsive_control(
7559 'content_box_padding_2',
7560 [
7561 'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
7562 'type' => Controls_Manager::DIMENSIONS,
7563 'size_units' => [ 'px' ],
7564 'allowed_dimensions' => 'all',
7565 'selectors' => [
7566 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
7567 ],
7568 'condition' => [
7569 $prefix . '_layout' => [ 'slider-layout13' ],
7570 ],
7571 ]
7572 );
7573
7574 $ref->add_responsive_control(
7575 'box_radius',
7576 [
7577 'label' => esc_html__( 'Card Border Radius', 'the-post-grid' ),
7578 'type' => Controls_Manager::DIMENSIONS,
7579 'size_units' => [ 'px', '%' ],
7580 'selectors' => [
7581 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};overflow:hidden;',
7582 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};overflow:hidden;',
7583 ],
7584 'condition' => [
7585 $prefix . '_layout!' => [
7586 'list-layout2',
7587 'list-layout2-2',
7588 'list-layout3',
7589 'list-layout3-2',
7590 'list-layout4',
7591 'list-layout4-2',
7592 'list-layout5',
7593 'list-layout5-2',
7594 'slider-layout11',
7595 'slider-layout12',
7596 'slider-layout13',
7597 ],
7598 ],
7599 ]
7600 );
7601
7602 if ( in_array( $prefix, [ 'grid', 'list' ] ) ) {
7603 $ref->add_control(
7604 'is_box_border',
7605 [
7606 'label' => esc_html__( 'Enable Border & Box Shadow', 'the-post-grid' ),
7607 'type' => Controls_Manager::SELECT,
7608 'default' => 'enable',
7609 'options' => [
7610 'enable' => esc_html__( 'Enable', 'the-post-grid' ),
7611 'disable' => esc_html__( 'Disable', 'the-post-grid' ),
7612 ],
7613 'prefix_class' => 'tpg-el-box-border-',
7614 'condition' => [
7615 $prefix . '_layout!' => [
7616 'slider-layout11',
7617 'slider-layout12',
7618 'slider-layout13',
7619 ],
7620 ],
7621 ]
7622 );
7623 }
7624
7625 if ( 'slider' ) {
7626 $ref->add_control(
7627 'box_border_bottom',
7628 [
7629 'label' => esc_html__( 'Enable Border Bottom', 'the-post-grid' ),
7630 'type' => Controls_Manager::SELECT,
7631 'default' => 'disable',
7632 'options' => [
7633 'enable' => esc_html__( 'Enable', 'the-post-grid' ),
7634 'disable' => esc_html__( 'Disable', 'the-post-grid' ),
7635 ],
7636 'prefix_class' => 'tpg-border-bottom-',
7637 'condition' => [
7638 $prefix . '_layout!' => [
7639 'slider-layout11',
7640 'slider-layout12',
7641 'slider-layout13',
7642 ],
7643 ],
7644 ]
7645 );
7646 }
7647
7648 $ref->add_control(
7649 'box_border_bottom_color',
7650 [
7651 'label' => esc_html__( 'Border Bottom Color', 'the-post-grid' ),
7652 'type' => Controls_Manager::COLOR,
7653 'selectors' => [
7654 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border-bottom-color: {{VALUE}}',
7655 ],
7656 'condition' => [
7657 'box_border_bottom' => 'enable',
7658 ],
7659 ]
7660 );
7661
7662 $ref->add_responsive_control(
7663 'box_border_spacing',
7664 [
7665 'label' => esc_html__( 'Border Spacing Bottom', 'the-post-grid' ),
7666 'type' => Controls_Manager::SLIDER,
7667 'size_units' => [ 'px' ],
7668 'range' => [
7669 'px' => [
7670 'min' => 0,
7671 'max' => 200,
7672 'step' => 1,
7673 ],
7674 ],
7675 'selectors' => [
7676 '{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'padding-bottom: {{SIZE}}{{UNIT}};',
7677 ],
7678 'condition' => [
7679 'box_border_bottom' => 'enable',
7680 ],
7681 ]
7682 );
7683
7684 if ( 'grid_hover' !== $prefix ) {
7685 // Start Tab
7686 $ref->start_controls_tabs(
7687 'box_style_tabs'
7688 );
7689
7690 // Normal Tab
7691 $ref->start_controls_tab(
7692 'box_style_normal_tab',
7693 [
7694 'label' => esc_html__( 'Normal', 'the-post-grid' ),
7695 ]
7696 );
7697
7698 $ref->add_group_control(
7699 \Elementor\Group_Control_Background::get_type(),
7700 [
7701 'name' => 'box_background',
7702 'label' => esc_html__( 'Background', 'the-post-grid' ),
7703 'fields_options' => [
7704 'background' => [
7705 'label' => esc_html__( 'Card Background', 'the-post-grid' ),
7706 ],
7707 ],
7708 'types' => [ 'classic', 'gradient' ],
7709 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder',
7710 'condition' => [
7711 $prefix . '_layout!' => [ 'slider-layout13' ],
7712 ],
7713 ]
7714 );
7715
7716 $ref->add_group_control(
7717 \Elementor\Group_Control_Background::get_type(),
7718 [
7719 'name' => 'box_background2',
7720 'label' => esc_html__( 'Background', 'the-post-grid' ),
7721 'fields_options' => [
7722 'background' => [
7723 'label' => esc_html__( 'Card Background', 'the-post-grid' ),
7724 ],
7725 ],
7726 'types' => [ 'classic', 'gradient' ],
7727 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
7728 'condition' => [
7729 $prefix . '_layout' => [ 'slider-layout13' ],
7730 ],
7731 ]
7732 );
7733
7734 if ( in_array( $prefix, [ 'grid', 'list' ] ) ) {
7735 $ref->add_control(
7736 'box_border',
7737 [
7738 'label' => esc_html__( 'Border Color', 'the-post-grid' ),
7739 'type' => Controls_Manager::COLOR,
7740 'selectors' => [
7741 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border: 1px solid {{VALUE}}',
7742 ],
7743 'condition' => [
7744 'is_box_border' => 'enable',
7745 ],
7746 ]
7747 );
7748
7749 $ref->add_group_control(
7750 \Elementor\Group_Control_Box_Shadow::get_type(),
7751 [
7752 'name' => 'box_box_shadow',
7753 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ),
7754 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder',
7755 'condition' => [
7756 'is_box_border' => 'enable',
7757 ],
7758 ]
7759 );
7760 }
7761
7762 $ref->add_group_control(
7763 \Elementor\Group_Control_Box_Shadow::get_type(),
7764 [
7765 'name' => 'box_box_shadow2',
7766 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ),
7767 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
7768 'condition' => [
7769 $prefix . '_layout' => [ 'slider-layout13' ],
7770 ],
7771 ]
7772 );
7773
7774 $ref->end_controls_tab();
7775
7776 // Hover Tab
7777 $ref->start_controls_tab(
7778 'box_style_hover_tab',
7779 [
7780 'label' => esc_html__( 'Hover', 'the-post-grid' ),
7781 ]
7782 );
7783
7784 $ref->add_group_control(
7785 \Elementor\Group_Control_Background::get_type(),
7786 [
7787 'name' => 'box_background_hover',
7788 'label' => esc_html__( 'Background - Hover', 'the-post-grid' ),
7789 'fields_options' => [
7790 'background' => [
7791 'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ),
7792 ],
7793 ],
7794 'types' => [ 'classic', 'gradient' ],
7795 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover',
7796 'condition' => [
7797 $prefix . '_layout!' => [ 'slider-layout13' ],
7798 ],
7799 ]
7800 );
7801
7802 $ref->add_group_control(
7803 \Elementor\Group_Control_Background::get_type(),
7804 [
7805 'name' => 'box_background_hover2',
7806 'label' => esc_html__( 'Background - Hover', 'the-post-grid' ),
7807 'fields_options' => [
7808 'background' => [
7809 'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ),
7810 ],
7811 ],
7812 'types' => [ 'classic', 'gradient' ],
7813 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
7814 'condition' => [
7815 $prefix . '_layout' => [ 'slider-layout13' ],
7816 ],
7817 ]
7818 );
7819
7820 if ( in_array( $prefix, [ 'grid', 'list' ] ) ) {
7821 $ref->add_control(
7822 'box_border_hover',
7823 [
7824 'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ),
7825 'type' => Controls_Manager::COLOR,
7826 'selectors' => [
7827 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover' => 'border: 1px solid {{VALUE}}',
7828 ],
7829 'condition' => [
7830 'is_box_border' => 'enable',
7831 ],
7832 ]
7833 );
7834
7835 $ref->add_group_control(
7836 \Elementor\Group_Control_Box_Shadow::get_type(),
7837 [
7838 'name' => 'box_box_shadow_hover',
7839 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ),
7840 'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover',
7841 'condition' => [
7842 'is_box_border' => 'enable',
7843 ],
7844 ]
7845 );
7846 }
7847
7848 $ref->add_group_control(
7849 \Elementor\Group_Control_Box_Shadow::get_type(),
7850 [
7851 'name' => 'box_box_shadow_hover2',
7852 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ),
7853 'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
7854 'condition' => [
7855 $prefix . '_layout' => [ 'slider-layout13' ],
7856 ],
7857 ]
7858 );
7859
7860 $ref->end_controls_tab();
7861
7862 $ref->end_controls_tabs();
7863 // End Tab
7864
7865 }
7866
7867 $ref->end_controls_section();
7868 }
7869
7870 /**
7871 * Slider Settings
7872 *
7873 * @param $ref
7874 */
7875 public static function slider_settings( $ref, $layout_type = '' ) {
7876 $slider_condition = '';
7877 if ( 'single' === $layout_type ) {
7878 $slider_condition = [
7879 'enable_related_slider!' => '',
7880 ];
7881 }
7882 $prefix = $ref->prefix;
7883 $ref->start_controls_section(
7884 'slider_settings',
7885 [
7886 'label' => esc_html__( 'Slider', 'the-post-grid' ),
7887 'tab' => Controls_Manager::TAB_SETTINGS,
7888 'condition' => $slider_condition,
7889 ]
7890 );
7891
7892 $ref->add_responsive_control(
7893 'slider_gap',
7894 [
7895 'label' => esc_html__( 'Slider Gap', 'the-post-grid' ),
7896 'type' => Controls_Manager::SLIDER,
7897 'size_units' => [ 'px' ],
7898 'range' => [
7899 'px' => [
7900 'min' => 0,
7901 'max' => 100,
7902 'step' => 1,
7903 ],
7904 ],
7905 'selectors' => [
7906 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-slider-item' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
7907 'body {{WRAPPER}} .tpg-el-main-wrapper .rt-swiper-holder' => 'margin-left: calc(-{{SIZE}}{{UNIT}} - 5px);margin-right: -{{SIZE}}{{UNIT}};',
7908 '{{WRAPPER}} .rt-tpg-container .slider-column.swiper-slide .rt-slider-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};',
7909 ],
7910 'condition' => [
7911 $prefix . '_layout!' => [
7912 'slider-layout10',
7913 'slider-layout11',
7914 'slider-layout12',
7915 'slider-layout13',
7916 ],
7917 ],
7918 ]
7919 );
7920
7921 $ref->add_control(
7922 'arrows',
7923 [
7924 'label' => esc_html__( 'Arrow Visibility', 'the-post-grid' ),
7925 'type' => Controls_Manager::SWITCHER,
7926 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
7927 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
7928 'return_value' => 'yes',
7929 'default' => 'yes',
7930 'condition' => [
7931 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
7932 ],
7933 ]
7934 );
7935
7936 $ref->add_control(
7937 'arrow_position',
7938 [
7939 'label' => esc_html__( 'Arrow Position', 'the-post-grid' ),
7940 'type' => Controls_Manager::SELECT,
7941 'default' => 'default',
7942 'options' => [
7943 'default' => esc_html__( 'Default', 'the-post-grid' ),
7944 'top-right' => esc_html__( 'Top Right', 'the-post-grid' ),
7945 'top-left' => esc_html__( 'Top Left', 'the-post-grid' ),
7946 'show-hover' => esc_html__( 'Center (Show on hover)', 'the-post-grid' ),
7947 ],
7948 'condition' => [
7949 'arrows' => 'yes',
7950 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
7951 ],
7952 'prefix_class' => 'slider-arrow-position-',
7953 ]
7954 );
7955
7956 $ref->add_control(
7957 'dots',
7958 [
7959 'label' => esc_html__( 'Dots Visibility', 'the-post-grid' ),
7960 'type' => Controls_Manager::SWITCHER,
7961 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
7962 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
7963 'return_value' => 'yes',
7964 'default' => 'yes',
7965 'prefix_class' => 'slider-dot-enable-',
7966 'render_type' => 'template',
7967 'condition' => [
7968 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
7969 ],
7970 ]
7971 );
7972
7973 $ref->add_control(
7974 'dynamic_dots',
7975 [
7976 'label' => esc_html__( 'Enable Dynamic Dots', 'the-post-grid' ),
7977 'type' => Controls_Manager::SWITCHER,
7978 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
7979 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
7980 'return_value' => 'yes',
7981 'default' => 'no',
7982 'render_type' => 'template',
7983 'condition' => [
7984 'dots' => 'yes',
7985 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
7986 ],
7987 ]
7988 );
7989
7990 $ref->add_control(
7991 'dots_style',
7992 [
7993 'label' => esc_html__( 'Dots Style', 'the-post-grid' ),
7994 'type' => Controls_Manager::SELECT,
7995 'default' => 'default',
7996 'options' => [
7997 'default' => esc_html__( 'Default', 'the-post-grid' ),
7998 'background' => esc_html__( 'With Background', 'the-post-grid' ),
7999 ],
8000 'condition' => [
8001 'dots' => 'yes',
8002 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
8003 ],
8004 'prefix_class' => 'slider-dots-style-',
8005 ]
8006 );
8007
8008 $ref->add_control(
8009 'infinite',
8010 [
8011 'label' => esc_html__( 'Infinite', 'the-post-grid' ),
8012 'type' => Controls_Manager::SWITCHER,
8013 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
8014 'label_off' => esc_html__( 'No', 'the-post-grid' ),
8015 'return_value' => 'yes',
8016 'default' => 'yes',
8017 ]
8018 );
8019
8020 $ref->add_control(
8021 'autoplay',
8022 [
8023 'label' => esc_html__( 'Autoplay', 'the-post-grid' ),
8024 'type' => Controls_Manager::SWITCHER,
8025 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
8026 'label_off' => esc_html__( 'No', 'the-post-grid' ),
8027 'return_value' => 'yes',
8028 'default' => false,
8029 ]
8030 );
8031
8032 $ref->add_control(
8033 'autoplaySpeed',
8034 [
8035 'label' => esc_html__( 'Autoplay Speed (ms)', 'the-post-grid' ),
8036 'type' => Controls_Manager::NUMBER,
8037 'min' => 1000,
8038 'max' => 10000,
8039 'step' => 500,
8040 'default' => 3000,
8041 'condition' => [
8042 'autoplay' => 'yes',
8043 ],
8044 ]
8045 );
8046
8047 $ref->add_control(
8048 'stopOnHover',
8049 [
8050 'label' => esc_html__( 'Stop On Hover', 'the-post-grid' ),
8051 'type' => Controls_Manager::SWITCHER,
8052 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
8053 'label_off' => esc_html__( 'No', 'the-post-grid' ),
8054 'return_value' => 'yes',
8055 'default' => 'yes',
8056 'condition' => [
8057 'autoplay' => 'yes',
8058 ],
8059 ]
8060 );
8061
8062 $ref->add_control(
8063 'grabCursor',
8064 [
8065 'label' => esc_html__( 'Allow Touch Move', 'the-post-grid' ),
8066 'type' => Controls_Manager::SWITCHER,
8067 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
8068 'label_off' => esc_html__( 'No', 'the-post-grid' ),
8069 'return_value' => 'yes',
8070 'default' => 'yes',
8071 ]
8072 );
8073
8074 $ref->add_control(
8075 'autoHeight',
8076 [
8077 'label' => esc_html__( 'Auto Height', 'the-post-grid' ),
8078 'type' => Controls_Manager::SWITCHER,
8079 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
8080 'label_off' => esc_html__( 'No', 'the-post-grid' ),
8081 'return_value' => 'yes',
8082 'default' => false,
8083 'condition' => [
8084 'enable_2_rows!' => 'yes',
8085 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
8086 ],
8087 ]
8088 );
8089
8090 $ref->add_control(
8091 'lazyLoad',
8092 [
8093 'label' => esc_html__( 'lazy Load', 'the-post-grid' ),
8094 'type' => Controls_Manager::SWITCHER,
8095 'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
8096 'label_off' => esc_html__( 'No', 'the-post-grid' ),
8097 'return_value' => 'yes',
8098 'default' => false,
8099 'prefix_class' => 'is-lazy-load-',
8100 'render_type' => 'template',
8101 ]
8102 );
8103
8104 $ref->add_control(
8105 'speed',
8106 [
8107 'label' => esc_html__( 'Speed', 'the-post-grid' ),
8108 'type' => Controls_Manager::NUMBER,
8109 'min' => 100,
8110 'max' => 3000,
8111 'step' => 100,
8112 'default' => 500,
8113 ]
8114 );
8115
8116 $ref->add_control(
8117 'enable_2_rows',
8118 [
8119 'label' => esc_html__( 'Enable 2 Rows', 'the-post-grid' ),
8120 'type' => Controls_Manager::SWITCHER,
8121 'label_on' => esc_html__( 'Show', 'the-post-grid' ),
8122 'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
8123 'return_value' => 'yes',
8124 'default' => false,
8125 'prefix_class' => 'enable-two-rows-',
8126 'render_type' => 'template',
8127 'description' => esc_html__( 'If you use 2 rows then you have to put an even number for post limit', 'the-post-grid' ),
8128 'condition' => [
8129 $prefix . '_layout!' => [
8130 'slider-layout13',
8131 'slider-layout11',
8132 'slider-layout12',
8133 'slider-layout10',
8134 ],
8135 ],
8136 ]
8137 );
8138
8139 $ref->add_control(
8140 'carousel_overflow',
8141 [
8142 'label' => esc_html__( 'Slider Overflow', 'the-post-grid' ),
8143 'type' => Controls_Manager::SELECT,
8144 'default' => 'hidden',
8145 'options' => [
8146 'hidden' => esc_html__( 'Hidden', 'the-post-grid' ),
8147 'none' => esc_html__( 'None', 'the-post-grid' ),
8148 ],
8149 'render_type' => 'template',
8150 'prefix_class' => 'is-carousel-overflow-',
8151 'condition' => [
8152 'lazyLoad!' => 'yes',
8153 ],
8154 ]
8155 );
8156
8157 $ref->add_control(
8158 'slider_direction',
8159 [
8160 'label' => esc_html__( 'Direction', 'the-post-grid' ),
8161 'type' => Controls_Manager::SELECT,
8162 'default' => 'ltr',
8163 'options' => [
8164 'ltr' => esc_html__( 'LTR', 'the-post-grid' ),
8165 'rtl' => esc_html__( 'RTL', 'the-post-grid' ),
8166 ],
8167 'prefix_class' => 'slider-direction-',
8168 'render_type' => 'template',
8169 ]
8170 );
8171
8172 $ref->end_controls_section();
8173 }
8174
8175 /**
8176 * Slider Style
8177 *
8178 * @param $ref
8179 */
8180 public static function slider_style( $ref, $layout_type = '' ) {
8181 $prefix = $ref->prefix;
8182 if ( 'single' === $layout_type ) {
8183 $slider_condition = [
8184 'enable_related_slider!' => '',
8185 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
8186 ];
8187 } else {
8188 $slider_condition = [
8189 $prefix . '_layout!' => [ 'slider-layout11', 'slider-layout12' ],
8190 ];
8191 }
8192
8193 $ref->start_controls_section(
8194 'slider_style',
8195 [
8196 'label' => esc_html__( 'Slider', 'the-post-grid' ),
8197 'tab' => Controls_Manager::TAB_STYLE,
8198 'condition' => $slider_condition,
8199 ]
8200 );
8201
8202 $ref->add_control(
8203 'arrow_style_heading',
8204 [
8205 'label' => esc_html__( 'Arrow Style', 'the-post-grid' ),
8206 'type' => Controls_Manager::HEADING,
8207 'separator' => 'before',
8208 'classes' => 'tpg-control-type-heading',
8209 'condition' => [
8210 'arrows' => 'yes',
8211 ],
8212 ]
8213 );
8214
8215 $ref->add_responsive_control(
8216 'arrow_font_size',
8217 [
8218 'label' => esc_html__( 'Arrow Font Size', 'the-post-grid' ),
8219 'type' => Controls_Manager::SLIDER,
8220 'size_units' => [ 'px' ],
8221 'range' => [
8222 'px' => [
8223 'min' => 0,
8224 'max' => 100,
8225 'step' => 1,
8226 ],
8227 ],
8228 'selectors' => [
8229 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'font-size: {{SIZE}}{{UNIT}};',
8230 ],
8231 'condition' => [
8232 'arrows' => 'yes',
8233 ],
8234 ]
8235 );
8236
8237 $ref->add_responsive_control(
8238 'arrow_border_radius',
8239 [
8240 'label' => esc_html__( 'Arrow Radius', 'the-post-grid' ),
8241 'type' => Controls_Manager::SLIDER,
8242 'size_units' => [ 'px', '%' ],
8243 'range' => [
8244 'px' => [
8245 'min' => 0,
8246 'max' => 100,
8247 'step' => 1,
8248 ],
8249 '%' => [
8250 'min' => 0,
8251 'max' => 100,
8252 'step' => 1,
8253 ],
8254 ],
8255 'selectors' => [
8256 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-radius: {{SIZE}}{{UNIT}};',
8257 ],
8258 'condition' => [
8259 'arrows' => 'yes',
8260 ],
8261 ]
8262 );
8263
8264 $ref->add_responsive_control(
8265 'arrow_width',
8266 [
8267 'label' => esc_html__( 'Arrow Width', 'the-post-grid' ),
8268 'type' => Controls_Manager::SLIDER,
8269 'size_units' => [ 'px' ],
8270 'range' => [
8271 'px' => [
8272 'min' => 0,
8273 'max' => 200,
8274 'step' => 1,
8275 ],
8276 ],
8277 'selectors' => [
8278 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'width: {{SIZE}}{{UNIT}};',
8279 ],
8280 'condition' => [
8281 'arrows' => 'yes',
8282 ],
8283 ]
8284 );
8285
8286 $ref->add_responsive_control(
8287 'arrow_height',
8288 [
8289 'label' => esc_html__( 'Arrow Height', 'the-post-grid' ),
8290 'type' => Controls_Manager::SLIDER,
8291 'size_units' => [ 'px' ],
8292 'range' => [
8293 'px' => [
8294 'min' => 0,
8295 'max' => 200,
8296 'step' => 1,
8297 ],
8298 ],
8299 'selectors' => [
8300 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'height: {{SIZE}}{{UNIT}}; line-height:{{SIZE}}{{UNIT}};',
8301 ],
8302 'condition' => [
8303 'arrows' => 'yes',
8304 ],
8305 ]
8306 );
8307
8308 $ref->add_responsive_control(
8309 'arrow_x_position',
8310 [
8311 'label' => esc_html__( 'Arrow X Position', 'the-post-grid' ),
8312 'type' => Controls_Manager::SLIDER,
8313 'size_units' => [ 'px' ],
8314 'range' => [
8315 'px' => [
8316 'min' => - 300,
8317 'max' => 300,
8318 'step' => 1,
8319 ],
8320 ],
8321 'selectors' => [
8322 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn.swiper-button-prev' => 'left: {{SIZE}}{{UNIT}};',
8323 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn.swiper-button-next' => 'right: {{SIZE}}{{UNIT}};',
8324 '{{WRAPPER}}.slider-arrow-position-top-right .swiper-navigation' => 'right: {{SIZE}}{{UNIT}};',
8325 '{{WRAPPER}}.slider-arrow-position-top-left .swiper-navigation' => 'left: {{SIZE}}{{UNIT}};',
8326 ],
8327 'condition' => [
8328 'arrows' => 'yes',
8329 ],
8330 ]
8331 );
8332
8333 $ref->add_responsive_control(
8334 'arrow_y_position',
8335 [
8336 'label' => esc_html__( 'Arrow Y Position', 'the-post-grid' ),
8337 'type' => Controls_Manager::SLIDER,
8338 'size_units' => [ 'px', '%' ],
8339 'range' => [
8340 'px' => [
8341 'min' => - 150,
8342 'max' => 500,
8343 'step' => 1,
8344 ],
8345 ],
8346 'selectors' => [
8347 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'top: {{SIZE}}{{UNIT}};',
8348 '{{WRAPPER}}.slider-arrow-position-top-right .swiper-navigation, {{WRAPPER}}.slider-arrow-position-top-left .swiper-navigation' => 'top: {{SIZE}}{{UNIT}};',
8349 ],
8350 'condition' => [
8351 'arrows' => 'yes',
8352 ],
8353 ]
8354 );
8355
8356 // Arrow Tabs Start
8357 $ref->start_controls_tabs(
8358 'arrow_style_tabs',
8359 [
8360 'condition' => [
8361 'arrows' => 'yes',
8362 ],
8363 ]
8364 );
8365
8366 $ref->start_controls_tab(
8367 'arrow_style_normal_tab',
8368 [
8369 'label' => esc_html__( 'Normal', 'the-post-grid' ),
8370 ]
8371 );
8372
8373 $ref->add_control(
8374 'arrow_color',
8375 [
8376 'type' => Controls_Manager::COLOR,
8377 'label' => esc_html__( 'Arrow Icon Color', 'the-post-grid' ),
8378 'selectors' => [
8379 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}',
8380 ],
8381 ]
8382 );
8383
8384 $ref->add_control(
8385 'arrow_arrow_bg_color',
8386 [
8387 'type' => Controls_Manager::COLOR,
8388 'label' => esc_html__( 'Arrow Background', 'the-post-grid' ),
8389 'selectors' => [
8390 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}',
8391 ],
8392 ]
8393 );
8394
8395 $ref->add_group_control(
8396 \Elementor\Group_Control_Box_Shadow::get_type(),
8397 [
8398 'name' => 'arrow_box_shadow',
8399 'label' => esc_html__( 'Box Shadow', 'the-post-grid' ),
8400 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn',
8401 ]
8402 );
8403
8404 $ref->add_group_control(
8405 \Elementor\Group_Control_Border::get_type(),
8406 [
8407 'name' => 'border',
8408 'label' => esc_html__( 'Border', 'the-post-grid' ),
8409 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn',
8410 ]
8411 );
8412
8413 $ref->end_controls_tab();
8414
8415 $ref->start_controls_tab(
8416 'arrow_style_hover_tab',
8417 [
8418 'label' => esc_html__( 'Hover', 'the-post-grid' ),
8419 ]
8420 );
8421
8422 $ref->add_control(
8423 'arrow_hover_color',
8424 [
8425 'type' => Controls_Manager::COLOR,
8426 'label' => esc_html__( 'Arrow Icon Color - Hover', 'the-post-grid' ),
8427 'selectors' => [
8428 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}',
8429 ],
8430 ]
8431 );
8432
8433 $ref->add_control(
8434 'arrow_bg_hover_color',
8435 [
8436 'type' => Controls_Manager::COLOR,
8437 'label' => esc_html__( 'Arrow Background - Hover', 'the-post-grid' ),
8438 'selectors' => [
8439 '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}',
8440 ],
8441 ]
8442 );
8443
8444 $ref->add_group_control(
8445 \Elementor\Group_Control_Box_Shadow::get_type(),
8446 [
8447 'name' => 'arrow_box_shadow_hover',
8448 'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ),
8449 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover',
8450 ]
8451 );
8452
8453 $ref->add_group_control(
8454 \Elementor\Group_Control_Border::get_type(),
8455 [
8456 'name' => 'border_hover',
8457 'label' => esc_html__( 'Border - Hover', 'the-post-grid' ),
8458 'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover',
8459 ]
8460 );
8461
8462 $ref->end_controls_tab();
8463
8464 $ref->end_controls_tabs();
8465 // Arrow Tabs End
8466
8467 // Dots style Start
8468
8469 $ref->add_control(
8470 'dot_style_heading',
8471 [
8472 'label' => esc_html__( 'Dots Style', 'the-post-grid' ),
8473 'type' => Controls_Manager::HEADING,
8474 'separator' => 'before',
8475 'classes' => 'tpg-control-type-heading',
8476 'condition' => [
8477 'dots' => 'yes',
8478 ],
8479 ]
8480 );
8481
8482 $ref->add_control(
8483 'dots_text_align',
8484 [
8485 'label' => esc_html__( 'Dots Alignment', 'the-post-grid' ),
8486 'type' => Controls_Manager::CHOOSE,
8487 'options' => [
8488 'left' => [
8489 'title' => esc_html__( 'Left', 'the-post-grid' ),
8490 'icon' => 'eicon-text-align-left',
8491 ],
8492 'center' => [
8493 'title' => esc_html__( 'Center', 'the-post-grid' ),
8494 'icon' => 'eicon-text-align-center',
8495 ],
8496 'right' => [
8497 'title' => esc_html__( 'Right', 'the-post-grid' ),
8498 'icon' => 'eicon-text-align-right',
8499 ],
8500 ],
8501 'toggle' => true,
8502 'condition' => [
8503 'dots' => 'yes',
8504 ],
8505 'prefix_class' => 'slider-dots-align-',
8506 ]
8507 );
8508
8509 $ref->add_responsive_control(
8510 'dot_wrapper_radius',
8511 [
8512 'label' => esc_html__( 'Dots Wrapper Radius', 'the-post-grid' ),
8513 'type' => Controls_Manager::SLIDER,
8514 'size_units' => [ 'px', '%' ],
8515 'range' => [
8516 'px' => [
8517 'min' => 0,
8518 'max' => 1000,
8519 'step' => 5,
8520 ],
8521 ],
8522 'selectors' => [
8523 '{{WRAPPER}}.slider-dots-style-background .tpg-el-main-wrapper .swiper-pagination' => 'border-radius: {{SIZE}}{{UNIT}};',
8524 ],
8525 'condition' => [
8526 'dots_style' => 'background',
8527 'dots' => 'yes',
8528 ],
8529 ]
8530 );
8531
8532 $ref->add_responsive_control(
8533 'dots_border_radius',
8534 [
8535 'label' => esc_html__( 'Dots Radius', 'the-post-grid' ),
8536 'type' => Controls_Manager::SLIDER,
8537 'size_units' => [ 'px', '%' ],
8538 'range' => [
8539 'px' => [
8540 'min' => 0,
8541 'max' => 100,
8542 'step' => 1,
8543 ],
8544 '%' => [
8545 'min' => 0,
8546 'max' => 100,
8547 'step' => 1,
8548 ],
8549 ],
8550 'selectors' => [
8551 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'border-radius: {{SIZE}}{{UNIT}};',
8552 ],
8553 'condition' => [
8554 'dots' => 'yes',
8555 ],
8556 ]
8557 );
8558
8559 $ref->add_responsive_control(
8560 'dots_width',
8561 [
8562 'label' => esc_html__( 'Dots Width', 'the-post-grid' ),
8563 'type' => Controls_Manager::SLIDER,
8564 'size_units' => [ 'px' ],
8565 'range' => [
8566 'px' => [
8567 'min' => 0,
8568 'max' => 200,
8569 'step' => 1,
8570 ],
8571 ],
8572 'selectors' => [
8573 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}};',
8574 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'width: calc({{SIZE}}{{UNIT}} + 15px);',
8575 ],
8576 'condition' => [
8577 'dots' => 'yes',
8578 ],
8579 ]
8580 );
8581
8582 $ref->add_responsive_control(
8583 'dots_height',
8584 [
8585 'label' => esc_html__( 'Dots Height', 'the-post-grid' ),
8586 'type' => Controls_Manager::SLIDER,
8587 'size_units' => [ 'px' ],
8588 'range' => [
8589 'px' => [
8590 'min' => 0,
8591 'max' => 200,
8592 'step' => 1,
8593 ],
8594 ],
8595 'selectors' => [
8596 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'height: {{SIZE}}{{UNIT}}',
8597 ],
8598 'condition' => [
8599 'dots' => 'yes',
8600 ],
8601 ]
8602 );
8603
8604 $ref->add_responsive_control(
8605 'dots_margin',
8606 [
8607 'label' => esc_html__( 'Dots Margin', 'the-post-grid' ),
8608 'type' => Controls_Manager::SLIDER,
8609 'size_units' => [ 'px' ],
8610 'range' => [
8611 'px' => [
8612 'min' => 0,
8613 'max' => 50,
8614 'step' => 1,
8615 ],
8616 ],
8617 'selectors' => [
8618 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}}',
8619 ],
8620 'condition' => [
8621 'dots' => 'yes',
8622 ],
8623 ]
8624 );
8625
8626 $ref->add_responsive_control(
8627 'dots_position',
8628 [
8629 'label' => esc_html__( 'Dots Y Position', 'the-post-grid' ),
8630 'type' => Controls_Manager::SLIDER,
8631 'size_units' => [ 'px' ],
8632 'range' => [
8633 'px' => [
8634 'min' => - 150,
8635 'max' => 150,
8636 'step' => 1,
8637 ],
8638 ],
8639 'selectors' => [
8640 '{{WRAPPER}} .rt-tpg-container .swiper-pagination' => 'bottom: {{SIZE}}{{UNIT}} !important ;',
8641 ],
8642 'condition' => [
8643 'dots' => 'yes',
8644 ],
8645 ]
8646 );
8647
8648 // Dots Tab Start
8649 $ref->start_controls_tabs(
8650 'dots_style_tabs',
8651 [
8652 'condition' => [
8653 'dots' => 'yes',
8654 ],
8655 ]
8656 );
8657
8658 $ref->start_controls_tab(
8659 'dots_style_normal_tab',
8660 [
8661 'label' => esc_html__( 'Normal', 'the-post-grid' ),
8662 ]
8663 );
8664
8665 $ref->add_control(
8666 'dots_color',
8667 [
8668 'type' => Controls_Manager::COLOR,
8669 'label' => esc_html__( 'Dots Color', 'the-post-grid' ),
8670 'selectors' => [
8671 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet' => 'background-color: {{VALUE}}',
8672 ],
8673 'condition' => [
8674 'dots' => 'yes',
8675 ],
8676 ]
8677 );
8678
8679 $ref->add_control(
8680 'dots_border_color',
8681 [
8682 'type' => Controls_Manager::COLOR,
8683 'label' => esc_html__( 'Active Dots Color', 'the-post-grid' ),
8684 'selectors' => [
8685 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'background-color: {{VALUE}}',
8686 ],
8687 'condition' => [
8688 'dots' => 'yes',
8689 ],
8690 ]
8691 );
8692
8693 $ref->add_control(
8694 'dots_wrap_bg',
8695 [
8696 'type' => Controls_Manager::COLOR,
8697 'label' => esc_html__( 'Dots Wrapper Background', 'the-post-grid' ),
8698 'selectors' => [
8699 '{{WRAPPER}}.slider-dots-style-background .tpg-el-main-wrapper .swiper-pagination' => 'background-color: {{VALUE}}',
8700 ],
8701 'condition' => [
8702 'dots' => 'yes',
8703 'dots_style' => 'background',
8704 ],
8705 ]
8706 );
8707
8708 $ref->end_controls_tab();
8709
8710 $ref->start_controls_tab(
8711 'dots_style_hover_tab',
8712 [
8713 'label' => esc_html__( 'Hover', 'the-post-grid' ),
8714 ]
8715 );
8716
8717 $ref->add_control(
8718 'dots_color_hover',
8719 [
8720 'type' => Controls_Manager::COLOR,
8721 'label' => esc_html__( 'Dots Color - Hover', 'the-post-grid' ),
8722 'selectors' => [
8723 '{{WRAPPER}} .rt-tpg-container .swiper-pagination .swiper-pagination-bullet:hover' => 'background-color: {{VALUE}}',
8724 ],
8725 'condition' => [
8726 'dots' => 'yes',
8727 ],
8728 ]
8729 );
8730
8731 $ref->end_controls_tab();
8732
8733 $ref->end_controls_tabs();
8734
8735 $ref->end_controls_section();
8736 }
8737
8738 /**
8739 * Link Style
8740 *
8741 * @param $ref
8742 */
8743 public static function linkStyle( $ref ) {
8744 $ref->start_controls_section(
8745 'linkStyle',
8746 [
8747 'label' => esc_html__( 'Popup Style', 'the-post-grid' ),
8748 'tab' => Controls_Manager::TAB_STYLE,
8749 'condition' => [
8750 'post_link_type' => [ 'popup', 'multi_popup' ],
8751 ],
8752 ]
8753 );
8754
8755 $ref->add_control(
8756 'popup_head_bg',
8757 [
8758 'label' => esc_html__( 'Header Background', 'the-post-grid' ),
8759 'type' => Controls_Manager::COLOR,
8760 'selectors' => [
8761 'body .rt-popup-wrap .rt-popup-navigation-wrap' => 'background-color: {{VALUE}}',
8762 ],
8763 ]
8764 );
8765
8766 $ref->add_control(
8767 'popup_head_txt_color',
8768 [
8769 'label' => esc_html__( 'Header Text Color', 'the-post-grid' ),
8770 'type' => Controls_Manager::COLOR,
8771 'selectors' => [
8772 'body #rt-popup-wrap .rt-popup-singlePage-counter' => 'color: {{VALUE}}',
8773 ],
8774 ]
8775 );
8776
8777 $ref->add_control(
8778 'popup_title_color',
8779 [
8780 'label' => esc_html__( 'Popup Title Color', 'the-post-grid' ),
8781 'type' => Controls_Manager::COLOR,
8782 'selectors' => [
8783 'body .md-content .rt-md-content-holder > .md-header .entry-title' => 'color: {{VALUE}}',
8784 'body .rt-popup-content .rt-tpg-container h1.entry-title' => 'color: {{VALUE}}',
8785 ],
8786
8787 ]
8788 );
8789
8790 $ref->add_control(
8791 'popup_meta_color',
8792 [
8793 'label' => esc_html__( 'Popup Meta Color', 'the-post-grid' ),
8794 'type' => Controls_Manager::COLOR,
8795 'selectors' => [
8796 'body .md-content .rt-md-content-holder > .md-header .post-meta-user *' => 'color: {{VALUE}}',
8797 'body .rt-popup-content .rt-tpg-container .post-meta-user *' => 'color: {{VALUE}}',
8798 ],
8799
8800 ]
8801 );
8802
8803 $ref->add_control(
8804 'popup_content_color',
8805 [
8806 'label' => esc_html__( 'Popup Content Color', 'the-post-grid' ),
8807 'type' => Controls_Manager::COLOR,
8808 'selectors' => [
8809 'body .md-content .rt-md-content *' => 'color: {{VALUE}}',
8810 'body .rt-popup-content .rt-tpg-container .tpg-content *' => 'color: {{VALUE}}',
8811 ],
8812
8813 ]
8814 );
8815
8816 $ref->add_control(
8817 'popup_bg',
8818 [
8819 'label' => esc_html__( 'Popup Background', 'the-post-grid' ),
8820 'type' => Controls_Manager::COLOR,
8821 'selectors' => [
8822 'body .md-content, body #rt-popup-wrap .rt-popup-content' => 'background-color: {{VALUE}}',
8823 ],
8824
8825 ]
8826 );
8827
8828 $ref->end_controls_section();
8829 }
8830
8831 /**
8832 * Slider thumb Settings for layout- 11, 12
8833 *
8834 * @param $ref
8835 */
8836 public static function slider_thumb_style( $ref ) {
8837 $ref->start_controls_section(
8838 'slider_thumb_style',
8839 [
8840 'label' => esc_html__( 'Slider', 'the-post-grid' ),
8841 'tab' => Controls_Manager::TAB_STYLE,
8842 'condition' => [
8843 'slider_layout' => [ 'slider-layout11', 'slider-layout12' ],
8844 ],
8845 ]
8846 );
8847
8848 // Crative slider style:
8849 $ref->add_control(
8850 'scroll_bar_color',
8851 [
8852 'type' => Controls_Manager::COLOR,
8853 'label' => esc_html__( 'Scroll Foreground Color', 'the-post-grid' ),
8854 'selectors' => [
8855 '{{WRAPPER}} .tpg-el-main-wrapper .swiper-thumb-pagination .swiper-pagination-progressbar-fill' => 'background-color: {{VALUE}}',
8856 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper .post-thumbnail-wrap .p-thumbnail::before' => 'background-color: {{VALUE}}',
8857 ],
8858 ]
8859 );
8860
8861 $ref->add_control(
8862 'scroll_bar_bg_color',
8863 [
8864 'type' => Controls_Manager::COLOR,
8865 'label' => esc_html__( 'Scroll Background Color', 'the-post-grid' ),
8866 'selectors' => [
8867 '{{WRAPPER}} .tpg-el-main-wrapper .slider-thumb-main-wrapper .swiper-pagination-progressbar' => 'background-color: {{VALUE}}',
8868 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper::before' => 'background-color: {{VALUE}};opacity:1;',
8869 ],
8870 ]
8871 );
8872
8873 $ref->add_control(
8874 'thumb_font_color',
8875 [
8876 'type' => Controls_Manager::COLOR,
8877 'label' => esc_html__( 'Thumb Font Color', 'the-post-grid' ),
8878 'selectors' => [
8879 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .p-content *' => 'color: {{VALUE}}',
8880 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .swiper-thumb-wrapper .swiper-wrapper .p-content *' => 'color: {{VALUE}}',
8881 ],
8882 ]
8883 );
8884
8885 $ref->add_control(
8886 'slider_thumb_bg_active',
8887 [
8888 'type' => Controls_Manager::COLOR,
8889 'label' => esc_html__( 'Thumb Active/Hover Background', 'the-post-grid' ),
8890 'selectors' => [
8891 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .swiper-slide:hover .p-thumbnail img' => 'background-color: {{VALUE}}',
8892 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout11 .swiper-thumb-wrapper .swiper-wrapper .swiper-slide-thumb-active .p-thumbnail img' => 'background-color: {{VALUE}}',
8893 '{{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper .swiper-thumb-wrapper .post-thumbnail-wrap .p-thumbnail' => 'background-color: {{VALUE}}',
8894 ],
8895 ]
8896 );
8897
8898 $ref->add_group_control(
8899 \Elementor\Group_Control_Background::get_type(),
8900 [
8901 'name' => 'thumb_wrapper_bg',
8902 'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ),
8903 'fields_options' => [
8904 'background' => [
8905 'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ),
8906 ],
8907 ],
8908 'types' => [ 'classic', 'gradient' ],
8909 'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .slider-thumb-main-wrapper, {{WRAPPER}} .tpg-el-main-wrapper .slider-layout12 .slider-thumb-main-wrapper',
8910 'exclude' => [ 'image' ],
8911 ]
8912 );
8913
8914 $ref->end_controls_section();
8915 }
8916
8917 /**
8918 * Advanced Custom Field ACF Style
8919 *
8920 * @param $ref
8921 */
8922 public static function tpg_acf_style( $ref ) {
8923 $cf = Fns::is_acf();
8924 if ( ! $cf || ! rtTPG()->hasPro() ) {
8925 return;
8926 }
8927
8928 $prefix = $ref->prefix;
8929 $ref->start_controls_section(
8930 'tgp_acf_style',
8931 [
8932 'label' => esc_html__( 'Advanced Custom Field (ACF)', 'the-post-grid' ),
8933 'tab' => Controls_Manager::TAB_STYLE,
8934 'condition' => [
8935 'show_acf' => 'show',
8936 $prefix . '_layout!' => [ 'grid-layout7', 'slider-layout4' ],
8937 ],
8938 ]
8939 );
8940
8941 self::get_tpg_acf_style( $ref );
8942
8943 $ref->end_controls_section();
8944 }
8945
8946 public static function get_tpg_acf_style( $ref, $hover_control = true ) {
8947 $ref->add_group_control(
8948 Group_Control_Typography::get_type(),
8949 [
8950 'name' => 'acf_group_title_typography',
8951 'label' => esc_html__( 'Group Title Typography', 'the-post-grid' ),
8952 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-group-title',
8953 ]
8954 );
8955
8956 $ref->add_group_control(
8957 Group_Control_Typography::get_type(),
8958 [
8959 'name' => 'acf_typography',
8960 'label' => esc_html__( 'ACF Fields Typography', 'the-post-grid' ),
8961 'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-fields',
8962 ]
8963 );
8964
8965 $ref->add_control(
8966 'acf_label_style',
8967 [
8968 'label' => esc_html__( 'Label Style', 'the-post-grid' ),
8969 'type' => Controls_Manager::SELECT,
8970 'default' => 'inline',
8971 'options' => [
8972 'default' => esc_html__( 'Default', 'the-post-grid' ),
8973 'inline' => esc_html__( 'Inline', 'the-post-grid' ),
8974 'block' => esc_html__( 'Block', 'the-post-grid' ),
8975 ],
8976 'condition' => [
8977 'cf_show_only_value' => 'yes',
8978 ],
8979 'render_type' => 'template',
8980 'prefix_class' => 'act-label-style-',
8981 ]
8982 );
8983
8984 $ref->add_responsive_control(
8985 'acf_label_width',
8986 [
8987 'label' => esc_html__( 'Label Min Width', 'the-post-grid' ),
8988 'type' => Controls_Manager::SLIDER,
8989 'size_units' => [ 'px' ],
8990 'range' => [
8991 'px' => [
8992 'min' => 0,
8993 'max' => 500,
8994 'step' => 1,
8995 ],
8996 ],
8997 'condition' => [
8998 'acf_label_style' => 'default',
8999 ],
9000 'selectors' => [
9001 '{{WRAPPER}} .tgp-cf-field-label' => 'min-width: {{SIZE}}{{UNIT}};',
9002 ],
9003 ]
9004 );
9005
9006 $ref->add_responsive_control(
9007 'acf_img_width',
9008 [
9009 'label' => esc_html__( 'Image Width/height', 'the-post-grid' ),
9010 'type' => Controls_Manager::SLIDER,
9011 'size_units' => [ 'px' ],
9012 'range' => [
9013 'px' => [
9014 'min' => 0,
9015 'max' => 1000,
9016 'step' => 1,
9017 ],
9018 ],
9019 'selectors' => [
9020 '{{WRAPPER}} .tgp-cf-field-value img' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};object-fit:cover;',
9021 ],
9022 ]
9023 );
9024 $ref->add_responsive_control(
9025 'acf_img_radius',
9026 [
9027 'label' => esc_html__( 'Image Radius', 'the-post-grid' ),
9028 'type' => Controls_Manager::SLIDER,
9029 'size_units' => [ 'px', '%' ],
9030 'selectors' => [
9031 '{{WRAPPER}} .tgp-cf-field-value img' => 'border-radius: {{SIZE}}{{UNIT}};',
9032 ],
9033 ]
9034 );
9035
9036 $ref->add_control(
9037 'acf_img_margin',
9038 [
9039 'label' => esc_html__( 'Image Spacing', 'the-post-grid' ),
9040 'type' => Controls_Manager::DIMENSIONS,
9041 'size_units' => [ 'px' ],
9042 'selectors' => [ '{{WRAPPER}} .tgp-cf-field-value img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
9043 ]
9044 );
9045
9046 $ref->add_control(
9047 'acf_alignment',
9048 [
9049 'label' => esc_html__( 'Text Align', 'the-post-grid' ),
9050 'type' => Controls_Manager::CHOOSE,
9051 'options' => [
9052 'left' => [
9053 'title' => esc_html__( 'Left', 'the-post-grid' ),
9054 'icon' => 'eicon-text-align-left',
9055 ],
9056 'center' => [
9057 'title' => esc_html__( 'Center', 'the-post-grid' ),
9058 'icon' => 'eicon-text-align-center',
9059 ],
9060 'right' => [
9061 'title' => esc_html__( 'Right', 'the-post-grid' ),
9062 'icon' => 'eicon-text-align-right',
9063 ],
9064 ],
9065 'prefix_class' => 'tpg-acf-align-',
9066 'toggle' => true,
9067 'condition' => [
9068 'grid_layout!' => [ 'grid-layout7', 'slider-layout4' ],
9069 ],
9070
9071 ]
9072 );
9073
9074 if ( $hover_control ) {
9075 // Start Tab
9076 $ref->start_controls_tabs(
9077 'acf_style_tabs'
9078 );
9079
9080 // Normal Tab
9081 $ref->start_controls_tab(
9082 'acf_style_normal_tab',
9083 [
9084 'label' => esc_html__( 'Normal', 'the-post-grid' ),
9085 ]
9086 );
9087 }
9088 $ref->add_control(
9089 'acf_group_title_color',
9090 [
9091 'label' => esc_html__( 'Group Title Color', 'the-post-grid' ),
9092 'type' => Controls_Manager::COLOR,
9093 'selectors' => [
9094 '{{WRAPPER}} .acf-custom-field-wrap .tpg-cf-group-title' => 'color: {{VALUE}}',
9095 ],
9096 'condition' => [
9097 'cf_hide_group_title' => 'yes',
9098 ],
9099 ]
9100 );
9101
9102 $ref->add_control(
9103 'acf_label_color',
9104 [
9105 'label' => esc_html__( 'Label Color', 'the-post-grid' ),
9106 'type' => Controls_Manager::COLOR,
9107 'selectors' => [
9108 '{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-label' => 'color: {{VALUE}}',
9109 ],
9110 'condition' => [
9111 'cf_show_only_value' => 'yes',
9112 ],
9113 ]
9114 );
9115
9116 $ref->add_control(
9117 'acf_value_color',
9118 [
9119 'label' => esc_html__( 'Value Color', 'the-post-grid' ),
9120 'type' => Controls_Manager::COLOR,
9121 'selectors' => [
9122 '{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-value' => 'color: {{VALUE}}',
9123 ],
9124 ]
9125 );
9126
9127 if ( $hover_control ) {
9128 $ref->end_controls_tab();
9129
9130 // Hover Tab
9131 $ref->start_controls_tab(
9132 'acf_style_hover_tab',
9133 [
9134 'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
9135 ]
9136 );
9137
9138 $ref->add_control(
9139 'acf_group_title_color_hover',
9140 [
9141 'label' => esc_html__( 'Group Title Color - Hover', 'the-post-grid' ),
9142 'type' => Controls_Manager::COLOR,
9143 'selectors' => [
9144 '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tpg-cf-group-title' => 'color: {{VALUE}}',
9145 ],
9146 'condition' => [
9147 'cf_hide_group_title' => 'yes',
9148 ],
9149 ]
9150 );
9151
9152 $ref->add_control(
9153 'acf_label_color_hover',
9154 [
9155 'label' => esc_html__( 'Label Color - Hover', 'the-post-grid' ),
9156 'type' => Controls_Manager::COLOR,
9157 'selectors' => [
9158 '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-label' => 'color: {{VALUE}}',
9159 ],
9160 'condition' => [
9161 'cf_show_only_value' => 'yes',
9162 ],
9163 ]
9164 );
9165
9166 $ref->add_control(
9167 'acf_value_color_hover',
9168 [
9169 'label' => esc_html__( 'Value Color - Hover', 'the-post-grid' ),
9170 'type' => Controls_Manager::COLOR,
9171 'selectors' => [
9172 '{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-value' => 'color: {{VALUE}}',
9173 ],
9174 ]
9175 );
9176
9177 $ref->end_controls_tab();
9178
9179 $ref->end_controls_tabs();
9180 // End Tab
9181 }
9182 }
9183
9184 }
9185