Changeset 3297038
- Timestamp:
- 05/20/2025 06:34:00 AM (11 months ago)
- Location:
- wpshare247-elementor-addons/trunk
- Files:
-
- 7 edited
-
inc/helper.php (modified) (1 diff)
-
inc/woocommerce.php (modified) (1 diff)
-
includes/plugin.php (modified) (1 diff)
-
includes/widgets/wpshare247_posts_widget.php (modified) (1 diff)
-
includes/widgets/wpshare247_product_single_price_widget.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
wpshare247-elementor-addon.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpshare247-elementor-addons/trunk/inc/helper.php
r3137039 r3297038 36 36 } 37 37 } 38 39 38 40 39 static function get_post_types( $post_type = 'page' ){ -
wpshare247-elementor-addons/trunk/inc/woocommerce.php
r3137039 r3297038 34 34 } 35 35 36 static function get_ product(){36 static function get_session_product(){ 37 37 $ea_product_id = $_SESSION['ea_product_id']; 38 38 $product = wc_get_product( $ea_product_id ); 39 return $product; 40 } 41 42 static function get_product(){ 43 global $product; 44 45 if( !is_object($product) ){ 46 $product = self::get_session_product(); 47 } 48 39 49 return $product; 40 50 } -
wpshare247-elementor-addons/trunk/includes/plugin.php
r3137039 r3297038 227 227 * 228 228 * @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager. 229 */ 230 public function register_widgets( $widgets_manager ) { 231 232 $arr_widgets = array( 233 'wpshare247_posts_widget', 234 'wpshare247_products_widget', 235 'wpshare247_product_categories_widget', 236 'wpshare247_contact_form7', 237 'wpshare247_countdown', 238 'wpshare247_product_single_price_widget' 239 //'wpshare247_new_widget' 240 ); 241 242 if($arr_widgets){ 243 foreach ($arr_widgets as $widget) { 244 require_once( __DIR__ . '/widgets/'.$widget.'.php' ); 245 $widgets_manager->register( new $widget() ); 229 * 230 * add_filter( 'wpshare247_el_addons_custom_widgets', function( $widgets ) { 231 $widgets[] = [ 232 'file' => get_stylesheet_directory() . '/my-widgets/my-widget.php', 233 'class' => 'My_Custom_Widget', 234 ]; 235 return $widgets; 236 }); 237 */ 238 public function register_widgets( $widgets_manager ) { 239 $default_widgets = array( 240 'wpshare247_posts_widget', 241 'wpshare247_products_widget', 242 'wpshare247_product_categories_widget', 243 'wpshare247_contact_form7', 244 'wpshare247_countdown', 245 'wpshare247_product_single_price_widget' 246 ); 247 248 $custom_widgets = apply_filters( 'wpshare247_el_addons_custom_widgets', $default_widgets ); 249 250 foreach ( $custom_widgets as $widget ) { 251 if ( is_string( $widget ) ) { 252 $file_path = __DIR__ . '/widgets/' . $widget . '.php'; 253 $class_name = $widget; 254 } 255 elseif ( is_array( $widget ) && isset( $widget['file'] ) && isset( $widget['class'] ) ) { 256 $file_path = $widget['file']; 257 $class_name = $widget['class']; 258 } else { 259 continue; 260 } 261 262 if ( file_exists( $file_path ) ) { 263 require_once $file_path; 264 265 if ( class_exists( $class_name ) ) { 266 $widgets_manager->register( new $class_name() ); 267 } 246 268 } 247 269 } -
wpshare247-elementor-addons/trunk/includes/widgets/wpshare247_posts_widget.php
r2851642 r3297038 578 578 'name' => 'title_style_typography', 579 579 'selector' => '{{WRAPPER}} .title a', 580 ] 581 ); 582 583 $this->add_control( 584 'title_style_custom', 585 [ 586 'label' => esc_html__( 'Custom', 'elementor' ) . ' '.esc_html__( 'Show', 'elementor' ), 587 'type' => \Elementor\Controls_Manager::SWITCHER, 588 'label_on' => esc_html__( 'Show', 'elementor' ), 589 'label_off' => esc_html__( 'Off', 'elementor' ), 590 'return_value' => 'yes', 591 'default' => '', 592 ] 593 ); 594 595 $this->add_control( 596 'title_style_custom_line', 597 [ 598 'label' => esc_html__( 'Line', 'elementor' ), 599 'type' => \Elementor\Controls_Manager::SLIDER, 600 'size_units' => [], 601 'range' => [ 602 'px' => [ 603 'min' => 1, 604 'max' => 5, 605 'step' => 1, 606 ], 607 ], 608 'default' => [ 609 'size' => 2, 610 ], 611 'selectors' => [ 612 '{{WRAPPER}} .title a' => 'text-overflow: ellipsis; overflow: hidden; display: -webkit-box; -webkit-line-clamp: {{SIZE}}; -webkit-box-orient: vertical;', 613 ], 614 'condition' => [ 615 'title_style_custom' => 'yes', 616 ], 617 ] 618 ); 619 620 621 $this->add_control( 622 'title_style_custom_height', 623 [ 624 'label' => esc_html__( 'Height', 'elementor' ), 625 'type' => \Elementor\Controls_Manager::SLIDER, 626 'size_units' => [ 'px' ], 627 'range' => [ 628 'px' => [ 629 'min' => 20, 630 'max' => 200, 631 'step' => 1, 632 ] 633 ], 634 'default' => [ 635 'unit' => 'px', 636 'size' => 30, 637 ], 638 'selectors' => [ 639 '{{WRAPPER}} .title a' => 'height: {{SIZE}}{{UNIT}}; max-height: {{SIZE}}{{UNIT}};', 640 ], 641 'condition' => [ 642 'title_style_custom' => 'yes', 643 ], 580 644 ] 581 645 ); -
wpshare247-elementor-addons/trunk/includes/widgets/wpshare247_product_single_price_widget.php
r3137042 r3297038 353 353 $diff_price_text = isset($settings['diff_price_text']) ? $settings['diff_price_text'] : 'Tiết kiệm:'; 354 354 355 global $product; 356 357 if( !is_object($product) ){ 358 $product = Ws247_EA_Woocommerce::get_product(); 359 } 355 $product = Ws247_EA_Woocommerce::get_product(); 360 356 361 357 if( is_object($product) ): -
wpshare247-elementor-addons/trunk/readme.txt
r3137041 r3297038 6 6 Tested up to: 6.6.1 7 7 Requires PHP: 7.0 8 Stable tag: 2. 18 Stable tag: 2.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 Wordpress Share - Học wordpress: [wpshare247.com](https://wpshare247.com) 25 25 Web Content - Viết bài chăm sóc web: [vietbaigiare.com](http://vietbaigiare.com) 26 27 **Cách dùng filter thêm Custom Widget - How to use custom Widget** 28 1. Copy folder `wpshare247-custom-widgets` from the plugin path: 29 `wpshare247-elementor-addons/your-custom-sample/wpshare247-custom-widgets` 30 into your current theme folder, like: 31 `wp-content/themes/your-theme/wpshare247-custom-widgets` 32 33 2. Inside that folder, you will find `wpshare247_my_custom.php`. 34 This is a sample widget file. You can use it directly, or duplicate and create more widget files. 35 36 3. In your theme's `functions.php`, add the following code to register custom widgets: 37 38 ```php 39 add_filter( 'wpshare247_el_addons_custom_widgets', function( $widgets ) { 40 $widgets[] = [ 41 'file' => get_stylesheet_directory() . '/wpshare247-custom-widgets/wpshare247_my_custom.php', 42 'class' => 'Wpshare247_My_Custom', 43 ]; 44 45 /* 46 // Example: Add more widgets if needed 47 $widgets[] = [ 48 'file' => get_stylesheet_directory() . '/wpshare247-custom-widgets/wpshare247_my_custom_new1.php', 49 'class' => 'Wpshare247_My_Custom_New1', 50 ]; 51 */ 52 53 return $widgets; 54 }); 55 56 26 57 27 58 == Installation == … … 56 87 * Add new widget: Product price 57 88 89 = 2.2 = 90 91 * Enhanced `wpshare247_posts_widget`: Added custom title styling options including line-clamp control (number of lines) and height adjustment via Elementor controls. 92 * Introduced new filter hook `wpshare247_el_addons_custom_widgets` allowing developers to register additional widgets from theme or other plugins with custom widget class and path. 93 ** How to use: Copy folder `wpshare247-custom-widgets` in plugin: wpshare247-elementor-addons/your-custom-sample/wpshare247-custom-widgets to your-theme/wpshare247-custom-widgets 94 58 95 59 96 == Upgrade Notice == -
wpshare247-elementor-addons/trunk/wpshare247-elementor-addon.php
r3137039 r3297038 4 4 * Plugin URI: https://wpshare247.com/ 5 5 * Description: Widgets (Wpshare247 Addons) for Elementor. Wpshare247 Addons for Elementor plugin includes widgets and addons like Blog Post, Products, Post, Page and Custom Post Type Grid or Carousel, Countdown, Contact Form 7, WooCommerce Product Price. 6 * Version: 2. 16 * Version: 2.2 7 7 * Author: Wpshare247.com 8 8 * Author URI: https://wpshare247.com/chuyen-muc/elementor … … 27 27 require_once( __DIR__ . '/inc/woocommerce.php' ); 28 28 } 29 30 29 // Load plugin file 31 30 require_once( __DIR__ . '/includes/plugin.php' );
Note: See TracChangeset
for help on using the changeset viewer.