PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.1
ShopBuilder – WooCommerce Builder For Elementor v3.2.1
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Helper / PostHelpers.php

PostHelpers.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.1, at app/Elementor/Helper/PostHelpers.php

1,559 lines 56.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace RadiusTheme\SB\Elementor\Helper;
4
5 // Do not allow directly accessing this file.
6 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
7 use RadiusTheme\SB\Elementor\Helper\RenderHelpers;
8 use RadiusTheme\SB\Elementor\Widgets\Controls\StyleFields as StyleFieldsFree;
9 use RadiusTheme\SB\Helpers\Fns;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit( 'This script cannot be accessed directly.' );
13 }
14 class PostHelpers {
15 /**
16 * Query section
17 *
18 * @param object $obj Reference object.
19 *
20 * @return array
21 */
22 public static function query( $obj ) {
23 $fields['query_section'] = $obj->start_section(
24 esc_html__( 'Query', 'shopbuilder' ),
25 'content'
26 );
27
28 $fields['query_note'] = $obj->el_heading( esc_html__( 'Common Filters', 'shopbuilder' ) );
29
30 $fields['include_posts'] = [
31 'type' => 'rt-select2',
32 'label' => esc_html__( 'Include Post', 'shopbuilder' ),
33 'description' => esc_html__( 'Please select the products to show. Leave it blank to include all products.', 'shopbuilder' ),
34 'source_name' => 'post_type',
35 'source_type' => 'post',
36 'multiple' => true,
37 'label_block' => true,
38 ];
39
40 $fields['exclude_posts'] = [
41 'type' => 'rt-select2',
42 'label' => esc_html__( 'Exclude Post', 'shopbuilder' ),
43 'description' => esc_html__( 'Please select the products to show. Leave it blank to exclude none.', 'shopbuilder' ),
44 'source_name' => 'post_type',
45 'source_type' => 'post',
46 'multiple' => true,
47 'label_block' => true,
48 ];
49
50 $fields['posts_limit'] = [
51 'type' => 'number',
52 'label' => esc_html__( 'Posts Limit', 'shopbuilder' ),
53 'description' => esc_html__( 'The number of products to show. Set empty to show all products.', 'shopbuilder' ),
54 'default' => 12,
55 ];
56
57 $fields['posts_offset'] = [
58 'type' => 'number',
59 'label' => esc_html__( 'Posts Offset', 'shopbuilder' ),
60 'description' => esc_html__( 'Number of products to skip.', 'shopbuilder' ),
61 ];
62
63 $fields['category_note'] = $obj->el_heading( esc_html__( 'Taxonomy Filters', 'shopbuilder' ), 'before' );
64
65 $fields['filter_categories'] = [
66 'type' => 'rt-select2',
67 'label' => esc_html__( 'Filter By Categories', 'shopbuilder' ),
68 'description' => esc_html__( 'Select the categories you want to filter, Leave it blank for all categories.', 'shopbuilder' ),
69 'source_name' => 'taxonomy',
70 'source_type' => 'category',
71 'multiple' => true,
72 'label_block' => true,
73 'minimum_input_length' => 1,
74 ];
75
76 $fields['filter_tags'] = [
77 'type' => 'rt-select2',
78 'label' => esc_html__( 'Filter By Tags', 'shopbuilder' ),
79 'description' => esc_html__( 'Select the tags you want to filter, Leave it blank for all tags.', 'shopbuilder' ),
80 'source_name' => 'taxonomy',
81 'source_type' => 'post_tag',
82 'multiple' => true,
83 'label_block' => true,
84 'minimum_input_length' => 1,
85 ];
86
87 $fields['tax_relation'] = [
88 'type' => 'select2',
89 'label' => esc_html__( 'Taxonomy relation', 'shopbuilder' ),
90 'options' => [
91 'OR' => 'Show All Products (OR)',
92 'AND' => 'Show Common Products (AND)',
93 ],
94 'default' => 'AND',
95 'description' => esc_html__( 'Select the taxonomies relationship. It is applicable if you select more than one taxonomy.', 'shopbuilder' ),
96 'label_block' => true,
97 ];
98
99 $fields['sorting_note'] = $obj->el_heading( esc_html__( 'Sorting', 'shopbuilder' ), 'before' );
100
101 $fields['posts_order_by'] = [
102 'type' => 'select2',
103 'label' => esc_html__( 'Order By', 'shopbuilder' ),
104 'options' => ControlHelper::posts_order_by(),
105 'default' => 'date',
106 ];
107
108 $fields['posts_order'] = [
109 'type' => 'select2',
110 'label' => esc_html__( 'Order', 'shopbuilder' ),
111 'options' => ControlHelper::posts_order(),
112 'default' => 'DESC',
113 ];
114
115 $fields['query_section_end'] = $obj->end_section();
116
117 return apply_filters( 'rtsb/elements/elementor/query_control', $fields, $obj );
118 }
119 /**
120 * Pagination section
121 *
122 * @param object $obj Reference object.
123 *
124 * @return array
125 */
126 public static function pagination( $obj ) {
127 $fields['pagination_section'] = $obj->start_section(
128 esc_html__( 'Pagination', 'shopbuilder' ),
129 'content',
130 );
131
132 $fields['show_pagination'] = [
133 'type' => 'switch',
134 'label' => esc_html__( 'Enable Pagination?', 'shopbuilder' ),
135 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
136 'label_on' => esc_html__( 'On', 'shopbuilder' ),
137 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
138 ];
139
140 $fields['pagination_per_page'] = [
141 'type' => 'number',
142 'label' => esc_html__( 'Number of Posts Per Page', 'shopbuilder' ),
143 'default' => 8,
144 'description' => esc_html__( 'Please enter the number of products per page to show.', 'shopbuilder' ),
145 'condition' => [ 'show_pagination' => [ 'yes' ] ],
146 ];
147
148 $fields['pagination_section_end'] = $obj->end_section();
149
150 return apply_filters( 'rtsb/elementor/post_pagination_control', $fields, $obj );
151 }
152 /**
153 * Visibility section
154 *
155 * @param object $obj Reference object.
156 *
157 * @return array
158 */
159 public static function content_visibility( $obj ) {
160 $fields['visibility_section'] = $obj->start_section(
161 esc_html__( 'Content Visibility', 'shopbuilder' ),
162 'settings'
163 );
164 $fields['show_title'] = [
165 'type' => 'switch',
166 'label' => esc_html__( 'Show Post Title?', 'shopbuilder' ),
167 'description' => esc_html__( 'Switch on to show post title.', 'shopbuilder' ),
168 'label_on' => esc_html__( 'On', 'shopbuilder' ),
169 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
170 'default' => 'yes',
171 ];
172 $fields['show_post_thumbnail'] = [
173 'type' => 'switch',
174 'label' => esc_html__( 'Show Post Thumbnail?', 'shopbuilder' ),
175 'description' => esc_html__( 'Switch on to show post thumbnail.', 'shopbuilder' ),
176 'label_on' => esc_html__( 'On', 'shopbuilder' ),
177 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
178 'default' => 'yes',
179 ];
180 $fields['show_short_desc'] = [
181 'type' => 'switch',
182 'label' => esc_html__( 'Show Short Description?', 'shopbuilder' ),
183 'description' => esc_html__( 'Switch on to show post short description.', 'shopbuilder' ),
184 'label_on' => esc_html__( 'On', 'shopbuilder' ),
185 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
186 'default' => 'yes',
187 ];
188
189 $fields['show_categories'] = [
190 'type' => 'switch',
191 'label' => esc_html__( 'Show Post Categories?', 'shopbuilder' ),
192 'description' => esc_html__( 'Switch on to show product categories.', 'shopbuilder' ),
193 'label_on' => esc_html__( 'On', 'shopbuilder' ),
194 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
195 'default' => 'yes',
196 ];
197 $fields['show_tags'] = [
198 'type' => 'switch',
199 'label' => esc_html__( 'Show Post Tags?', 'shopbuilder' ),
200 'description' => esc_html__( 'Switch on to show product categories.', 'shopbuilder' ),
201 'label_on' => esc_html__( 'On', 'shopbuilder' ),
202 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
203 ];
204 $fields['show_dates'] = [
205 'type' => 'switch',
206 'label' => esc_html__( 'Show Post Dates', 'shopbuilder' ),
207 'description' => esc_html__( 'Switch on to show post dates.', 'shopbuilder' ),
208 'label_on' => esc_html__( 'On', 'shopbuilder' ),
209 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
210 'default' => 'yes',
211 ];
212 $fields['show_author'] = [
213 'type' => 'switch',
214 'label' => esc_html__( 'Show Post Author', 'shopbuilder' ),
215 'description' => esc_html__( 'Switch on to show post author.', 'shopbuilder' ),
216 'label_on' => esc_html__( 'On', 'shopbuilder' ),
217 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
218 'default' => 'yes',
219 ];
220 $fields['show_comment'] = [
221 'type' => 'switch',
222 'label' => esc_html__( 'Show Post Comment', 'shopbuilder' ),
223 'description' => esc_html__( 'Switch on to show post comment.', 'shopbuilder' ),
224 'label_on' => esc_html__( 'On', 'shopbuilder' ),
225 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
226 ];
227 $fields['show_reading_time'] = [
228 'type' => 'switch',
229 'label' => esc_html__( 'Show Reading Time', 'shopbuilder' ),
230 'description' => esc_html__( 'Switch on to show post reading time.', 'shopbuilder' ),
231 'label_on' => esc_html__( 'On', 'shopbuilder' ),
232 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
233 ];
234 $fields['show_post_views'] = [
235 'type' => 'switch',
236 'label' => esc_html__( 'Show Post Views', 'shopbuilder' ),
237 'description' => esc_html__( 'Switch on to show post post views.', 'shopbuilder' ),
238 'label_on' => esc_html__( 'On', 'shopbuilder' ),
239 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
240 ];
241 $fields['show_read_more_btn'] = [
242 'type' => 'switch',
243 'label' => esc_html__( 'Show Read More Button', 'shopbuilder' ),
244 'description' => esc_html__( 'Switch on to show post read more button.', 'shopbuilder' ),
245 'label_on' => esc_html__( 'On', 'shopbuilder' ),
246 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
247 'default' => 'yes',
248 ];
249
250 $fields['visibility_section_end'] = $obj->end_section();
251
252 return apply_filters( 'rtsb/elements/elementor/posts_visibility_control', $fields, $obj );
253 }
254 /**
255 * Image section
256 *
257 * @param object $obj Reference object.
258 *
259 * @return array
260 */
261 public static function image( $obj ) {
262 $condition = [
263 'show_post_thumbnail' => 'yes',
264 ];
265 $fields['image_section'] = $obj->start_section(
266 esc_html__( 'Images', 'shopbuilder' ),
267 'settings',
268 [],
269 $condition
270 );
271 $fields['image_hover_effect'] = [
272 'type' => 'select',
273 'label' => esc_html__( 'Image Hover Effect', 'shopbuilder' ),
274 'options' => self::rtsb_post_image_hover_effect(),
275 'default' => 'rtsb-gw-img-zoom-out',
276 'label_block' => true,
277 ];
278 $fields['image_size_note'] = $obj->el_heading(
279 esc_html__( 'Image Size', 'shopbuilder' ),
280 'before',
281 [],
282 [ 'show_post_thumbnail' => [ 'yes' ] ]
283 );
284 $fields['image_size'] = [
285 'type' => 'select2',
286 'label' => esc_html__( 'Select Image Size', 'shopbuilder' ),
287 'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ),
288 'options' => Fns::get_image_sizes(),
289 'default' => 'full',
290 'label_block' => true,
291 'content_classes' => 'elementor-descriptor',
292 ];
293 $fields['img_dimension'] = [
294 'type' => 'image-dimensions',
295 'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ),
296 'label_block' => true,
297 'default' => [
298 'width' => 400,
299 'height' => 400,
300 ],
301 'condition' => [
302 'image_size' => 'rtsb_custom',
303 ],
304 ];
305 $fields['img_crop'] = [
306 'type' => 'select2',
307 'label' => esc_html__( 'Image Crop', 'shopbuilder' ),
308 'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ),
309 'options' => [
310 'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ),
311 'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ),
312 ],
313 'default' => 'hard',
314 'condition' => [
315 'image_size' => 'rtsb_custom',
316 ],
317 ];
318 $fields['img_custom_dimension_note'] = [
319 'type' => 'html',
320 'raw' => sprintf(
321 '<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>',
322 esc_html__( 'Please note that, if you enter image size larger than the actual image itself, the image sizes will fallback to the full image dimension.', 'shopbuilder' )
323 ),
324 'condition' => [
325 'image_size' => 'rtsb_custom',
326 ],
327
328 ];
329 $fields['image_section_end'] = $obj->end_section();
330
331 return $fields;
332 }
333 /**
334 * Button section
335 *
336 * @param object $obj Reference object.
337 *
338 * @return array
339 */
340 public static function readmore_button( $obj ) {
341 $condition = [
342 'show_read_more_btn' => 'yes',
343 ];
344 $fields['button_section'] = $obj->start_section(
345 esc_html__( 'Read More Button', 'shopbuilder' ),
346 'settings',
347 [],
348 $condition
349 );
350 $fields['button_icon'] = [
351 'label' => esc_html__( 'Button Icon', 'shopbuilder' ),
352 'type' => 'icons',
353 'default' => [
354 'value' => 'fas fa-arrow-right',
355 'library' => 'fa-solid',
356 ],
357 ];
358 $fields['button_icon_position'] = [
359 'mode' => 'responsive',
360 'type' => 'choose',
361 'label' => esc_html__( 'Position', 'shopbuilder' ),
362 'options' => [
363 'left' => [
364 'title' => esc_html__( 'Left', 'shopbuilder' ),
365 'icon' => 'eicon-h-align-left',
366 ],
367 'right' => [
368 'title' => esc_html__( 'Right', 'shopbuilder' ),
369 'icon' => 'eicon-h-align-right',
370 ],
371
372 ],
373 'toggle' => true,
374 'default' => 'right',
375 ];
376 $fields['button_text'] = [
377 'label' => esc_html__( 'Button Text', 'shopbuilder' ),
378 'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ),
379 'type' => 'text',
380 'label_block' => true,
381 'default' => __( 'Read More', 'shopbuilder' ),
382 ];
383 $fields['button_section_end'] = $obj->end_section();
384
385 return $fields;
386 }
387 /**
388 * Title section
389 *
390 * @param object $obj Reference object.
391 *
392 * @return array
393 */
394 public static function post_title( $obj ) {
395 $condition = [
396 'show_title' => [ 'yes' ],
397 ];
398
399 $fields['post_title_section'] = $obj->start_section(
400 esc_html__( 'Title', 'shopbuilder' ),
401 'settings',
402 [],
403 $condition
404 );
405
406 $fields['title_tag'] = [
407 'type' => 'select2',
408 'label' => esc_html__( 'Post Title Tag', 'shopbuilder' ),
409 'options' => ControlHelper::heading_tags(),
410 'label_block' => true,
411 'default' => 'h3',
412 'description' => esc_html__( 'Please select the post title tag.', 'shopbuilder' ),
413 ];
414 $fields['title_limit'] = [
415 'type' => 'select2',
416 'label' => esc_html__( 'Post Title Limit', 'shopbuilder' ),
417 'options' => [
418 'default' => esc_html__( 'Default', 'shopbuilder' ),
419 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
420 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
421 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
422 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
423 ],
424 'label_block' => true,
425 'default' => 'default',
426 'description' => esc_html__( 'Please select the post title limit.', 'shopbuilder' ),
427 ];
428
429 $fields['title_limit_custom'] = [
430 'type' => 'number',
431 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
432 'default' => 200,
433 'description' => esc_html__( 'Please enter the post title character limit.', 'shopbuilder' ),
434 'condition' => [ 'title_limit' => [ 'custom' ] ],
435 ];
436
437 $fields['post_title_section_end'] = $obj->end_section();
438
439 return $fields;
440 }
441 /**
442 * Excerpt section
443 *
444 * @param object $obj Reference object.
445 *
446 * @return array
447 */
448 public static function post_excerpt( $obj ) {
449 $condition = [
450 'show_short_desc' => [ 'yes' ],
451 ];
452
453 $fields['post_excerpt_section'] = $obj->start_section(
454 esc_html__( 'Short Description', 'shopbuilder' ),
455 'settings',
456 [],
457 $condition
458 );
459
460 $fields['excerpt_limit'] = [
461 'type' => 'select2',
462 'label' => esc_html__( 'Short Description Limit', 'shopbuilder' ),
463 'description' => esc_html__( 'Please select the post short description limit.', 'shopbuilder' ),
464 'options' => [
465 'default' => esc_html__( 'Default', 'shopbuilder' ),
466 '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ),
467 '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ),
468 '3-lines' => esc_html__( 'Show in 3 lines', 'shopbuilder' ),
469 'custom' => esc_html__( 'Custom', 'shopbuilder' ),
470 ],
471 'label_block' => true,
472 'default' => 'default',
473 ];
474
475 $fields['excerpt_limit_custom'] = [
476 'type' => 'number',
477 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ),
478 'default' => 200,
479 'description' => esc_html__( 'Please enter the post short description character limit.', 'shopbuilder' ),
480 'condition' => [ 'excerpt_limit' => [ 'custom' ] ],
481 ];
482
483 $fields['post_excerpt_section_end'] = $obj->end_section();
484
485 return $fields;
486 }
487 /**
488 * Pagination section
489 *
490 * @param object $obj Reference object.
491 *
492 * @return array
493 */
494 public static function links( $obj ) {
495 $fields['links_section'] = $obj->start_section(
496 esc_html__( 'Links', 'shopbuilder' ),
497 'settings'
498 );
499 $obj->start_section( 'links_section', esc_html__( 'Detail Page', 'shopbuilder' ), 'settings' );
500
501 $fields['title_link'] = [
502 'type' => 'switch',
503 'label' => esc_html__( 'Title Clickable?', 'shopbuilder' ),
504 'description' => esc_html__( 'Switch on to enable title linking.', 'shopbuilder' ),
505 'label_on' => esc_html__( 'On', 'shopbuilder' ),
506 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
507 'default' => 'yes',
508 ];
509
510 $fields['image_link'] = [
511 'type' => 'switch',
512 'label' => esc_html__( 'Image Clickable?', 'shopbuilder' ),
513 'description' => esc_html__( 'Switch on to enable image linking.', 'shopbuilder' ),
514 'label_on' => esc_html__( 'On', 'shopbuilder' ),
515 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
516 'default' => 'yes',
517 ];
518
519 $fields['links_section_end'] = $obj->end_section();
520
521 return $fields;
522 }
523 /**
524 * Pagination Style section
525 *
526 * @param object $obj Reference object.
527 *
528 * @return array
529 */
530 public static function post_pagination_style_settings( $obj ) {
531 $fields = StyleFieldsFree::pagination( $obj );
532 unset( $fields['pagination_buttons_active_color']['condition'] );
533 unset( $fields['pagination_buttons_active_bg_color']['condition'] );
534 unset( $fields['pagination_buttons_spacing']['condition'] );
535 return $fields;
536 }
537 /**
538 * Builds an array with field values.
539 *
540 * @param array $meta Field values.
541 * @param string $template Template name.
542 * @param array $raw_settings Raw settings.
543 *
544 * @return array
545 */
546 public static function post_meta_dataset( array $meta, $template = '', $raw_settings = [] ) {
547 $data = apply_filters(
548 'rtsb/elementor/render/post_meta_dataset',
549 [
550 // Layout.
551 'widget' => 'custom',
552 'template' => RenderHelpers::get_data( $template, '', '' ),
553 'raw_settings' => $raw_settings,
554 'layout' => RenderHelpers::get_data( $meta, 'layout', 'layout1' ),
555 'd_cols' => RenderHelpers::get_data( $meta, 'cols', 0 ),
556 't_cols' => RenderHelpers::get_data( $meta, 'cols_tablet', 2 ),
557 'm_cols' => RenderHelpers::get_data( $meta, 'cols_mobile', 1 ),
558
559 // Query.
560 'post_in' => RenderHelpers::get_data( $meta, 'include_posts', [] ),
561 'post_not_in' => RenderHelpers::get_data( $meta, 'exclude_posts', [] ),
562 'limit' => ( empty( $meta['posts_limit'] ) || '-1' === $meta['posts_limit'] ) ? 10000000 : $meta['posts_limit'],
563 'offset' => RenderHelpers::get_data( $meta, 'posts_offset', 0 ),
564 'order_by' => RenderHelpers::get_data( $meta, 'posts_order_by', 'date' ),
565 'order' => RenderHelpers::get_data( $meta, 'posts_order', 'DESC' ),
566 'categories' => RenderHelpers::get_data( $meta, 'filter_categories', [] ),
567 'tags' => RenderHelpers::get_data( $meta, 'filter_tags', [] ),
568 'relation' => RenderHelpers::get_data( $meta, 'tax_relation', 'OR' ),
569 // Pagination.
570 'pagination' => ! empty( $meta['show_pagination'] ),
571 'posts_per_page' => RenderHelpers::get_data( $meta, 'pagination_per_page', '' ),
572
573 ]
574 );
575 if ( ! empty( $meta['cols_widescreen'] ) ) {
576 $data['w_cols'] = $meta['cols_widescreen'];
577 }
578
579 if ( ! empty( $meta['cols_laptop'] ) ) {
580 $data['l_cols'] = $meta['cols_laptop'];
581 }
582
583 if ( ! empty( $meta['cols_tablet_extra'] ) ) {
584 $data['te_cols'] = $meta['cols_tablet_extra'];
585 }
586
587 if ( ! empty( $meta['cols_mobile_extra'] ) ) {
588 $data['me_cols'] = $meta['cols_mobile_extra'];
589 }
590 return apply_filters( 'rtsb/elementor/render/post_meta_dataset_final', $data, $meta, $raw_settings );
591 }
592 /**
593 * Gets posts arguments.
594 *
595 * @return array posts data.
596 */
597 public static function get_post_arg_dataset( $settings ) {
598 global $post;
599
600 $title_limit_custom = $settings['title_limit_custom'] ?? '';
601 $excerpt_limit_custom = $settings['excerpt_limit_custom'] ?? '200';
602 return [
603 'title' => Fns::text_truncation( get_the_title( $post->ID ), $title_limit_custom ),
604 'excerpt' => Fns::text_truncation( do_shortcode( get_post_field( 'post_content', $post->ID ) ), $excerpt_limit_custom ),
605 'img_html' => self::render_posts_thumbnail( $post->ID, $settings ),
606 ];
607 }
608 /**
609 * Function to generate item class.
610 *
611 * @return string
612 */
613 public static function render_posts_thumbnail( $post_id, $settings ) {
614 $c_image_size = RenderHelpers::get_data( $settings, 'img_dimension', [] );
615 $c_image_size['crop'] = RenderHelpers::get_data( $settings, 'img_dimension', [] );
616 $f_img_size = RenderHelpers::get_data( $settings, 'image_size', 'medium' );
617 $thumbnail_id = get_post_thumbnail_id( $post_id );
618 return $settings['show_post_thumbnail'] ? Fns::get_product_image_html(
619 '',
620 null,
621 $f_img_size,
622 $thumbnail_id,
623 ! empty( $c_image_size ) && is_array( $c_image_size ) ? $c_image_size : [],
624 false
625 ) : null;
626 }
627 /**
628 * Prints HTML with category list information about theme categories.
629 *
630 * @return string
631 */
632 public static function rtsb_posted_taxonomy( $type = 'category' ) {
633 $categories_list = get_the_category_list( self::rtsb_list_item_separator() );
634 if ( 'tag' === $type ) {
635 $categories_list = get_the_tag_list( '', self::rtsb_list_item_separator() );
636 }
637 if ( $categories_list ) {
638 /* translators: %s: CSS class, %s: List of category or tag links. */
639 return sprintf(
640 '<span class="%s-links">%s</span>',
641 $type,
642 $categories_list
643 );
644 }
645
646 return '';
647 }
648 /**
649 * Prints HTML with meta information for the current post-date/time.
650 *
651 * @return string
652 */
653 public static function rtsb_posted_date() {
654 $time_string = sprintf(
655 '<time class="entry-date published updated" datetime="%1$s">%2$s</time>',
656 esc_attr( get_the_date( DATE_W3C ) ),
657 esc_html( get_the_date() )
658 );
659 return sprintf( '<span class="posted-on">%s</span>', $time_string );
660 }
661 /**
662 * Prints HTML with meta information about theme author.
663 *
664 * @return string
665 */
666 public static function rtsb_posted_by( $prefix = '' ) {
667 return sprintf(
668 /* translators: %1$s: Optional prefix (e.g., "Posted by"), %2$s: Author name with a link. */
669 esc_html__( '%1$s %2$s', 'shopbuilder' ),
670 $prefix ? '<span class="prefix">' . $prefix . '</span>' : '',
671 '<span class="byline"><a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" rel="author">' . esc_html( get_the_author() ) . '</a></span>'
672 );
673 }
674
675 public static function get_post_comments_number() {
676 $comments_number = get_comments_number();
677 // translators: %s is for comments number.
678 $comments = sprintf( _n( 'Comment: %s', 'Comments: %s', $comments_number, 'shopbuilder' ), number_format_i18n( $comments_number ) );
679 return $comments;
680 }
681 public static function rtsb_list_item_separator() {
682 $separator = sprintf(
683 /* translators: Used between list items, there is a space after the comma. */
684 "<span class='%s'>%s</span>",
685 'sp',
686 ' '
687 );
688
689 return apply_filters( 'rtsb_post_list_item_separator', $separator );
690 }
691 public static function rtsb_reading_time() {
692 $post_content = get_post()->post_content;
693 $post_content = strip_shortcodes( $post_content );
694 $post_content = wp_strip_all_tags( $post_content );
695 $word_count = str_word_count( $post_content );
696 $reading_time = floor( $word_count / 200 );
697
698 if ( $reading_time < 1 ) {
699 $result = esc_html__( 'Less than a minute', 'shopbuilder' );
700 } elseif ( $reading_time > 60 ) {
701 /* translators: %s is reading time. */
702 $result = sprintf( esc_html__( '%s hours read', 'shopbuilder' ), floor( $reading_time / 60 ) );
703 } elseif ( $reading_time == 1 ) {
704 $result = esc_html__( '1 min read', 'shopbuilder' );
705 } else {
706 $result = sprintf(
707 /* translators: %s is reading time. */
708 esc_html__( '%s mins read', 'shopbuilder' ),
709 $reading_time
710 );
711 }
712
713 return '<span class="meta-reading-time meta-item">' . $result . '</span> ';
714 }
715 public static function rtsb_post_views( $text = '', $post_id = 0 ) {
716
717 if ( empty( $post_id ) ) {
718 $post_id = get_the_ID();
719 }
720
721 $views_class = '';
722 $formated = 0;
723 $count_key = 'rt_post_views';
724 $view_count = get_post_meta( $post_id, $count_key, true );
725 if ( ! empty( $view_count ) ) {
726 $formated = number_format_i18n( $view_count );
727
728 if ( $view_count > 1000 ) {
729 $views_class = 'very-high';
730 } elseif ( $view_count > 100 ) {
731 $views_class = 'high';
732 } elseif ( $view_count > 5 ) {
733 $views_class = 'rising';
734 }
735 } elseif ( $view_count == '' ) {
736 $view_count = 0;
737 } else {
738 $view_count = 0;
739 }
740
741 if ( $view_count == 1 ) {
742 $shopbuilder_view_html = esc_html__( 'View', 'shopbuilder' );
743 } else {
744 $shopbuilder_view_html = esc_html__( 'Views', 'shopbuilder' );
745 }
746
747 $shopbuilder_views_html = '<span class="view-number" >' . $view_count . '</span> ' . $shopbuilder_view_html;
748
749 return '<span class="meta-views meta-item ' . $views_class . '">' . $shopbuilder_views_html . '</span> ';
750 }
751 /**
752 * Content Box style section
753 *
754 * @param object $obj Reference object.
755 *
756 * @return array
757 */
758 public static function post_list_item_style( $obj ) {
759
760 $css_selectors = $obj->selectors['post_list_item_style'];
761 $title = esc_html__( 'Post Item', 'shopbuilder' );
762 $selectors = [
763 'box_shadow' => $css_selectors['box_shadow'],
764 'hover_box_shadow' => $css_selectors['hover_box_shadow'],
765 'border' => $css_selectors['border'],
766 'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ],
767 'content_alignment' => [ $css_selectors['content_alignment'] => 'align-items: {{VALUE}};' ],
768 'content_hr_alignment' => [ $css_selectors['content_hr_alignment'] => 'text-align:{{VALUE}};justify-content: {{VALUE}};' ],
769 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
770 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
771 ];
772
773 $fields = ControlHelper::general_elementor_style( 'post_list_item_style', $title, $obj, [], $selectors );
774
775 unset(
776 $fields['post_list_item_style_typo_note'],
777 $fields['rtsb_el_post_list_item_style_typography'],
778 $fields['post_list_item_style_color'],
779 $fields['post_list_item_style_alignment'],
780 $fields['post_list_item_style_color_tabs'],
781 $fields['post_list_item_style_color_tab'],
782 $fields['post_list_item_style_color_tab_end'],
783 $fields['post_list_item_style_hover_color_tab'],
784 $fields['post_list_item_style_hover_color'],
785 $fields['post_list_item_style_hover_bg_color'],
786 $fields['post_list_item_style_hover_color_tab_end'],
787 $fields['post_list_item_style_color_tabs_end'],
788 $fields['post_list_item_style_border_hover_color'],
789 $fields['post_list_item_style_margin']
790 );
791 $fields['post_list_item_style_border_note']['separator'] = 'default';
792 $fields['post_list_item_style_color_note']['separator'] = 'default';
793 $extra_controls['post_list_item_style_border_radius'] = [
794 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
795 'type' => 'dimensions',
796 'mode' => 'responsive',
797 'size_units' => [ 'px' ],
798 'selectors' => $selectors['border_radius'],
799 ];
800 $fields = Fns::insert_controls( 'post_list_item_style_spacing_note', $fields, $extra_controls );
801
802 $extra_controls2['rtsb_post_list_item_style_box_shadow'] = [
803 'type' => 'box-shadow',
804 'mode' => 'group',
805 'label' => esc_html__( 'Box Shadow', 'shopbuilder' ),
806 'selector' => $selectors['box_shadow'],
807 ];
808 $extra_controls2['rtsb_post_list_item_style_hover_box_shadow'] = [
809 'type' => 'box-shadow',
810 'mode' => 'group',
811 'label' => esc_html__( 'Hover Box Shadow', 'shopbuilder' ),
812 'selector' => $selectors['hover_box_shadow'],
813 'condition' => [
814 'layout_style' => [ 'rtsb-post-grid-layout1','rtsb-post-grid-layout2','rtsb-post-grid-layout3' ],
815 ],
816 ];
817 $fields = Fns::insert_controls( 'post_list_item_style_border_note', $fields, $extra_controls2 );
818 $extra_controls3['content_align_note'] = $obj->el_heading( esc_html__( 'Alignment', 'shopbuilder' ), 'default' );
819 $extra_controls3['content_align_note']['condition'] = [
820 'layout_style!' => [ 'rtsb-post-grid-layout1','rtsb-post-grid-layout2','rtsb-post-grid-layout3' ],
821 ];
822 $extra_controls3['content_alignment_style'] = [
823 'mode' => 'responsive',
824 'type' => 'choose',
825 'label' => esc_html__( 'Vertical Content', 'shopbuilder' ),
826 'options' => [
827 'start' => [
828 'title' => esc_html__( 'Start', 'shopbuilder' ),
829 'icon' => 'eicon-justify-start-v',
830 ],
831 'center' => [
832 'title' => esc_html__( 'Center', 'shopbuilder' ),
833 'icon' => 'eicon-justify-center-v',
834 ],
835 'end' => [
836 'title' => esc_html__( 'End', 'shopbuilder' ),
837 'icon' => 'eicon-justify-end-v',
838 ],
839
840 ],
841 'toggle' => true,
842 'selectors' => $selectors['content_alignment'] ,
843 'default' => 'start',
844 'condition' => [
845 'layout_style!' => [ 'rtsb-post-grid-layout1','rtsb-post-grid-layout2','rtsb-post-grid-layout3' ],
846 ],
847 ];
848 $extra_controls3['content_hr_alignment_style'] = [
849 'mode' => 'responsive',
850 'type' => 'choose',
851 'label' => esc_html__( 'Horizontal Content', 'shopbuilder' ),
852 'options' => [
853 'start' => [
854 'title' => esc_html__( 'Start', 'shopbuilder' ),
855 'icon' => 'eicon-justify-start-h',
856 ],
857 'center' => [
858 'title' => esc_html__( 'Center', 'shopbuilder' ),
859 'icon' => 'eicon-justify-center-h',
860 ],
861 'end' => [
862 'title' => esc_html__( 'End', 'shopbuilder' ),
863 'icon' => 'eicon-justify-end-h',
864 ],
865
866 ],
867 'toggle' => true,
868 'selectors' => $selectors['content_hr_alignment'] ,
869 'default' => 'start',
870 // 'condition' => [
871 // 'layout_style!' => [ 'rtsb-post-grid-layout1','rtsb-post-grid-layout2','rtsb-post-grid-layout3' ],
872 // ],
873 ];
874 $fields = Fns::insert_controls( 'post_list_item_style_color_note', $fields, $extra_controls3 );
875 return $fields;
876 }
877 /**
878 * Title style section
879 *
880 * @param object $obj Reference object.
881 *
882 * @return array
883 */
884 public static function title_style( $obj ) {
885 $condition = [
886 'show_title' => 'yes',
887 ];
888 $css_selectors = $obj->selectors['title_style'];
889 $title = esc_html__( 'Title', 'shopbuilder' );
890 $selectors = [
891 'typography' => $css_selectors['typography'],
892 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
893 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ],
894 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
895 ];
896
897 $fields = ControlHelper::general_elementor_style( 'title_style', $title, $obj, $condition, $selectors );
898 unset(
899 $fields['title_style_alignment'],
900 $fields['rtsb_el_title_style_border'],
901 $fields['title_style_border_note'],
902 $fields['title_style_bg_color'],
903 $fields['title_style_hover_bg_color'],
904 $fields['title_style_border_hover_color'],
905 $fields['title_style_padding'],
906 );
907 return $fields;
908 }
909 /**
910 * Content style section
911 *
912 * @param object $obj Reference object.
913 *
914 * @return array
915 */
916 public static function content_style( $obj ) {
917 $condition = [
918 'show_short_desc' => 'yes',
919 ];
920 $css_selectors = $obj->selectors['content_style'];
921 $title = esc_html__( 'Content', 'shopbuilder' );
922 $selectors = [
923 'typography' => $css_selectors['typography'],
924 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
925 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
926 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
927 ];
928
929 $fields = ControlHelper::general_elementor_style( 'content_style', $title, $obj, $condition, $selectors );
930 $fields['content_style_padding']['label'] = esc_html__( 'Wrapper Padding', 'shopbuilder' );
931 unset(
932 $fields['content_style_alignment'],
933 $fields['rtsb_el_content_style_border'],
934 $fields['content_style_border_note'],
935 $fields['content_style_color_tabs'],
936 $fields['content_style_color_tab'],
937 $fields['content_style_color_tab_end'],
938 $fields['content_style_hover_color_tab'],
939 $fields['content_style_bg_color'],
940 $fields['content_style_hover_color'],
941 $fields['content_style_hover_bg_color'],
942 $fields['content_style_border_hover_color'],
943 $fields['content_style_hover_color_tab_end'],
944 $fields['content_style_color_tabs_end'],
945 );
946 return $fields;
947 }
948
949 /**
950 * Image style section
951 *
952 * @param object $obj Reference object.
953 *
954 * @return array
955 */
956 public static function image_styles( $obj ) {
957 $condition = [
958 'show_post_thumbnail' => 'yes',
959 ];
960 $alignment_options = ControlHelper::alignment();
961 unset( $alignment_options['justify'] );
962 $fields['image_style_sec_start'] = $obj->start_section(
963 esc_html__( 'Image', 'shopbuilder' ),
964 'style',
965 [],
966 $condition
967 );
968 $fields['image_styles_dimension_note'] = $obj->el_heading( esc_html__( 'Dimension', 'shopbuilder' ) );
969 $fields['image_styles_width'] = [
970 'type' => 'slider',
971 'mode' => 'responsive',
972 'label' => esc_html__( 'Image Width', 'shopbuilder' ),
973 'size_units' => [ '%', 'px' ],
974 'range' => [
975 '%' => [
976 'min' => 0,
977 'max' => 100,
978 'step' => 1,
979 ],
980 'px' => [
981 'min' => 0,
982 'max' => 600,
983 'step' => 1,
984 ],
985 ],
986 'selectors' => [
987 $obj->selectors['image_style']['width'] => 'width: {{SIZE}}{{UNIT}};flex: 0 0 {{SIZE}}{{UNIT}};',
988 ],
989 ];
990 $fields['image_styles_max_width'] = [
991 'type' => 'slider',
992 'mode' => 'responsive',
993 'label' => esc_html__( 'Image Max-Width', 'shopbuilder' ),
994 'size_units' => [ '%', 'px' ],
995 'range' => [
996 '%' => [
997 'min' => 0,
998 'max' => 100,
999 'step' => 1,
1000 ],
1001 'px' => [
1002 'min' => 0,
1003 'max' => 600,
1004 'step' => 1,
1005 ],
1006
1007 ],
1008 'selectors' => [
1009 $obj->selectors['image_style']['max_width'] => 'max-width: {{SIZE}}{{UNIT}};',
1010 ],
1011 ];
1012 $fields['image_border_note'] = $obj->el_heading( esc_html__( 'Border', 'shopbuilder' ), 'before' );
1013 $fields['image_border'] = [
1014 'mode' => 'group',
1015 'type' => 'border',
1016 'label' => esc_html__( 'Border', 'shopbuilder' ),
1017 'selector' => $obj->selectors['image_style']['border'],
1018 'fields_options' => [
1019 'color' => [
1020 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
1021 ],
1022 ],
1023 'separator' => 'default',
1024 ];
1025 $fields['image_styles_radius'] = [
1026 'mode' => 'responsive',
1027 'type' => 'dimensions',
1028 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
1029 'size_units' => [ 'px', '%', 'em' ],
1030 'selectors' => [
1031 $obj->selectors['image_style']['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1032 ],
1033 ];
1034 $fields['image_styles_spacing_note'] = $obj->el_heading( esc_html__( 'Spacing', 'shopbuilder' ) );
1035 $fields['image_styles_margin'] = [
1036 'mode' => 'responsive',
1037 'type' => 'dimensions',
1038 'label' => esc_html__( 'Margin', 'shopbuilder' ),
1039 'size_units' => [ 'px', '%', 'em' ],
1040 'selectors' => [
1041 $obj->selectors['image_style']['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1042 ],
1043 ];
1044 $fields['image_sec_end'] = $obj->end_section();
1045
1046 return $fields;
1047 }
1048 /**
1049 * Button style section
1050 *
1051 * @param object $obj Reference object.
1052 *
1053 * @return array
1054 */
1055 public static function button_style( $obj, $type = 'primary' ) {
1056 $condition = [
1057 'show_read_more_btn' => 'yes',
1058 ];
1059 $css_selectors = $obj->selectors['readmore_button_style'];
1060 $title = esc_html__( 'Read More Button', 'shopbuilder' );
1061 $selectors = [
1062 'typography' => $css_selectors['typography'],
1063 'icon_size' => [
1064 $css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}};',
1065 $css_selectors['icon_size']['svg'] => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};',
1066 ],
1067 'icon_gap' => [ $css_selectors['icon_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
1068 'btn_width' => [ $css_selectors['btn_width'] => 'min-width: {{SIZE}}{{UNIT}};' ],
1069 'btn_height' => [ $css_selectors['btn_height'] => 'height: {{SIZE}}{{UNIT}};' ],
1070 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
1071 'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ],
1072 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ],
1073 'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ],
1074 'border' => $css_selectors['border'],
1075 'box_shadow' => $css_selectors['box_shadow'],
1076 'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ],
1077 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1078 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1079 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1080 ];
1081
1082 $fields = ControlHelper::general_elementor_style( 'readmore_button_style', $title, $obj, $condition, $selectors );
1083 unset(
1084 $fields['readmore_button_style_alignment'],
1085 );
1086 $extra_controls['readmore_button_style_border_radius'] = [
1087 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
1088 'type' => 'dimensions',
1089 'mode' => 'responsive',
1090 'size_units' => [ 'px' ],
1091 'selectors' => $selectors['border_radius'],
1092 ];
1093 $fields = Fns::insert_controls( 'readmore_button_style_spacing_note', $fields, $extra_controls );
1094 $extra_controls2['readmore_button_style_btn_width'] = [
1095 'type' => 'slider',
1096 'mode' => 'responsive',
1097 'label' => esc_html__( 'Button Width', 'shopbuilder' ),
1098 'size_units' => [ 'px','%' ],
1099 'range' => [
1100 'px' => [
1101 'min' => 10,
1102 'max' => 1000,
1103 ],
1104 '%' => [
1105 'min' => 0,
1106 'max' => 100,
1107 ],
1108 ],
1109 'selectors' => $selectors['btn_width'],
1110 ];
1111 $extra_controls2['readmore_button_style_btn_height'] = [
1112 'type' => 'slider',
1113 'mode' => 'responsive',
1114 'label' => esc_html__( 'Button Height', 'shopbuilder' ),
1115 'size_units' => [ 'px','%' ],
1116 'range' => [
1117 'px' => [
1118 'min' => 10,
1119 'max' => 1000,
1120 ],
1121 '%' => [
1122 'min' => 0,
1123 'max' => 100,
1124 ],
1125 ],
1126 'selectors' => $selectors['btn_height'],
1127 ];
1128
1129 $extra_controls2['readmore_button_style_icon_size'] = [
1130 'type' => 'slider',
1131 'mode' => 'responsive',
1132 'label' => esc_html__( 'Icon Size', 'shopbuilder' ),
1133 'size_units' => [ 'px' ],
1134 'range' => [
1135 'px' => [
1136 'min' => 0,
1137 'max' => 100,
1138 ],
1139 ],
1140 'selectors' => $selectors['icon_size'],
1141 ];
1142 $extra_controls2['readmore_button_style_icon_gap'] = [
1143 'type' => 'slider',
1144 'mode' => 'responsive',
1145 'label' => esc_html__( 'Icon Gap', 'shopbuilder' ),
1146 'size_units' => [ 'px' ],
1147 'range' => [
1148 'px' => [
1149 'min' => 0,
1150 'max' => 100,
1151 ],
1152 ],
1153 'selectors' => $selectors['icon_gap'],
1154 ];
1155 $extra_controls2['readmore_button_style_box_shadow'] = [
1156 'type' => 'box-shadow',
1157 'mode' => 'group',
1158 'label' => esc_html__( 'Box Shadow', 'shopbuilder' ),
1159 'selector' => $selectors['box_shadow'],
1160 ];
1161 $fields = Fns::insert_controls( 'readmore_button_style_spacing_note', $fields, $extra_controls2, true );
1162
1163 return $fields;
1164 }
1165 /**
1166 * Meta style section
1167 *
1168 * @param object $obj Reference object.
1169 *
1170 * @return array
1171 */
1172 public static function meta_style( $obj ) {
1173 $conditions = [
1174 'relation' => 'or',
1175 'terms' => [
1176 [
1177 'name' => 'show_dates',
1178 'operator' => '==',
1179 'value' => 'yes',
1180 ],
1181 [
1182 'name' => 'show_author',
1183 'operator' => '==',
1184 'value' => 'yes',
1185 ],
1186 [
1187 'name' => 'show_comment',
1188 'operator' => '==',
1189 'value' => 'yes',
1190 ],
1191 [
1192 'name' => 'show_reading_time',
1193 'operator' => '==',
1194 'value' => 'yes',
1195 ],
1196 [
1197 'name' => 'show_post_views',
1198 'operator' => '==',
1199 'value' => 'yes',
1200 ],
1201
1202 ],
1203 ];
1204 $css_selectors = $obj->selectors['post_meta_style'];
1205 $title = esc_html__( 'Meta', 'shopbuilder' );
1206 $selectors = [
1207 'typography' => $css_selectors['typography'],
1208 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
1209 'meta_link_color' => [ $css_selectors['meta_link_color'] => 'color: {{VALUE}};' ],
1210 'meta_separator_color' => [ $css_selectors['meta_separator_color'] => 'color: {{VALUE}};' ],
1211 'meta_icon_color' => [ $css_selectors['meta_icon_color'] => 'color: {{VALUE}};' ],
1212 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ],
1213 'meta_gap' => [ $css_selectors['meta_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
1214 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
1215 ];
1216
1217 $fields = ControlHelper::general_elementor_style( 'post_meta_style', $title, $obj, [], $selectors, $conditions );
1218 $fields['post_meta_style_hover_color']['label'] = esc_html__( 'Link Hover Color', 'shopbuilder' );
1219 unset(
1220 $fields['post_meta_style_alignment'],
1221 $fields['rtsb_el_post_meta_style_border'],
1222 $fields['post_meta_style_border_note'],
1223 $fields['post_meta_style_bg_color'],
1224 $fields['post_meta_style_hover_bg_color'],
1225 $fields['post_meta_style_border_hover_color'],
1226 $fields['post_meta_style_padding'],
1227 );
1228 $extra_controls['post_meta_link_color'] = [
1229 'type' => 'color',
1230 'label' => esc_html__( 'Link Color', 'shopbuilder' ),
1231 'selectors' => $selectors['meta_link_color'],
1232 ];
1233 $extra_controls['post_meta_icon_color'] = [
1234 'type' => 'color',
1235 'label' => esc_html__( 'Icon Color', 'shopbuilder' ),
1236 'selectors' => $selectors['meta_icon_color'],
1237 ];
1238 $extra_controls['post_meta_separator_color'] = [
1239 'type' => 'color',
1240 'label' => esc_html__( 'Separator Color', 'shopbuilder' ),
1241 'selectors' => $selectors['meta_separator_color'],
1242 ];
1243 $fields = Fns::insert_controls( 'post_meta_style_color', $fields, $extra_controls, true );
1244 $extra_controls2['post_meta_gap'] = [
1245 'type' => 'slider',
1246 'mode' => 'responsive',
1247 'label' => esc_html__( 'Meta Gap', 'shopbuilder' ),
1248 'size_units' => [ 'px' ],
1249 'range' => [
1250 'px' => [
1251 'min' => 0,
1252 'max' => 100,
1253 ],
1254 ],
1255 'selectors' => $selectors['meta_gap'],
1256 ];
1257 $fields = Fns::insert_controls( 'post_meta_style_spacing_note', $fields, $extra_controls2, true );
1258 return $fields;
1259 }
1260 /**
1261 * Meta style section
1262 *
1263 * @param object $obj Reference object.
1264 *
1265 * @return array
1266 */
1267 public static function meta_icon_settings( $obj ) {
1268 $conditions = [
1269 'relation' => 'or',
1270 'terms' => [
1271 [
1272 'name' => 'show_dates',
1273 'operator' => '==',
1274 'value' => 'yes',
1275 ],
1276 [
1277 'name' => 'show_author',
1278 'operator' => '==',
1279 'value' => 'yes',
1280 ],
1281 [
1282 'name' => 'show_comment',
1283 'operator' => '==',
1284 'value' => 'yes',
1285 ],
1286 [
1287 'name' => 'show_reading_time',
1288 'operator' => '==',
1289 'value' => 'yes',
1290 ],
1291 [
1292 'name' => 'show_post_views',
1293 'operator' => '==',
1294 'value' => 'yes',
1295 ],
1296
1297 ],
1298 ];
1299 $fields['meta_icon_settings'] = $obj->start_section(
1300 esc_html__( 'Meta', 'shopbuilder' ),
1301 'settings',
1302 $conditions,
1303 );
1304 $fields['meta_separator'] = [
1305 'type' => 'text',
1306 'label' => esc_html__( 'Meta Separator', 'shopbuilder' ),
1307 ];
1308 $fields['author_icon_note'] = $obj->el_heading(
1309 esc_html__( 'Author Icon', 'shopbuilder' ),
1310 'default',
1311 [],
1312 [ 'show_author' => [ 'yes' ] ]
1313 );
1314 $fields['show_author_icon'] = [
1315 'type' => 'switch',
1316 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ),
1317 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
1318 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1319 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1320 'condition' => [
1321 'show_author' => [ 'yes' ],
1322 ],
1323 ];
1324 $fields['author_icon'] = [
1325 'label' => esc_html__( 'Icon', 'shopbuilder' ),
1326 'type' => 'icons',
1327 'default' => [
1328 'value' => 'far fa-user',
1329 'library' => 'fa-solid',
1330 ],
1331 'condition' => [
1332 'show_author' => [ 'yes' ],
1333 'show_author_icon' => [ 'yes' ],
1334 ],
1335 ];
1336 $fields['post_date_icon_note'] = $obj->el_heading(
1337 esc_html__( 'Date Icon', 'shopbuilder' ),
1338 'default',
1339 [],
1340 [ 'show_dates' => [ 'yes' ] ]
1341 );
1342 $fields['show_date_icon'] = [
1343 'type' => 'switch',
1344 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ),
1345 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
1346 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1347 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1348 'default' => 'yes',
1349 'condition' => [
1350 'show_dates' => [ 'yes' ] ,
1351 ],
1352 ];
1353 $fields['date_icon'] = [
1354 'label' => esc_html__( 'Icon', 'shopbuilder' ),
1355 'type' => 'icons',
1356 'default' => [
1357 'value' => 'fas fa-calendar-alt',
1358 'library' => 'fa-solid',
1359 ],
1360 'condition' => [
1361 'show_dates' => [ 'yes' ],
1362 'show_date_icon' => [ 'yes' ],
1363 ],
1364 ];
1365 $fields['post_comment_icon_note'] = $obj->el_heading(
1366 esc_html__( 'Comment Icon', 'shopbuilder' ),
1367 'default',
1368 [],
1369 [ 'show_comment' => [ 'yes' ] ]
1370 );
1371 $fields['show_comment_icon'] = [
1372 'type' => 'switch',
1373 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ),
1374 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
1375 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1376 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1377 'condition' => [
1378 'show_comment' => [ 'yes' ] ,
1379 ],
1380 ];
1381 $fields['comment_icon'] = [
1382 'label' => esc_html__( 'Icon', 'shopbuilder' ),
1383 'type' => 'icons',
1384 'default' => [
1385 'value' => 'far fa-comment',
1386 'library' => 'fa-solid',
1387 ],
1388 'condition' => [
1389 'show_comment' => [ 'yes' ],
1390 'show_comment_icon' => [ 'yes' ],
1391 ],
1392 ];
1393 $fields['post_reading_time_icon_note'] = $obj->el_heading(
1394 esc_html__( 'Reading Time Icon', 'shopbuilder' ),
1395 'default',
1396 [],
1397 [ 'show_reading_time' => [ 'yes' ] ]
1398 );
1399 $fields['show_reading_time_icon'] = [
1400 'type' => 'switch',
1401 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ),
1402 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
1403 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1404 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1405 'condition' => [
1406 'show_reading_time' => [ 'yes' ] ,
1407 ],
1408 ];
1409 $fields['reading_time_icon'] = [
1410 'label' => esc_html__( 'Icon', 'shopbuilder' ),
1411 'type' => 'icons',
1412 'default' => [
1413 'value' => 'far fa-clock',
1414 'library' => 'fa-solid',
1415 ],
1416 'condition' => [
1417 'show_reading_time' => [ 'yes' ],
1418 'show_reading_time_icon' => [ 'yes' ],
1419 ],
1420 ];
1421 $fields['post_views_icon_note'] = $obj->el_heading(
1422 esc_html__( 'Post Views Icon', 'shopbuilder' ),
1423 'default',
1424 [],
1425 [ 'show_post_views' => [ 'yes' ] ]
1426 );
1427 $fields['show_post_views_icon'] = [
1428 'type' => 'switch',
1429 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ),
1430 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ),
1431 'label_on' => esc_html__( 'On', 'shopbuilder' ),
1432 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
1433 'condition' => [
1434 'show_post_views' => [ 'yes' ] ,
1435 ],
1436 ];
1437 $fields['post_views_icon'] = [
1438 'label' => esc_html__( 'Icon', 'shopbuilder' ),
1439 'type' => 'icons',
1440 'default' => [
1441 'value' => 'far fa-eye',
1442 'library' => 'fa-solid',
1443 ],
1444 'condition' => [
1445 'show_post_views' => [ 'yes' ],
1446 'show_post_views_icon' => [ 'yes' ],
1447 ],
1448 ];
1449
1450 $fields['meta_icon_settings_end'] = $obj->end_section();
1451 return $fields;
1452 }
1453 /**
1454 * Taxonomy style section
1455 *
1456 * @param object $obj Reference object.
1457 *
1458 * @return array
1459 */
1460 public static function taxonomy_style( $obj ) {
1461 $conditions = [
1462 'relation' => 'or',
1463 'terms' => [
1464 [
1465 'name' => 'show_categories',
1466 'operator' => '==',
1467 'value' => 'yes',
1468 ],
1469 [
1470 'name' => 'show_tags',
1471 'operator' => '==',
1472 'value' => 'yes',
1473 ],
1474 ],
1475 ];
1476 $css_selectors = $obj->selectors['post_taxonomy_style'];
1477 $title = esc_html__( 'Category/Tag', 'shopbuilder' );
1478 $selectors = [
1479 'typography' => $css_selectors['typography'],
1480 'border' => $css_selectors['border'],
1481 'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ],
1482 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
1483 'bg_color' => [ $css_selectors['bg_color'] => 'background-color: {{VALUE}};' ],
1484 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ],
1485 'hover_bg_color' => [ $css_selectors['hover_bg_color'] => 'background-color: {{VALUE}};' ],
1486 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1487 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
1488 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
1489 'taxonomy_gap' => [ $css_selectors['taxonomy_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
1490
1491 ];
1492
1493 $fields = ControlHelper::general_elementor_style( 'post_taxonomy_style', $title, $obj, [], $selectors, $conditions );
1494
1495 unset(
1496 $fields['post_taxonomy_style_alignment'],
1497 );
1498 $extra_controls['taxonomy_border_radius'] = [
1499 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
1500 'type' => 'dimensions',
1501 'mode' => 'responsive',
1502 'size_units' => [ 'px' ],
1503 'selectors' => $selectors['border_radius'],
1504 ];
1505 $fields = Fns::insert_controls( 'post_taxonomy_style', $fields, $extra_controls );
1506 $extra_controls2['post_taxonomy_gap'] = [
1507 'type' => 'slider',
1508 'mode' => 'responsive',
1509 'label' => esc_html__( 'Meta Gap', 'shopbuilder' ),
1510 'size_units' => [ 'px' ],
1511 'range' => [
1512 'px' => [
1513 'min' => 0,
1514 'max' => 100,
1515 ],
1516 ],
1517 'selectors' => $selectors['taxonomy_gap'],
1518 ];
1519 $fields = Fns::insert_controls( 'post_taxonomy_style_spacing_note', $fields, $extra_controls2, true );
1520 return $fields;
1521 }
1522 public static function rtsb_post_image_hover_effect() {
1523 return apply_filters(
1524 'rtsb/general/widget/post_widget_image_hover_effect',
1525 [
1526 'rtsb-gw-img-effect-none' => __( 'None', 'shopbuilder' ),
1527 'rtsb-gw-img-zoom-in' => __( 'Scale In', 'shopbuilder' ),
1528 'rtsb-gw-img-zoom-out' => __( 'Scale Out', 'shopbuilder' ),
1529 'rtsb-gw-img-slide-up' => __( 'Slide Up', 'shopbuilder' ),
1530 'rtsb-gw-img-slide-down' => __( 'Slide Down', 'shopbuilder' ),
1531 'rtsb-gw-img-slide-right' => __( 'Slide Right', 'shopbuilder' ),
1532 'rtsb-gw-img-slide-left' => __( 'Slide Left', 'shopbuilder' ),
1533 ]
1534 );
1535 }
1536
1537 public static function post_pagination_selectors() {
1538 return [
1539 'typography' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1540 'alignment' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap',
1541 'width' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1542 'height' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1543 'color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1544 'bg_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1545 'active_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span',
1546 'active_bg_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span',
1547 'hover_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a:hover, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button:hover, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button:hover',
1548 'hover_bg_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a:hover, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button:hover, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button:hover',
1549 'border' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1550 'border_hover_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a:hover, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button:hover, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button:hover',
1551 'border_active_color' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span',
1552 'border_radius' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li a, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list li span, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1553 'spacing' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap',
1554 'padding' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap .rtsb-load-more button, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap .rtsb-load-more button',
1555 'margin' => '{{WRAPPER}} .rtsb-elementor-container .rtsb-pagination ul.pagination-list, {{WRAPPER}} .rtsb-elementor-container .rtsb-pagination-wrap, {{WRAPPER}} .rtsb-elementor-container .rtsb-archive-pagination-wrap',
1556 ];
1557 }
1558 }
1559