-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.php
57 lines (43 loc) · 1.31 KB
/
plugin.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
51
52
53
54
55
56
57
<?php
namespace Custom_Dynamic_Tag;
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
die();
}
class Plugin {
private static $_instance = null;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
// Load files.
add_action( 'init', array( $this, 'init' ) );
}
public function init() {
add_action( 'elementor/dynamic_tags/register_tags', [ $this, 'register_dynamic_tags' ] );
}
public function register_dynamic_tags( $dynamic_tags ) {
// Register group
\Elementor\Plugin::$instance->dynamic_tags->register_group( 'custom-dynamic-tags', [
'title' => 'My Custom Dynamic Tags'
] );
// Include the Dynamic tag class file
include_once( 'tags/custom_picture_tag.php' );
include_once( 'tags/custom_title_tag.php' );
include_once( 'tags/custom_url_tag.php' );
// Finally register the tag
$dynamic_tags->register_tag( 'Custom_Dynamic_Tag\Tags\Custom_Picture_Tag' );
$dynamic_tags->register_tag( 'Custom_Dynamic_Tag\Tags\Custom_Title_Tag' );
$dynamic_tags->register_tag( 'Custom_Dynamic_Tag\Tags\Custom_Url_Tag' );
}
}
if ( ! function_exists( 'Plugin' ) ) {
function Plugin() {
return Plugin::instance();
}
}
// Instantiate Plugin Class
Plugin();