add_category( 'bappy-elements', [ 'title' => esc_html__( 'bappy elements', 'bappy' ), 'icon' => 'fa fa-plug', ] ); } add_action( 'elementor/elements/categories_registered', 'add_elementor_widget_categories' ); //Elementor init class ElementorCustomElement { private static $instance = null; public static function get_instance() { if ( ! self::$instance ) self::$instance = new self; return self::$instance; } public function init(){ add_action( 'elementor/widgets/widgets_registered', array( $this, 'widgets_registered' ) ); } public function widgets_registered() { // We check if the Elementor plugin has been installed / activated. if(defined('ELEMENTOR_PATH') && class_exists('Elementor\Widget_Base')){ get_template_part( 'inc/elementor/widgets/widget', 'service' ); get_template_part( 'inc/elementor/widgets/widget', 'portfolio' ); get_template_part( 'inc/elementor/widgets/widget', 'team' ); } } } ElementorCustomElement::get_instance()->init(); // get terms dropdown function get_terms_dropdown_array($args = [], $key = 'term_id', $value = 'name') { $options = []; $terms = get_terms($args); if (is_wp_error($terms)) { return []; } foreach ((array) $terms as $term) { $options[$term->{$key}] = $term->{$value}; } return $options; }