| @@ -10,13 +10,8 @@ | ||
| 10 | 10 | |
| 11 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | 12 | exit( 'This script cannot be accessed directly.' ); |
| 13 | 13 | } |
| 14 | -/** | |
| 15 | - * Post Helpers class. | |
| 16 | - * | |
| 17 | - * @package RadiusTheme\SB | |
| 18 | - */ | |
| 19 | 14 | class PostHelpers { |
| 20 | 15 | /** |
| 21 | 16 | * Query section |
| 22 | 17 | * |
| @@ -183,10 +178,10 @@ | ||
| 183 | 178 | 'default' => 'yes', |
| 184 | 179 | ]; |
| 185 | 180 | $fields['show_short_desc'] = [ |
| 186 | 181 | 'type' => 'switch', |
| 187 | - 'label' => esc_html__( 'Show Excerpt?', 'shopbuilder' ), | |
| 188 | - 'description' => esc_html__( 'Switch on to show post excerpt.', 'shopbuilder' ), | |
| 182 | + 'label' => esc_html__( 'Show Short Description?', 'shopbuilder' ), | |
| 183 | + 'description' => esc_html__( 'Switch on to show post short description.', 'shopbuilder' ), | |
| 189 | 184 | 'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 190 | 185 | 'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 191 | 186 | 'default' => 'yes', |
| 192 | 187 | ]; |
| @@ -221,29 +216,8 @@ | ||
| 221 | 216 | 'label_on' => esc_html__( 'On', 'shopbuilder' ), |
| 222 | 217 | 'label_off' => esc_html__( 'Off', 'shopbuilder' ), |
| 223 | 218 | 'default' => 'yes', |
| 224 | 219 | ]; |
| 225 | - $fields['show_comment'] = [ | |
| 226 | - 'type' => 'switch', | |
| 227 | - 'label' => esc_html__( 'Show Post Comment', 'shopbuilder' ), | |
| 228 | - 'description' => esc_html__( 'Switch on to show post comment.', 'shopbuilder' ), | |
| 229 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 230 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 231 | - ]; | |
| 232 | - $fields['show_reading_time'] = [ | |
| 233 | - 'type' => 'switch', | |
| 234 | - 'label' => esc_html__( 'Show Reading Time', 'shopbuilder' ), | |
| 235 | - 'description' => esc_html__( 'Switch on to show post reading time.', 'shopbuilder' ), | |
| 236 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 237 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 238 | - ]; | |
| 239 | - $fields['show_post_views'] = [ | |
| 240 | - 'type' => 'switch', | |
| 241 | - 'label' => esc_html__( 'Show Post Views', 'shopbuilder' ), | |
| 242 | - 'description' => esc_html__( 'Switch on to show post post views.', 'shopbuilder' ), | |
| 243 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 244 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 245 | - ]; | |
| 246 | 220 | $fields['show_read_more_btn'] = [ |
| 247 | 221 | 'type' => 'switch', |
| 248 | 222 | 'label' => esc_html__( 'Show Read More Button', 'shopbuilder' ), |
| 249 | 223 | 'description' => esc_html__( 'Switch on to show post read more button.', 'shopbuilder' ), |
| @@ -455,9 +429,9 @@ | ||
| 455 | 429 | 'show_short_desc' => [ 'yes' ], |
| 456 | 430 | ]; |
| 457 | 431 | |
| 458 | 432 | $fields['post_excerpt_section'] = $obj->start_section( |
| 459 | - esc_html__( 'Excerpt', 'shopbuilder' ), | |
| 433 | + esc_html__( 'Short Description', 'shopbuilder' ), | |
| 460 | 434 | 'settings', |
| 461 | 435 | [], |
| 462 | 436 | $condition |
| 463 | 437 | ); |
| @@ -463,10 +437,10 @@ | ||
| 463 | 437 | ); |
| 464 | 438 | |
| 465 | 439 | $fields['excerpt_limit'] = [ |
| 466 | 440 | 'type' => 'select2', |
| 467 | - 'label' => esc_html__( 'Excerpt Limit', 'shopbuilder' ), | |
| 468 | - 'description' => esc_html__( 'Please select the post excerpt limit.', 'shopbuilder' ), | |
| 441 | + 'label' => esc_html__( 'Short Description Limit', 'shopbuilder' ), | |
| 442 | + 'description' => esc_html__( 'Please select the post short description limit.', 'shopbuilder' ), | |
| 469 | 443 | 'options' => [ |
| 470 | 444 | 'default' => esc_html__( 'Default', 'shopbuilder' ), |
| 471 | 445 | '1-line' => esc_html__( 'Show in 1 line', 'shopbuilder' ), |
| 472 | 446 | '2-lines' => esc_html__( 'Show in 2 lines', 'shopbuilder' ), |
| @@ -480,9 +454,9 @@ | ||
| 480 | 454 | $fields['excerpt_limit_custom'] = [ |
| 481 | 455 | 'type' => 'number', |
| 482 | 456 | 'label' => esc_html__( 'Custom Character Limit', 'shopbuilder' ), |
| 483 | 457 | 'default' => 200, |
| 484 | - 'description' => esc_html__( 'Please enter the post excerpt character limit.', 'shopbuilder' ), | |
| 458 | + 'description' => esc_html__( 'Please enter the post short description character limit.', 'shopbuilder' ), | |
| 485 | 459 | 'condition' => [ 'excerpt_limit' => [ 'custom' ] ], |
| 486 | 460 | ]; |
| 487 | 461 | |
| 488 | 462 | $fields['post_excerpt_section_end'] = $obj->end_section(); |
| @@ -594,13 +568,11 @@ | ||
| 594 | 568 | } |
| 595 | 569 | return apply_filters( 'rtsb/elementor/render/post_meta_dataset_final', $data, $meta, $raw_settings ); |
| 596 | 570 | } |
| 597 | 571 | /** |
| 598 | - * Function to get post arg dataset. | |
| 572 | + * Gets posts arguments. | |
| 599 | 573 | * |
| 600 | - * @param array $settings Settings array. | |
| 601 | - * | |
| 602 | - * @return array | |
| 574 | + * @return array posts data. | |
| 603 | 575 | */ |
| 604 | 576 | public static function get_post_arg_dataset( $settings ) { |
| 605 | 577 | global $post; |
| 606 | 578 | |
| @@ -605,20 +577,18 @@ | ||
| 605 | 577 | global $post; |
| 606 | 578 | |
| 607 | 579 | $title_limit_custom = $settings['title_limit_custom'] ?? ''; |
| 608 | 580 | $excerpt_limit_custom = $settings['excerpt_limit_custom'] ?? '200'; |
| 581 | + | |
| 609 | 582 | return [ |
| 610 | 583 | 'title' => Fns::text_truncation( get_the_title( $post->ID ), $title_limit_custom ), |
| 611 | - 'excerpt' => Fns::text_truncation( do_shortcode( get_post_field( 'post_excerpt', $post->ID ) ), $excerpt_limit_custom ), | |
| 584 | + 'excerpt' => Fns::text_truncation( do_shortcode( get_post_field( 'post_content', $post->ID ) ), $excerpt_limit_custom ), | |
| 612 | 585 | 'img_html' => self::render_posts_thumbnail( $post->ID, $settings ), |
| 613 | 586 | ]; |
| 614 | 587 | } |
| 615 | 588 | /** |
| 616 | - * Get post thumbnail HTML | |
| 589 | + * Function to generate item class. | |
| 617 | 590 | * |
| 618 | - * @param int $post_id Post ID. | |
| 619 | - * @param array $settings Settings array. | |
| 620 | - * | |
| 621 | 591 | * @return string |
| 622 | 592 | */ |
| 623 | 593 | public static function render_posts_thumbnail( $post_id, $settings ) { |
| 624 | 594 | $c_image_size = RenderHelpers::get_data( $settings, 'img_dimension', [] ); |
| @@ -634,16 +604,11 @@ | ||
| 634 | 604 | false |
| 635 | 605 | ) : null; |
| 636 | 606 | } |
| 637 | 607 | /** |
| 638 | - * Generate the formatted HTML list of categories or tags for the current post. | |
| 608 | + * Prints HTML with category list information about theme categories. | |
| 639 | 609 | * |
| 640 | - * Retrieves either post categories or tags based on the provided type and | |
| 641 | - * returns them wrapped in a span element with a corresponding CSS class. | |
| 642 | - * | |
| 643 | - * @param string $type The taxonomy type to display. Accepts 'category' or 'tag'. Default 'category'. | |
| 644 | - * | |
| 645 | - * @return string HTML markup with the taxonomy list, or an empty string if none found. | |
| 610 | + * @return string | |
| 646 | 611 | */ |
| 647 | 612 | public static function rtsb_posted_taxonomy( $type = 'category' ) { |
| 648 | 613 | $categories_list = get_the_category_list( self::rtsb_list_item_separator() ); |
| 649 | 614 | if ( 'tag' === $type ) { |
| @@ -673,17 +638,11 @@ | ||
| 673 | 638 | ); |
| 674 | 639 | return sprintf( '<span class="posted-on">%s</span>', $time_string ); |
| 675 | 640 | } |
| 676 | 641 | /** |
| 677 | - * Generate formatted HTML for the post author section. | |
| 642 | + * Prints HTML with meta information about theme author. | |
| 678 | 643 | * |
| 679 | - * Outputs the author name (linked to their posts archive) optionally | |
| 680 | - * prefixed by a custom label (e.g., "Posted by"). Both the prefix and | |
| 681 | - * author name are wrapped in appropriate markup for styling. | |
| 682 | - * | |
| 683 | - * @param string $prefix Optional text to display before the author name. Default empty. | |
| 684 | - * | |
| 685 | - * @return string HTML markup containing the author information. | |
| 644 | + * @return string | |
| 686 | 645 | */ |
| 687 | 646 | public static function rtsb_posted_by( $prefix = '' ) { |
| 688 | 647 | return sprintf( |
| 689 | 648 | /* translators: %1$s: Optional prefix (e.g., "Posted by"), %2$s: Author name with a link. */ |
| @@ -691,32 +650,8 @@ | ||
| 691 | 650 | $prefix ? '<span class="prefix">' . $prefix . '</span>' : '', |
| 692 | 651 | '<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>' |
| 693 | 652 | ); |
| 694 | 653 | } |
| 695 | - /** | |
| 696 | - * Retrieve the formatted comments count text for the current post. | |
| 697 | - * | |
| 698 | - * Returns a translated string showing the number of comments, | |
| 699 | - * automatically handling singular/plural forms. | |
| 700 | - * | |
| 701 | - * Example: "Comment: 1" or "Comments: 5". | |
| 702 | - * | |
| 703 | - * @return string Formatted comments count text. | |
| 704 | - */ | |
| 705 | - public static function get_post_comments_number() { | |
| 706 | - $comments_number = get_comments_number(); | |
| 707 | - // translators: %s is for comments number. | |
| 708 | - $comments = sprintf( _n( 'Comment: %s', 'Comments: %s', $comments_number, 'shopbuilder' ), number_format_i18n( $comments_number ) ); | |
| 709 | - return $comments; | |
| 710 | - } | |
| 711 | - /** | |
| 712 | - * Get the separator used between post taxonomy list items. | |
| 713 | - * | |
| 714 | - * Returns an HTML span element used as a separator between categories or tags. | |
| 715 | - * The output can be customized using the `rtsb_post_list_item_separator` filter. | |
| 716 | - * | |
| 717 | - * @return string HTML separator markup. | |
| 718 | - */ | |
| 719 | 654 | public static function rtsb_list_item_separator() { |
| 720 | 655 | $separator = sprintf( |
| 721 | 656 | /* translators: Used between list items, there is a space after the comma. */ |
| 722 | 657 | "<span class='%s'>%s</span>", |
| @@ -726,97 +661,8 @@ | ||
| 726 | 661 | |
| 727 | 662 | return apply_filters( 'rtsb_post_list_item_separator', $separator ); |
| 728 | 663 | } |
| 729 | 664 | /** |
| 730 | - * Calculate and display the estimated reading time for the current post. | |
| 731 | - * | |
| 732 | - * Counts the words in the post content (after removing shortcodes and HTML tags) | |
| 733 | - * and estimates reading time based on 200 words per minute. Outputs a formatted | |
| 734 | - * HTML span with the reading duration (e.g., "1 min read", "5 mins read", | |
| 735 | - * "Less than a minute", or "2 hours read"). | |
| 736 | - * | |
| 737 | - * @return string HTML-wrapped reading time text. | |
| 738 | - */ | |
| 739 | - public static function rtsb_reading_time() { | |
| 740 | - $post_content = get_post()->post_content; | |
| 741 | - $post_content = strip_shortcodes( $post_content ); | |
| 742 | - $post_content = wp_strip_all_tags( $post_content ); | |
| 743 | - $word_count = str_word_count( $post_content ); | |
| 744 | - $reading_time = floor( $word_count / 200 ); | |
| 745 | - | |
| 746 | - if ( $reading_time < 1 ) { | |
| 747 | - $result = esc_html__( 'Less than a minute', 'shopbuilder' ); | |
| 748 | - } elseif ( $reading_time > 60 ) { | |
| 749 | - /* translators: %s is reading time. */ | |
| 750 | - $result = sprintf( esc_html__( '%s hours read', 'shopbuilder' ), floor( $reading_time / 60 ) ); | |
| 751 | - } elseif ( 1 == $reading_time ) { | |
| 752 | - $result = esc_html__( '1 min read', 'shopbuilder' ); | |
| 753 | - } else { | |
| 754 | - $result = sprintf( | |
| 755 | - /* translators: %s is reading time. */ | |
| 756 | - esc_html__( '%s mins read', 'shopbuilder' ), | |
| 757 | - $reading_time | |
| 758 | - ); | |
| 759 | - } | |
| 760 | - | |
| 761 | - return '<span class="meta-reading-time meta-item">' . $result . '</span> '; | |
| 762 | - } | |
| 763 | - /** | |
| 764 | - * Display formatted post view count with CSS status classes. | |
| 765 | - * | |
| 766 | - * Retrieves the post view count stored in the `rt_post_views` meta key, | |
| 767 | - * formats the number for display, and assigns a visual status class based | |
| 768 | - * on popularity (e.g., "rising", "high", "very-high"). | |
| 769 | - * | |
| 770 | - * Outputs an HTML span containing the view number and label | |
| 771 | - * ("View" or "Views") along with an optional CSS class. | |
| 772 | - * | |
| 773 | - * - very-high: more than 1000 views | |
| 774 | - * - high: more than 100 views | |
| 775 | - * - rising: more than 5 views | |
| 776 | - * | |
| 777 | - * @param string $text Optional custom text (currently unused). | |
| 778 | - * @param int $post_id Optional post ID. Defaults to current post. | |
| 779 | - * | |
| 780 | - * @return string HTML markup for the post view count. | |
| 781 | - */ | |
| 782 | - public static function rtsb_post_views( $text = '', $post_id = 0 ) { | |
| 783 | - | |
| 784 | - if ( empty( $post_id ) ) { | |
| 785 | - $post_id = get_the_ID(); | |
| 786 | - } | |
| 787 | - | |
| 788 | - $views_class = ''; | |
| 789 | - $formated = 0; | |
| 790 | - $count_key = 'rt_post_views'; | |
| 791 | - $view_count = get_post_meta( $post_id, $count_key, true ); | |
| 792 | - if ( ! empty( $view_count ) ) { | |
| 793 | - $formated = number_format_i18n( $view_count ); | |
| 794 | - | |
| 795 | - if ( $view_count > 1000 ) { | |
| 796 | - $views_class = 'very-high'; | |
| 797 | - } elseif ( $view_count > 100 ) { | |
| 798 | - $views_class = 'high'; | |
| 799 | - } elseif ( $view_count > 5 ) { | |
| 800 | - $views_class = 'rising'; | |
| 801 | - } | |
| 802 | - } elseif ( '' == $view_count ) { | |
| 803 | - $view_count = 0; | |
| 804 | - } else { | |
| 805 | - $view_count = 0; | |
| 806 | - } | |
| 807 | - | |
| 808 | - if ( 1 == $view_count ) { | |
| 809 | - $shopbuilder_view_html = esc_html__( 'View', 'shopbuilder' ); | |
| 810 | - } else { | |
| 811 | - $shopbuilder_view_html = esc_html__( 'Views', 'shopbuilder' ); | |
| 812 | - } | |
| 813 | - | |
| 814 | - $shopbuilder_views_html = '<span class="view-number" >' . $view_count . '</span> ' . $shopbuilder_view_html; | |
| 815 | - | |
| 816 | - return '<span class="meta-views meta-item ' . $views_class . '">' . $shopbuilder_views_html . '</span> '; | |
| 817 | - } | |
| 818 | - /** | |
| 819 | 665 | * Content Box style section |
| 820 | 666 | * |
| 821 | 667 | * @param object $obj Reference object. |
| 822 | 668 | * |
| @@ -933,8 +779,11 @@ | ||
| 933 | 779 | ], |
| 934 | 780 | 'toggle' => true, |
| 935 | 781 | 'selectors' => $selectors['content_hr_alignment'] , |
| 936 | 782 | 'default' => 'start', |
| 783 | + // 'condition' => [ | |
| 784 | + // 'layout_style!' => [ 'rtsb-post-grid-layout1','rtsb-post-grid-layout2','rtsb-post-grid-layout3' ], | |
| 785 | + // ], | |
| 937 | 786 | ]; |
| 938 | 787 | $fields = Fns::insert_controls( 'post_list_item_style_color_note', $fields, $extra_controls3 ); |
| 939 | 788 | return $fields; |
| 940 | 789 | } |
| @@ -1115,9 +964,9 @@ | ||
| 1115 | 964 | * @param object $obj Reference object. |
| 1116 | 965 | * |
| 1117 | 966 | * @return array |
| 1118 | 967 | */ |
| 1119 | - public static function button_style( $obj ) { | |
| 968 | + public static function button_style( $obj, $type = 'primary' ) { | |
| 1120 | 969 | $condition = [ |
| 1121 | 970 | 'show_read_more_btn' => 'yes', |
| 1122 | 971 | ]; |
| 1123 | 972 | $css_selectors = $obj->selectors['readmore_button_style']; |
| @@ -1143,18 +992,8 @@ | ||
| 1143 | 992 | 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ], |
| 1144 | 993 | ]; |
| 1145 | 994 | |
| 1146 | 995 | $fields = ControlHelper::general_elementor_style( 'readmore_button_style', $title, $obj, $condition, $selectors ); |
| 1147 | - | |
| 1148 | - // Redirect the text-decoration sub-field to `.text-wrap` (an unshielded span that wraps the label); the shield-blocked `<a>` can't reach text inside its inline-flex child. | |
| 1149 | - $fields['rtsb_el_readmore_button_style_typography']['fields_options'] = [ | |
| 1150 | - 'text_decoration' => [ | |
| 1151 | - 'selectors' => [ | |
| 1152 | - $css_selectors['text_decoration'] => 'text-decoration: {{VALUE}};', | |
| 1153 | - ], | |
| 1154 | - ], | |
| 1155 | - ]; | |
| 1156 | - | |
| 1157 | 996 | unset( |
| 1158 | 997 | $fields['readmore_button_style_alignment'], |
| 1159 | 998 | ); |
| 1160 | 999 | $extra_controls['readmore_button_style_border_radius'] = [ |
| @@ -1243,9 +1082,9 @@ | ||
| 1243 | 1082 | * |
| 1244 | 1083 | * @return array |
| 1245 | 1084 | */ |
| 1246 | 1085 | public static function meta_style( $obj ) { |
| 1247 | - $conditions = [ | |
| 1086 | + $conditions = [ | |
| 1248 | 1087 | 'relation' => 'or', |
| 1249 | 1088 | 'terms' => [ |
| 1250 | 1089 | [ |
| 1251 | 1090 | 'name' => 'show_dates', |
| @@ -1256,37 +1095,20 @@ | ||
| 1256 | 1095 | 'name' => 'show_author', |
| 1257 | 1096 | 'operator' => '==', |
| 1258 | 1097 | 'value' => 'yes', |
| 1259 | 1098 | ], |
| 1260 | - [ | |
| 1261 | - 'name' => 'show_comment', | |
| 1262 | - 'operator' => '==', | |
| 1263 | - 'value' => 'yes', | |
| 1264 | - ], | |
| 1265 | - [ | |
| 1266 | - 'name' => 'show_reading_time', | |
| 1267 | - 'operator' => '==', | |
| 1268 | - 'value' => 'yes', | |
| 1269 | - ], | |
| 1270 | - [ | |
| 1271 | - 'name' => 'show_post_views', | |
| 1272 | - 'operator' => '==', | |
| 1273 | - 'value' => 'yes', | |
| 1274 | - ], | |
| 1275 | - | |
| 1276 | 1099 | ], |
| 1277 | 1100 | ]; |
| 1278 | 1101 | $css_selectors = $obj->selectors['post_meta_style']; |
| 1279 | 1102 | $title = esc_html__( 'Meta', 'shopbuilder' ); |
| 1280 | 1103 | $selectors = [ |
| 1281 | - 'typography' => $css_selectors['typography'], | |
| 1282 | - 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], | |
| 1283 | - 'meta_link_color' => [ $css_selectors['meta_link_color'] => 'color: {{VALUE}};' ], | |
| 1284 | - 'meta_separator_color' => [ $css_selectors['meta_separator_color'] => 'color: {{VALUE}};' ], | |
| 1285 | - 'meta_icon_color' => [ $css_selectors['meta_icon_color'] => 'color: {{VALUE}};' ], | |
| 1286 | - 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], | |
| 1287 | - 'meta_gap' => [ $css_selectors['meta_gap'] => 'gap: {{SIZE}}{{UNIT}};' ], | |
| 1288 | - 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ], | |
| 1104 | + 'typography' => $css_selectors['typography'], | |
| 1105 | + 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ], | |
| 1106 | + 'meta_link_color' => [ $css_selectors['meta_link_color'] => 'color: {{VALUE}};' ], | |
| 1107 | + 'meta_icon_color' => [ $css_selectors['meta_icon_color'] => 'fill: {{VALUE}};' ], | |
| 1108 | + 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ], | |
| 1109 | + 'meta_gap' => [ $css_selectors['meta_gap'] => 'gap: {{SIZE}}{{UNIT}};' ], | |
| 1110 | + 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ], | |
| 1289 | 1111 | ]; |
| 1290 | 1112 | |
| 1291 | 1113 | $fields = ControlHelper::general_elementor_style( 'post_meta_style', $title, $obj, [], $selectors, $conditions ); |
| 1292 | 1114 | $fields['post_meta_style_hover_color']['label'] = esc_html__( 'Link Hover Color', 'shopbuilder' ); |
| @@ -1298,25 +1120,20 @@ | ||
| 1298 | 1120 | $fields['post_meta_style_hover_bg_color'], |
| 1299 | 1121 | $fields['post_meta_style_border_hover_color'], |
| 1300 | 1122 | $fields['post_meta_style_padding'], |
| 1301 | 1123 | ); |
| 1302 | - $extra_controls['post_meta_link_color'] = [ | |
| 1124 | + $extra_controls['post_meta_link_color'] = [ | |
| 1303 | 1125 | 'type' => 'color', |
| 1304 | 1126 | 'label' => esc_html__( 'Link Color', 'shopbuilder' ), |
| 1305 | 1127 | 'selectors' => $selectors['meta_link_color'], |
| 1306 | 1128 | ]; |
| 1307 | - $extra_controls['post_meta_icon_color'] = [ | |
| 1129 | + $extra_controls['post_meta_icon_color'] = [ | |
| 1308 | 1130 | 'type' => 'color', |
| 1309 | 1131 | 'label' => esc_html__( 'Icon Color', 'shopbuilder' ), |
| 1310 | 1132 | 'selectors' => $selectors['meta_icon_color'], |
| 1311 | 1133 | ]; |
| 1312 | - $extra_controls['post_meta_separator_color'] = [ | |
| 1313 | - 'type' => 'color', | |
| 1314 | - 'label' => esc_html__( 'Separator Color', 'shopbuilder' ), | |
| 1315 | - 'selectors' => $selectors['meta_separator_color'], | |
| 1316 | - ]; | |
| 1317 | - $fields = Fns::insert_controls( 'post_meta_style_color', $fields, $extra_controls, true ); | |
| 1318 | - $extra_controls2['post_meta_gap'] = [ | |
| 1134 | + $fields = Fns::insert_controls( 'post_meta_style_color', $fields, $extra_controls, true ); | |
| 1135 | + $extra_controls2['post_meta_gap'] = [ | |
| 1319 | 1136 | 'type' => 'slider', |
| 1320 | 1137 | 'mode' => 'responsive', |
| 1321 | 1138 | 'label' => esc_html__( 'Meta Gap', 'shopbuilder' ), |
| 1322 | 1139 | 'size_units' => [ 'px' ], |
| @@ -1327,205 +1144,12 @@ | ||
| 1327 | 1144 | ], |
| 1328 | 1145 | ], |
| 1329 | 1146 | 'selectors' => $selectors['meta_gap'], |
| 1330 | 1147 | ]; |
| 1331 | - $fields = Fns::insert_controls( 'post_meta_style_spacing_note', $fields, $extra_controls2, true ); | |
| 1148 | + $fields = Fns::insert_controls( 'post_meta_style_spacing_note', $fields, $extra_controls2, true ); | |
| 1332 | 1149 | return $fields; |
| 1333 | 1150 | } |
| 1334 | 1151 | /** |
| 1335 | - * Meta style section | |
| 1336 | - * | |
| 1337 | - * @param object $obj Reference object. | |
| 1338 | - * | |
| 1339 | - * @return array | |
| 1340 | - */ | |
| 1341 | - public static function meta_icon_settings( $obj ) { | |
| 1342 | - $conditions = [ | |
| 1343 | - 'relation' => 'or', | |
| 1344 | - 'terms' => [ | |
| 1345 | - [ | |
| 1346 | - 'name' => 'show_dates', | |
| 1347 | - 'operator' => '==', | |
| 1348 | - 'value' => 'yes', | |
| 1349 | - ], | |
| 1350 | - [ | |
| 1351 | - 'name' => 'show_author', | |
| 1352 | - 'operator' => '==', | |
| 1353 | - 'value' => 'yes', | |
| 1354 | - ], | |
| 1355 | - [ | |
| 1356 | - 'name' => 'show_comment', | |
| 1357 | - 'operator' => '==', | |
| 1358 | - 'value' => 'yes', | |
| 1359 | - ], | |
| 1360 | - [ | |
| 1361 | - 'name' => 'show_reading_time', | |
| 1362 | - 'operator' => '==', | |
| 1363 | - 'value' => 'yes', | |
| 1364 | - ], | |
| 1365 | - [ | |
| 1366 | - 'name' => 'show_post_views', | |
| 1367 | - 'operator' => '==', | |
| 1368 | - 'value' => 'yes', | |
| 1369 | - ], | |
| 1370 | - | |
| 1371 | - ], | |
| 1372 | - ]; | |
| 1373 | - $fields['meta_icon_settings'] = $obj->start_section( | |
| 1374 | - esc_html__( 'Meta', 'shopbuilder' ), | |
| 1375 | - 'settings', | |
| 1376 | - $conditions, | |
| 1377 | - ); | |
| 1378 | - $fields['meta_separator'] = [ | |
| 1379 | - 'type' => 'text', | |
| 1380 | - 'label' => esc_html__( 'Meta Separator', 'shopbuilder' ), | |
| 1381 | - ]; | |
| 1382 | - $fields['author_icon_note'] = $obj->el_heading( | |
| 1383 | - esc_html__( 'Author Icon', 'shopbuilder' ), | |
| 1384 | - 'default', | |
| 1385 | - [], | |
| 1386 | - [ 'show_author' => [ 'yes' ] ] | |
| 1387 | - ); | |
| 1388 | - $fields['show_author_icon'] = [ | |
| 1389 | - 'type' => 'switch', | |
| 1390 | - 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ), | |
| 1391 | - 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ), | |
| 1392 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 1393 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 1394 | - 'condition' => [ | |
| 1395 | - 'show_author' => [ 'yes' ], | |
| 1396 | - ], | |
| 1397 | - ]; | |
| 1398 | - $fields['author_icon'] = [ | |
| 1399 | - 'label' => esc_html__( 'Icon', 'shopbuilder' ), | |
| 1400 | - 'type' => 'icons', | |
| 1401 | - 'default' => [ | |
| 1402 | - 'value' => 'far fa-user', | |
| 1403 | - 'library' => 'fa-solid', | |
| 1404 | - ], | |
| 1405 | - 'condition' => [ | |
| 1406 | - 'show_author' => [ 'yes' ], | |
| 1407 | - 'show_author_icon' => [ 'yes' ], | |
| 1408 | - ], | |
| 1409 | - ]; | |
| 1410 | - $fields['post_date_icon_note'] = $obj->el_heading( | |
| 1411 | - esc_html__( 'Date Icon', 'shopbuilder' ), | |
| 1412 | - 'default', | |
| 1413 | - [], | |
| 1414 | - [ 'show_dates' => [ 'yes' ] ] | |
| 1415 | - ); | |
| 1416 | - $fields['show_date_icon'] = [ | |
| 1417 | - 'type' => 'switch', | |
| 1418 | - 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ), | |
| 1419 | - 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ), | |
| 1420 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 1421 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 1422 | - 'default' => 'yes', | |
| 1423 | - 'condition' => [ | |
| 1424 | - 'show_dates' => [ 'yes' ] , | |
| 1425 | - ], | |
| 1426 | - ]; | |
| 1427 | - $fields['date_icon'] = [ | |
| 1428 | - 'label' => esc_html__( 'Icon', 'shopbuilder' ), | |
| 1429 | - 'type' => 'icons', | |
| 1430 | - 'default' => [ | |
| 1431 | - 'value' => 'fas fa-calendar-alt', | |
| 1432 | - 'library' => 'fa-solid', | |
| 1433 | - ], | |
| 1434 | - 'condition' => [ | |
| 1435 | - 'show_dates' => [ 'yes' ], | |
| 1436 | - 'show_date_icon' => [ 'yes' ], | |
| 1437 | - ], | |
| 1438 | - ]; | |
| 1439 | - $fields['post_comment_icon_note'] = $obj->el_heading( | |
| 1440 | - esc_html__( 'Comment Icon', 'shopbuilder' ), | |
| 1441 | - 'default', | |
| 1442 | - [], | |
| 1443 | - [ 'show_comment' => [ 'yes' ] ] | |
| 1444 | - ); | |
| 1445 | - $fields['show_comment_icon'] = [ | |
| 1446 | - 'type' => 'switch', | |
| 1447 | - 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ), | |
| 1448 | - 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ), | |
| 1449 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 1450 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 1451 | - 'condition' => [ | |
| 1452 | - 'show_comment' => [ 'yes' ] , | |
| 1453 | - ], | |
| 1454 | - ]; | |
| 1455 | - $fields['comment_icon'] = [ | |
| 1456 | - 'label' => esc_html__( 'Icon', 'shopbuilder' ), | |
| 1457 | - 'type' => 'icons', | |
| 1458 | - 'default' => [ | |
| 1459 | - 'value' => 'far fa-comment', | |
| 1460 | - 'library' => 'fa-solid', | |
| 1461 | - ], | |
| 1462 | - 'condition' => [ | |
| 1463 | - 'show_comment' => [ 'yes' ], | |
| 1464 | - 'show_comment_icon' => [ 'yes' ], | |
| 1465 | - ], | |
| 1466 | - ]; | |
| 1467 | - $fields['post_reading_time_icon_note'] = $obj->el_heading( | |
| 1468 | - esc_html__( 'Reading Time Icon', 'shopbuilder' ), | |
| 1469 | - 'default', | |
| 1470 | - [], | |
| 1471 | - [ 'show_reading_time' => [ 'yes' ] ] | |
| 1472 | - ); | |
| 1473 | - $fields['show_reading_time_icon'] = [ | |
| 1474 | - 'type' => 'switch', | |
| 1475 | - 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ), | |
| 1476 | - 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ), | |
| 1477 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 1478 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 1479 | - 'condition' => [ | |
| 1480 | - 'show_reading_time' => [ 'yes' ] , | |
| 1481 | - ], | |
| 1482 | - ]; | |
| 1483 | - $fields['reading_time_icon'] = [ | |
| 1484 | - 'label' => esc_html__( 'Icon', 'shopbuilder' ), | |
| 1485 | - 'type' => 'icons', | |
| 1486 | - 'default' => [ | |
| 1487 | - 'value' => 'far fa-clock', | |
| 1488 | - 'library' => 'fa-solid', | |
| 1489 | - ], | |
| 1490 | - 'condition' => [ | |
| 1491 | - 'show_reading_time' => [ 'yes' ], | |
| 1492 | - 'show_reading_time_icon' => [ 'yes' ], | |
| 1493 | - ], | |
| 1494 | - ]; | |
| 1495 | - $fields['post_views_icon_note'] = $obj->el_heading( | |
| 1496 | - esc_html__( 'Post Views Icon', 'shopbuilder' ), | |
| 1497 | - 'default', | |
| 1498 | - [], | |
| 1499 | - [ 'show_post_views' => [ 'yes' ] ] | |
| 1500 | - ); | |
| 1501 | - $fields['show_post_views_icon'] = [ | |
| 1502 | - 'type' => 'switch', | |
| 1503 | - 'label' => esc_html__( 'Enable Icon?', 'shopbuilder' ), | |
| 1504 | - 'description' => esc_html__( 'Switch on to enable pagination.', 'shopbuilder' ), | |
| 1505 | - 'label_on' => esc_html__( 'On', 'shopbuilder' ), | |
| 1506 | - 'label_off' => esc_html__( 'Off', 'shopbuilder' ), | |
| 1507 | - 'condition' => [ | |
| 1508 | - 'show_post_views' => [ 'yes' ] , | |
| 1509 | - ], | |
| 1510 | - ]; | |
| 1511 | - $fields['post_views_icon'] = [ | |
| 1512 | - 'label' => esc_html__( 'Icon', 'shopbuilder' ), | |
| 1513 | - 'type' => 'icons', | |
| 1514 | - 'default' => [ | |
| 1515 | - 'value' => 'far fa-eye', | |
| 1516 | - 'library' => 'fa-solid', | |
| 1517 | - ], | |
| 1518 | - 'condition' => [ | |
| 1519 | - 'show_post_views' => [ 'yes' ], | |
| 1520 | - 'show_post_views_icon' => [ 'yes' ], | |
| 1521 | - ], | |
| 1522 | - ]; | |
| 1523 | - | |
| 1524 | - $fields['meta_icon_settings_end'] = $obj->end_section(); | |
| 1525 | - return $fields; | |
| 1526 | - } | |
| 1527 | - /** | |
| 1528 | 1152 | * Taxonomy style section |
| 1529 | 1153 | * |
| 1530 | 1154 | * @param object $obj Reference object. |
| 1531 | 1155 | * |
| @@ -1565,17 +1189,8 @@ | ||
| 1565 | 1189 | ]; |
| 1566 | 1190 | |
| 1567 | 1191 | $fields = ControlHelper::general_elementor_style( 'post_taxonomy_style', $title, $obj, [], $selectors, $conditions ); |
| 1568 | 1192 | |
| 1569 | - // Force text-decoration with !important to beat the `.rtsb-elementor-container a { text-decoration: none !important; }` framework shield (see _el-global.scss). | |
| 1570 | - $fields['rtsb_el_post_taxonomy_style_typography']['fields_options'] = [ | |
| 1571 | - 'text_decoration' => [ | |
| 1572 | - 'selectors' => [ | |
| 1573 | - $css_selectors['typography'] => 'text-decoration: {{VALUE}} !important;', | |
| 1574 | - ], | |
| 1575 | - ], | |
| 1576 | - ]; | |
| 1577 | - | |
| 1578 | 1193 | unset( |
| 1579 | 1194 | $fields['post_taxonomy_style_alignment'], |
| 1580 | 1195 | ); |
| 1581 | 1196 | $extra_controls['taxonomy_border_radius'] = [ |
| @@ -1601,27 +1216,8 @@ | ||
| 1601 | 1216 | ]; |
| 1602 | 1217 | $fields = Fns::insert_controls( 'post_taxonomy_style_spacing_note', $fields, $extra_controls2, true ); |
| 1603 | 1218 | return $fields; |
| 1604 | 1219 | } |
| 1605 | - /** | |
| 1606 | - * Get the list of available image hover effects for post widgets. | |
| 1607 | - * | |
| 1608 | - * Returns an associative array of hover effect CSS class names mapped | |
| 1609 | - * to their corresponding human-readable labels. The list can be modified | |
| 1610 | - * by third-party developers through the | |
| 1611 | - * `rtsb/general/widget/post_widget_image_hover_effect` filter. | |
| 1612 | - * | |
| 1613 | - * Available effects: | |
| 1614 | - * - None | |
| 1615 | - * - Scale In | |
| 1616 | - * - Scale Out | |
| 1617 | - * - Slide Up | |
| 1618 | - * - Slide Down | |
| 1619 | - * - Slide Right | |
| 1620 | - * - Slide Left | |
| 1621 | - * | |
| 1622 | - * @return array List of image hover effect options (class => label). | |
| 1623 | - */ | |
| 1624 | 1220 | public static function rtsb_post_image_hover_effect() { |
| 1625 | 1221 | return apply_filters( |
| 1626 | 1222 | 'rtsb/general/widget/post_widget_image_hover_effect', |
| 1627 | 1223 | [ |
| @@ -1634,22 +1230,9 @@ | ||
| 1634 | 1230 | 'rtsb-gw-img-slide-left' => __( 'Slide Left', 'shopbuilder' ), |
| 1635 | 1231 | ] |
| 1636 | 1232 | ); |
| 1637 | 1233 | } |
| 1638 | - /** | |
| 1639 | - * Get CSS selectors used for styling pagination elements in Elementor widgets. | |
| 1640 | - * | |
| 1641 | - * Returns an associative array mapping style control keys (e.g., typography, | |
| 1642 | - * alignment, colors, borders) to the corresponding CSS selectors used within | |
| 1643 | - * the widget. These selectors are primarily applied when rendering pagination | |
| 1644 | - * for posts, archives, and "load more" buttons inside the ShopBuilder Elementor | |
| 1645 | - * container. | |
| 1646 | - * | |
| 1647 | - * This helps ensure all pagination-related style controls are centralized and | |
| 1648 | - * consistent across widgets. | |
| 1649 | - * | |
| 1650 | - * @return array List of pagination style selectors keyed by control name. | |
| 1651 | - */ | |
| 1234 | + | |
| 1652 | 1235 | public static function post_pagination_selectors() { |
| 1653 | 1236 | return [ |
| 1654 | 1237 | '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', |
| 1655 | 1238 | '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', |