-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathexample-cta-plugin.php
More file actions
83 lines (71 loc) · 1.9 KB
/
example-cta-plugin.php
File metadata and controls
83 lines (71 loc) · 1.9 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Plugin Name: Example CTA Plugin
* Plugin URI: https://github.com/norcross/example-cta-plugin
* Description: An example call to action plugin.
* Author: Andrew Norcross
* Author URI: http://reaktivstudios.com/
* Version: 0.0.1
* Text Domain: example-cta-plugin
* Domain Path: languages
* License: MIT
* GitHub Plugin URI: https://github.com/norcross/example-cta-plugin
*/
// Set our defined base.
if ( ! defined( 'EXM_CTA_BASE ' ) ) {
define( 'EXM_CTA_BASE', plugin_basename( __FILE__ ) );
}
// Set our defined directory.
if ( ! defined( 'EXM_CTA_DIR' ) ) {
define( 'EXM_CTA_DIR', plugin_dir_path( __FILE__ ) );
}
// Set our defined version.
if ( ! defined( 'EXM_CTA_VER' ) ) {
define( 'EXM_CTA_VER', '0.0.1' );
}
/**
* Set up and load our class.
*/
class Example_CTA_Core
{
/**
* Load our hooks and filters.
*
* @return void
*/
public function init() {
add_action( 'plugins_loaded', array( $this, 'textdomain' ) );
add_action( 'plugins_loaded', array( $this, 'load_files' ) );
}
/**
* Load textdomain for international goodness.
*
* @return void
*/
public function textdomain() {
load_plugin_textdomain( 'example-cta-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Call our files in the appropriate place.
*
* @return void
*/
public function load_files() {
// Load our helper file.
require_once( EXM_CTA_DIR . 'lib/helper.php' );
// Load our back end.
if ( is_admin() ) {
require_once( EXM_CTA_DIR . 'lib/admin.php' );
require_once( EXM_CTA_DIR . 'lib/settings.php' );
require_once( EXM_CTA_DIR . 'lib/postmeta.php' );
}
// Load our front-end.
if ( ! is_admin() ) {
require_once( EXM_CTA_DIR . 'lib/display.php' );
}
}
// End the class.
}
// Instantiate our class.
$Example_CTA_Core = new Example_CTA_Core();
$Example_CTA_Core->init();