forked from webmonk/wordpress-plugin-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.php
53 lines (36 loc) · 1022 Bytes
/
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
<?php
/*
Plugin Name: Plugin Name
Plugin URI: http://codemypain.com
Description: Short plugin description
Version: 3.2
Author: Isaac Oyelowo
Author URI: http://isaacoyelowo.dev
*/
class Plugin_Class {
public $pluginShortName;
public function __construct () {
$this->pluginShortName = 'plugin';
$this->addActions();
$this->addFilters();
register_activation_hook( __FILE__, array( $this, 'onActivate' ) );
}
public function addActions() {
if ( is_admin() ) {
// Add only admin specific actions here
}
}
public function addFilters() {
if ( is_admin() ) {
// Add only admin specific filters here
}
}
public function onActivate() {
// Run this on plugin activation
}
public function localize() {
// Localization
load_plugin_textdomain( $this->pluginShortName , false, dirname(plugin_basename(__FILE__)). "/languages" );
}
}
$class = new Plugin_Class();