Skip to content

Instantly share code, notes, and snippets.

@royboy789
royboy789 / Select.react.js
Created January 24, 2018 04:31
Gutenberg React state example
const { __ } = wp.i18n;
const { Component } = wp.element;
const el = wp.element.createElement;
export default class Select extends Component {
constructor( props ) {
super( ...props );
this.selectCallback = this.selectCallback.bind(this);
this.state = {
@royboy789
royboy789 / single.php
Created April 24, 2018 15:57
Using Gutenberg Block Data
<?php
get_header();
the_post();
$blocks = get_editor_blocks( $post->ID );
if ( empty( $blocks ) ) {
echo '<p>No Blocks Found</p>';
} else {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SGP Widget - BetMGM</title>
<link rel="stylesheet" href="css/widget.css">
</head>