-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelementor-addismap.php
50 lines (40 loc) · 1.63 KB
/
elementor-addismap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Plugin Name: AddisMap Elementor Element
* Description: Custom element added to Elementor
* Plugin URI: https://www.github.com/elementor-addismap
* Version: 0.0.1
* Author: addismap
* Author URI: https://addismap.com/bame
* Text Domain: elementor-custom-element
*/
if ( ! defined( 'ABSPATH' ) ) exit;
// This file is pretty much a boilerplate WordPress plugin.
// It does very little except including wp-widget.php
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')){
// We look for any theme overrides for this custom Elementor element.
// If no theme overrides are found we use the default one in this plugin.
$widget_file = 'plugins/elementor-addismap/widgets/three-zoom.php';
$template_file = locate_template($widget_file);
if ( !$template_file || !is_readable( $template_file ) ) {
$template_file = plugin_dir_path(__FILE__).'widgets/three-zoom.php';
}
if ( $template_file && is_readable( $template_file ) ) {
require_once $template_file;
}
}
}
}
ElementorCustomElement::get_instance()->init();