-
Notifications
You must be signed in to change notification settings - Fork 281
/
functions.php
28 lines (25 loc) · 852 Bytes
/
functions.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
<?php
// Remove all default WP template redirects/lookups
remove_action( 'template_redirect', 'redirect_canonical' );
// Redirect all requests to index.php so the Vue app is loaded and 404s aren't thrown
function remove_redirects() {
add_rewrite_rule( '^/(.+)/?', 'index.php', 'top' );
}
add_action( 'init', 'remove_redirects' );
// Load scripts
function load_vue_scripts() {
wp_enqueue_script(
'vuejs-wordpress-theme-starter-js',
get_stylesheet_directory_uri() . '/dist/scripts/index.js',
array( 'jquery' ),
filemtime( get_stylesheet_directory() . '/dist/scripts/index.js' ),
true
);
wp_enqueue_style(
'vuejs-wordpress-theme-starter-css',
get_stylesheet_directory_uri() . '/dist/styles.css',
null,
filemtime( get_stylesheet_directory() . '/dist/styles.css' )
);
}
add_action( 'wp_enqueue_scripts', 'load_vue_scripts', 100 );