-
Notifications
You must be signed in to change notification settings - Fork 0
/
castors-worksites.php
47 lines (40 loc) · 1.49 KB
/
castors-worksites.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
<?php
/*
Plugin Name: Castors Worksites
Plugin URI: https://les-castors.fr
Description: Worksites management for "Les Castors" child of Astra theme.
Author: Marc Delpont
Version: 1.0.0
Author URI: https://arkabase.fr
License: GPLv2
Text Domain: castors-worksites
*/
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
define('CASTORS_WORKSITES_PLUGIN_URI', plugin_dir_url(__FILE__));
define('CASTORS_WORKSITES_PLUGIN_DIR', plugin_dir_path(__FILE__));
require_once('worksite.php');
function castors_worksites_activate() {
Castors_Worksite::activate();
flush_rewrite_rules();
}
register_activation_hook(__FILE__, 'castors_worksites_activate');
function castors_worksites_deactivate() {
Castors_Worksite::deactivate();
flush_rewrite_rules();
}
register_deactivation_hook(__FILE__, 'castors_worksites_deactivate' );
add_action('wp_enqueue_scripts', ['Castors_Worksite', 'enqueue_scripts']);
add_action('admin_enqueue_scripts', ['Castors_Worksite', 'admin_enqueue_scripts']);
add_action('init', ['Castors_Worksite', 'init']);
add_action('admin_init', ['Castors_Worksite', 'admin_init']);
function castors_worksites_locate_template($template, $template_name) {
$template_path = CASTORS_WORKSITES_PLUGIN_DIR . 'woocommerce/';
if (file_exists($template_path . $template_name)) {
return $template_path . $template_name;
}
return $template;
}
add_filter('woocommerce_locate_template', 'castors_worksites_locate_template', 10, 2);