Skip to content

Instantly share code, notes, and snippets.

View pattonwebz's full-sized avatar
🏠
Working from home

William Patton pattonwebz

🏠
Working from home
View GitHub Profile
@jasonbahl
jasonbahl / gutenberg-page-template-switcher.js
Created May 4, 2018 21:01
Gutenberg Page Template Switcher
import gql from 'graphql-tag'
import { client } from '../utils/apollo-client'
const { parse } = wp.blocks;
const { select, subscribe, dispatch } = wp.data;
const GET_PAGE_BLOCK_TEMPLATE = gql`
query GET_PAGE_BLOCK_TEMPLATE($id: ID!, $template: String) {
page( id: $id ) {
blockTemplate( pageTemplate: $template )
}
}