-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.php
69 lines (54 loc) · 1.77 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Plugin Name: aa_usertable
* Description: WC plugin for user table
* Author: Afatoga
* Version: 1.0
* Author URI: https://leoweb.cz
*/
/**
* Register a custom page
*/
function af_registerPluginAdminPage()
{
$usertable_page = add_menu_page(
__('Žádosti o registraci', 'aa'), //titulek
__('Žádosti o registraci', 'aa'), //titulek v menu
'edit_users', // capabilities
'aa_usertable', //wp admin page slug
'aa_usertable_frontpage', //callback function
'',
99
);
add_action( 'load-' . $usertable_page, 'aa_loadAdmin' );
}
add_action('admin_menu', 'af_registerPluginAdminPage');
/**
* admin scripts
*/
// This function is only called when our plugin's page loads!
function aa_loadAdmin(){
add_action( 'admin_enqueue_scripts', 'aa_enqueueAdmin' );
}
function aa_enqueueAdmin(){
wp_register_script( 'vue2','https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js' );
wp_enqueue_script( 'vue2' );
//wp_enqueue_script( 'unfetch', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/unfetch.js' );
wp_enqueue_script( 'vuetify', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.js' );
wp_localize_script( 'vue2', 'wpRestApi', [
'root' => esc_url_raw( rest_url().'aa_restserver/v1' ), // /wp-json/aa_restserver/v1
'nonce' => wp_create_nonce( 'wp_rest' ),
] );
wp_enqueue_style( 'vuetify', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css', false );
wp_enqueue_style( 'material-design-icons', 'https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css', false );
}
/**
* frontend template
*/
function aa_usertable_frontpage()
{
if (isset($_POST["submit"])) {
//action
}
load_template(dirname(__FILE__) . '/admin-frontpage.php');
}