This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Used By | Defined By | Function | |
---|---|---|---|
Component | Store.getters.getPageBySlug() | state.posts.find(); | |
Store | Service.getPageBySlug() | Vue.http.get( path ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rest_theme_scripts() { | |
wp_enqueue_script( 'rest-theme-vue', get_template_directory_uri() . '/rest-theme/dist/build.js', array(), '1.0.0', true ); | |
wp_localize_script( 'rest-theme-vue', 'wp', array( | |
'routes' => rest_theme_routes(), //Drop in to JS from PHP | |
) ); | |
} | |
add_action( 'wp_enqueue_scripts', 'rest_theme_scripts' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VueRouter from 'vue-router' | |
Vue.use(VueRouter) | |
const routes = [ { path: '/', component: Home }, | |
{ path: '/post/:slug', name: 'post', component: Single }, | |
{ path: '/preview/:id', name: 'preview', component: Single }, | |
{ path: '/page/:slug', name: 'page', component: Page }, | |
{ path: '/category/:cat_id', name:'category', component: Archive }, | |
{ path: '/tag/:tag_id', name : 'tag', component: Archive }, | |
{ path: '/blog/', name : 'blog', component: Archive }, | |
{ path: '/search/', name : 'search', component: Search }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add the Number of queries to the header, because I'm a nerd. | |
add_filter( 'rest_pre_serve_request', function( $value ) { | |
header( 'X-Query-Count: '.intval( get_num_queries() ) ); | |
return $value; | |
}); |