-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-product-list-table.php
125 lines (104 loc) · 3.02 KB
/
custom-product-list-table.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/*
Plugin Name: Custom Product List Table
Plugin URI: https://viitorcloud.com/blog/
Description: This plugin handles Product's Add,Edit and Delete functinalities with Category and product's status.
Version: 1.0.0
Author: Mitali, Viitorcloud
Author URI: https://viitorcloud.com/
*/
/**
* Define Some needed predefined variables
*
* @package Category List Table
* @since 1.0.0
*/
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
if( !defined( 'WW_CLT_DIR' ) ) {
define( 'WW_CLT_DIR', dirname( __FILE__ ) ); // plugin dir
}
if(!defined('WW_CLT_TEXT_DOMAIN')) { //check if variable is not defined previous then define it
define('WW_CLT_TEXT_DOMAIN','wwclt'); //this is for multi language support in plugin
}
if( !defined( 'WW_CLT_ADMIN' ) ) {
define( 'WW_CLT_ADMIN', WW_CLT_DIR . '/includes/admin' ); // plugin admin dir
}
if(!defined('wwcltlevel')) { //check if variable is not defined previous then define its
define('wwcltlevel','manage_options'); //this is capability in plugin
}
if(!defined('WW_CLT_URL')) {
define('WW_CLT_URL',plugin_dir_url( __FILE__ ) ); // plugin url
}
if( !defined( 'WW_CLT_TAXONOMY' )) {
define( 'WW_CLT_TAXONOMY','ww_pro_category' );
}
if( !defined( 'WW_CLT_POST_TYPE' )) {
define( 'WW_CLT_POST_TYPE','ww_pro_post' );
}
//metabox prefix
if( !defined( 'WW_CLT_META_PREFIX' )) {
define( 'WW_CLT_META_PREFIX', '_ww_clt_' );
}
/**
* Load Text Domain
*
* This gets the plugin ready for translation.
*
* @package Category List Table
* @since 1.0.0
*/
load_plugin_textdomain( 'wwclt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
/**
* Plugin Activation hook
*
* This hook will call when plugin will activate
*
* @package Category List Table
* @since 1.0.0
*/
register_activation_hook( __FILE__, 'ww_clt_install' );
function ww_clt_install() {
global $wpdb;
//adding custom post type function
ww_clt_reg_create_post_type();
//IMP Call of Function
//Need to call when custom post type is being used in plugin
flush_rewrite_rules();
}
/**
* Plugin Deactivation hook
*
* This hook will call when plugin will deactivate
*
* @package Category List Table
* @since 1.0.0
*/
register_deactivation_hook( __FILE__, 'ww_clt_uninstall' );
function ww_clt_uninstall() {
global $wpdb;
//IMP Call of Function
//Need to call when custom post type is being used in plugin
flush_rewrite_rules();
}
/**
* Includes Class Files
*
* @package Category List Table
* @since 1.0.0
*/
global $ww_clt_model,$ww_clt_scripts,$ww_clt_admin;
//includes post types file
include_once( WW_CLT_DIR . '/includes/ww-clt-post-types.php');
//includes model class
require_once( WW_CLT_DIR . '/includes/class-ww-clt-model.php');
$ww_clt_model = new Ww_Clt_Model();
//includes scripts class file
require_once ( WW_CLT_DIR .'/includes/class-ww-clt-scripts.php');
$ww_clt_scripts = new Ww_Clt_Scripts();
$ww_clt_scripts->add_hooks();
//includes admin pages
require_once( WW_CLT_ADMIN . '/class-ww-clt-admin.php');
$ww_clt_admin = new Ww_Clt_Admin_Pages();
$ww_clt_admin->add_hooks();
?>