-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsample-addon.php
More file actions
52 lines (35 loc) · 1.12 KB
/
sample-addon.php
File metadata and controls
52 lines (35 loc) · 1.12 KB
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
<?php
/**
* Plugin Name: Sample Aesop Story Engine Addon
*
*/
class myCustomComponent {
function __construct(){
define('MY_VERSION', '1.0');
define('MY_DIR', plugin_dir_path( __FILE__ ));
define('MY_URL', plugins_url( '', __FILE__ ));
require_once(MY_DIR.'class.shortcode.php');
require_once(MY_DIR.'class.settings.php');
if ( class_exists('Aesop_Core') )
require_once(MY_DIR.'class.backend.php');
// compatibility aesop front end editor
if ( class_exists( 'lasso_autoloader' ) ) {
//define('LASSO_CUSTOM', true);
require_once(MY_DIR.'class.front-end.php');
}
// optional enqueue js or css
add_action('wp_enqueue_scripts', array($this,'scripts'));
}
/**
*
* Optional add js or css
*/
function scripts(){
// this handy function checks a post or page to see if your component exists beore enqueueing assets
if ( function_exists('aesop_component_exists') && aesop_component_exists('test') ) {
wp_enqueue_style('test-style', MY_URL.'/css/test.css', MY_VERSION );
wp_enqueue_script('test-script', MY_URL.'/js/test.js', array('jquery'), MY_VERSION, true);
}
}
}
new myCustomComponent;