at path:
ROOT
/
wp-content
/
plugins
/
kadu-plugin
/
elementor
/
elementor-init.php
run:
R
W
Run
widgets
DIR
2025-12-13 10:18:27
R
W
Run
elementor-init.php
5.33 KB
2024-10-16 22:18:55
R
W
Run
Delete
Rename
icons.svg
2.57 KB
2024-10-16 22:18:55
R
W
Run
Delete
Rename
error_log
up
📄
elementor-init.php
Save
<?php /** * All Elementor widget init * @package kadu * @since 1.0.0 */ if ( !defined('ABSPATH') ){ exit(); // exit if access directly } if ( !class_exists('kadu_Elementor_Widget_Init') ){ class kadu_Elementor_Widget_Init{ /* * $instance * @since 1.0.0 * */ private static $instance; /* * construct() * @since 1.0.0 * */ public function __construct() { add_action( 'elementor/elements/categories_registered', array($this,'_widget_categories') ); //elementor widget registered add_action('elementor/widgets/register',array($this,'_widget_registered')); add_action('elementor/editor/after_enqueue_styles',array($this,'editor_style')); add_action('elementor/documents/register_controls',array($this,'register_kadu_page_controls')); add_action('wp_enqueue_scripts', [$this, 'register_widget_styles']); } /* * getInstance() * @since 1.0.0 * */ public static function getInstance(){ if ( null == self::$instance ){ self::$instance = new self(); } return self::$instance; } /** * _widget_categories() * @since 1.0.0 * */ public function _widget_categories($elements_manager){ $elements_manager->add_category( 'kadu_widgets', [ 'title' => __( 'kadu Addons', 'kadu-plugin' ), 'icon' => 'fa fa-plug' ] ); } /** * _widget_registered() * @since 1.0.0 * */ public function _widget_registered(){ if( !class_exists('Elementor\Widget_Base') ){ return; } $elementor_widgets = array( // kadu Theme Widgets 'header', 'slider', 'heading', 'button', 'brand', 'blog', 'video-tab', 'video-slider', 'testimonial', 'cta', 'info-box', 'image-box', 'category', 'list', 'course-tab', 'hero-banner', 'contact-info', 'contact-form', 'service', 'team', 'rating-box', 'animated-border', 'course', 'pricing-tab', 'feature', 'content-tab', 'video-popup', 'pricing-plan', 'counters', 'event', 'team-carousel', 'service-carousel', 'accordion', 'animate-bg', 'gallery', 'event-info', ); $elementor_widgets = apply_filters('kadu_elementor_widget',$elementor_widgets); if ( is_array($elementor_widgets) && !empty($elementor_widgets) ) { foreach ( $elementor_widgets as $widget ){ $widget_file = 'plugins/elementor/widget/'.$widget.'.php'; $template_file = locate_template($widget_file); if ( !$template_file || !is_readable( $template_file ) ) { $template_file = KADU_DIR_PATH.'/elementor/widgets/'.$widget.'.php'; } if ( $template_file && is_readable( $template_file ) ) { include_once $template_file; } } } } /** * */ public function register_widget_styles(){ } public function editor_style(){ $cs_icon = plugins_url( 'icons.svg', __FILE__ ); wp_add_inline_style( 'elementor-editor', '.elementor-element .icon .kadu-custom-icon{content: url( '.$cs_icon.');width: 28px;}' ); } /** * Elemenotr Page Settings * * @param [type] $document * @return void Elementor Page Settings */ public function register_kadu_page_controls( $document ) { if ( ! $document instanceof \Elementor\Core\DocumentTypes\PageBase || ! $document::get_property( 'has_elements' ) ) { return; } $document->start_controls_section( 'body_kadu_style', [ 'label' => esc_html__( 'kadu Custom Body Style', 'kadu-plugin' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $document->add_control( 'body_color', [ 'label' => esc_html__( 'Body Color', 'textdomain' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => 'color: {{VALUE}}', ], ] ); $document->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'label' => esc_html__( 'Page Body Font', 'textdomain' ), 'name' => 'page_body_font', 'selector' => '{{WRAPPER}}', ] ); $document->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'label' => esc_html__( 'Page Heading', 'textdomain' ), 'name' => 'page_heading_font', 'selector' => '{{WRAPPER}} h1, h2, h3, h4, h5, h6', ] ); $document->add_control( 'h_color', [ 'label' => esc_html__( 'Heading Color', 'textdomain' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} h1, h2, h3, h4, h5, h6' => 'color: {{VALUE}}', ], ] ); $document->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'body_bg_color', 'types' => [ 'classic' ], 'exclude' => [ 'color' ], 'selector' => '{{WRAPPER}} .body-bg-1', 'fields_options' => [ 'background' => [ 'label' => esc_html__( 'Body Custom BG Image ', 'kadu-plugin' ), 'description' => esc_html__( 'Choose background type and style.', 'kadu-plugin' ), 'separator' => 'before', ] ] ] ); $document->end_controls_section(); } } if ( class_exists('kadu_Elementor_Widget_Init') ){ kadu_Elementor_Widget_Init::getInstance(); } }//end if