Skip to content

Commit d80c6fc

Browse files
committed
Initial commit
0 parents  commit d80c6fc

20 files changed

+9083
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Built files
2+
assets
3+
4+
# Composer
5+
vendor
6+
7+
# NPM
8+
node_modules

bootstrap.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* Plugin Name: WordPress Vue Menus
4+
* Plugin URI:
5+
* Description: A Vue prototype for WordPress menu UI
6+
* Version: 1.0
7+
* Author: Micah Wood
8+
* Author URI: https://wpscholar.com
9+
* License: GPL2
10+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
11+
*
12+
* Bootstrap file for initializing WordPress Vue app for menu UI.
13+
*
14+
* @package wp-menu-ui-vue-prototype
15+
*/
16+
17+
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
18+
require __DIR__ . '/vendor/autoload.php';
19+
}
20+
21+
if ( function_exists( 'add_action' ) ) {
22+
23+
add_action(
24+
'admin_menu',
25+
function () {
26+
27+
$title = 'Vue Menus';
28+
$slug = 'vue-menus';
29+
30+
add_menu_page(
31+
$title,
32+
$title,
33+
'manage_options',
34+
$slug,
35+
function () use ( $slug ) {
36+
37+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
38+
39+
wp_enqueue_script(
40+
$slug,
41+
plugins_url( "/assets/js/app{$suffix}.js", __FILE__ ),
42+
[],
43+
filemtime( __DIR__ . "/assets/js/app{$suffix}.js" ),
44+
true
45+
);
46+
47+
wp_enqueue_style(
48+
$slug,
49+
plugins_url( "/assets/css/app{$suffix}.css", __FILE__ ),
50+
[],
51+
filemtime( __DIR__ . "/assets/css/app{$suffix}.css" )
52+
);
53+
54+
?>
55+
<div class="wrap">
56+
<h1 class="wp-heading-inline">Menus</h1>
57+
<div id="vue-app" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_rest' ) ); ?>" data-rest-url="<?php echo esc_attr( get_rest_url() ); ?>"></div>
58+
</div>
59+
<?php
60+
},
61+
'dashicons-menu'
62+
);
63+
64+
}
65+
);
66+
67+
}

composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "wpscholar/wp-menu-ui-vue-prototype",
3+
"description": "A Vue prototype for WordPress menu UI",
4+
"type": "library",
5+
"license": "GPL-2.0-or-later",
6+
"authors": [
7+
{
8+
"name": "Micah Wood",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"scripts": {
13+
"post-create-project-cmd": [
14+
"npm install",
15+
"npm run build",
16+
"npx webpack"
17+
]
18+
},
19+
"require": {
20+
"wpscholar/wp-rest-menu-endpoints": "^1.0"
21+
}
22+
}

composer.lock

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)