-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartesian-partners-cpt.php
53 lines (41 loc) · 1.45 KB
/
artesian-partners-cpt.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
/**
* @package artesian-partners-cpt
* @version 1.0.6
*/
/*
Plugin Name: Artesian Partners CPT
Plugin URI: http://wpwebdevelopment.com
Description: Establishes custom post types for different level of partners to display their information as well as setting up a post type linked to custom woocommerce product combinations
Author: Matthew Payne
Version: 1.0.5
Author URI: http://wpwebdevelopment.com
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Include files that register posts and set up custom fields
include( plugin_dir_path( __FILE__ ) . 'includes/acpt_register_posts.php');
include( plugin_dir_path( __FILE__ ) . 'includes/acpt_register_fields.php');
// Run functions on plugin init to register post types and fields
add_action( 'init', 'register_partners_cpt' );
// Flush rewrites on activation
function apcpt_activation() {
// Exit if user does not have admin privliges
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
register_partners_cpt();
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'apcpt_activation' );
// Flush our rewrite rules on deactivation.
function apcpt_deactivation() {
// Exit if user does not have admin privliges
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'apcpt_deactivation' );