-
Notifications
You must be signed in to change notification settings - Fork 0
/
wc-vienna-2024.php
54 lines (46 loc) · 1.33 KB
/
wc-vienna-2024.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
<?php
/**
* Plugin Name: WC Vienna 2024
* Description: Example block scaffolded with Create Block tool.
* Requires at least: 6.4
* Requires PHP: 8.0
* Update URI: false
* Version: 0.3.0
* Author: Fabian Todt
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wc-vienna-2024
*
* @package wc-vienna-2024
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
add_action(
'admin_menu',
function () {
add_menu_page(
__('WC Vienna 2024', 'wc-vienna-2024'),
__('WC Vienna 2024', 'wc-vienna-2024'),
'manage_options',
'wc-vienna-2024',
__NAMESPACE__ . '\render_page',
);
}
);
function render_page()
{
$assetFile = plugin_dir_path(__FILE__) . '/build/admin-page.asset.php';
if (!file_exists($assetFile)) {
throw new \Exception('please run examples build process');
}
$asset = include $assetFile;
wp_enqueue_script(
'wc-vienna-2024-examples-admin-page',
plugin_dir_url(__FILE__) . '/build/admin-page.js',
$asset['dependencies'],
$asset['version']
);
wp_enqueue_style('wp-components');
echo '<div id="wc-vienna-2024-examples-admin-page"></div>';
}