-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwp-plugin-base.php
More file actions
63 lines (47 loc) · 1.09 KB
/
Copy pathwp-plugin-base.php
File metadata and controls
63 lines (47 loc) · 1.09 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
<?php
/**
* Plugin Name: WP Plugin Base
* Plugin URI: https://zpirit.no
* Description: A simple Wordpress plugin
* Author: Zpirit Reklamebyrå
* Author URI: https://zpirit.no/kontakt/
* Version: 0.1
* Text Domain: acf
* Domain Path: /lang
*/
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* The plugin class with actions and filters
*/
class ZP_wp_plugin_base {
private $wpdb, $var1, $var2;
public function __construct() {
/* Use init function */
}
public function init() {
// global $wpdb;
// $this->wpdb = $wpdb;
// set text domain
load_textdomain( 'wp-plugin-base', 'lang/' );
// Actions and filters
add_action( 'init', array( $this, 'plugin_action') );
}
// Plugin action
private function plugin_action() {
// hardcore workout
}
}
/**
* Initiate the class in proper wp ways
* @return obj The class instance
*/
function zp_plugin_base() {
global $zp_plugin_base;
if( !isset($zp_plugin_base) ) {
$zp_plugin_base = new zp_plugin_base();
$zp_plugin_base->init();
}
return $zp_plugin_base;
}
// initialize
zp_plugin_base();