PluginProbe
weDocs: AI Powered Knowledge Base, Docs, Documentation, Wiki & AI Chatbot / trunk
weDocs: AI Powered Knowledge Base, Docs, Documentation, Wiki & AI Chatbot vtrunk
2.5.0 2.4.1 2.4.0 2.3.1 2.3.0 2.2.5 2.2.6 2.2.7 2.2.2 2.2.3 2.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.4 1.4.1 1.5 1.6 1.6.1 1.6.2 1.6.3 1.7 1.7.1 1.7.2 All 54 releases
wedocs / includes / Elementor.php

Elementor.php in weDocs: AI Powered Knowledge Base, Docs, Documentation, Wiki & AI Chatbot trunk, at includes/Elementor.php

78 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WeDevs\WeDocs;
4
5 /**
6 * Elementor Integration Class
7 */
8 class Elementor {
9
10 /**
11 * Initialize the class
12 */
13 public function __construct() {
14 add_action( 'elementor/widgets/register', [ $this, 'register_widgets' ] );
15 add_action( 'elementor/elements/categories_registered', [ $this, 'register_widget_category' ] );
16
17 // Register widget scripts
18 add_action( 'elementor/frontend/after_register_scripts', [ $this, 'register_widget_scripts' ] );
19 add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'register_widget_styles' ] );
20 }
21
22 /**
23 * Register custom widget category
24 */
25 public function register_widget_category( $elements_manager ) {
26 $elements_manager->add_category(
27 'wedocs-category',
28 [
29 'title' => __( 'weDocs', 'wedocs' ),
30 'icon' => 'fa fa-book',
31 ]
32 );
33 }
34
35 /**
36 * Register widgets
37 */
38 public function register_widgets() {
39 // Check if Elementor is loaded
40 if ( ! did_action( 'elementor/loaded' ) ) {
41 return;
42 }
43
44 // Include widget files
45 // require_once WEDOCS_PATH . '/includes/Elementor/Widgets/Search.php';
46 require_once WEDOCS_PATH . '/includes/Elementor/Widgets/DocsGrid.php';
47
48 // Register widgets
49 // \Elementor\Plugin::instance()->widgets_manager->register( new \WeDevs\WeDocs\Elementor\Widgets\Search() );
50 \Elementor\Plugin::instance()->widgets_manager->register( new \WeDevs\WeDocs\Elementor\Widgets\DocsGrid() );
51 }
52
53 /**
54 * Register widget scripts
55 */
56 public function register_widget_scripts() {
57 wp_register_script(
58 'wedocs-elementor-widgets',
59 WEDOCS_ASSETS . '/js/elementor-widgets.js',
60 [ 'elementor-frontend' ],
61 WEDOCS_VERSION,
62 true
63 );
64 }
65
66 /**
67 * Register widget styles
68 */
69 public function register_widget_styles() {
70 wp_register_style(
71 'wedocs-elementor-widgets',
72 WEDOCS_ASSETS . '/css/elementor-widgets.css',
73 [],
74 WEDOCS_VERSION
75 );
76 }
77 }
78