£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyʦ•ꎅȮFÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~芩ÊÇí`ÔÑ©ú뙵'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ӽ㞪éUWŸÈË%DÒÕ¬ï‘]/Åcx ‰ï2ß]ä6G[]S£Ôϯrs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! custom-elementor-widget.php register( new \ESW_Slider_Widget() ); } add_action( 'elementor/widgets/register', 'esw_register_widget' ); // Register custom category add_action( 'elementor/elements/categories_registered', function( $elements_manager ) { $elements_manager->add_category( 'hiral-widgets', [ 'title' => 'Hiral Custom Widgets', 'icon' => 'fa fa-plug' ] ); }); // Enqueue editor JS function esw_enqueue_editor_scripts() { wp_enqueue_script( 'esw-editor', ESW_URL . 'assets/js/esw-editor.js', [ 'jquery' ], '1.0', true ); } add_action( 'elementor/editor/after_enqueue_scripts', 'esw_enqueue_editor_scripts' ); ================================ widgets/class-slider-widget.php start_controls_section( 'slides_section', [ 'label' => __( 'Slider Images', 'esw' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'slides', [ 'label' => __( 'Add Images', 'esw' ), 'type' => Controls_Manager::GALLERY, 'default' => [], ] ); $this->add_control( 'height', [ 'label' => __( 'Height (px)', 'esw' ), 'type' => Controls_Manager::NUMBER, 'default' => 400, ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $slides = $settings['slides']; $height = $settings['height']; if ( empty( $slides ) ) { echo '
No images added.
'; return; } echo ''; // Inline CSS & simple JS for demo slider echo ''; echo ''; } // Editor preview protected function content_template() { ?> <# var slides = settings.slides; var height = settings.height; #> <# if ( slides.length === 0 ) { #>No images added.
<# } else { #> <# } #> 'ids' ] ); if ( empty( $terms ) ) { wp_set_post_terms( $post_id, [], 'category' ); // keep empty } } add_action( 'save_post', 'hr_stop_assigning_uncategorized', 20 ); // Remove WooCommerce default product category function hr_remove_woocommerce_default_product_cat() { update_option( 'default_product_cat', 0 ); } add_action( 'init', 'hr_remove_woocommerce_default_product_cat' ); /** * Stop WooCommerce from auto-assigning a default product category. */ function hr_stop_wc_auto_assign_uncategorized( $post_id ) { if ( wp_is_post_revision( $post_id ) ) return; if ( get_post_type( $post_id ) !== 'product' ) return; // Get current product categories $terms = wp_get_post_terms( $post_id, 'product_cat', array( 'fields' => 'ids' ) ); // If none selected → keep it empty if ( empty( $terms ) ) { wp_set_post_terms( $post_id, array(), 'product_cat' ); } } add_action( 'save_post', 'hr_stop_wc_auto_assign_uncategorized', 30 );