Skip to content

Instantly share code, notes, and snippets.

View mtias's full-sized avatar

Matias Ventura mtias

View GitHub Profile
@mtias
mtias / gist:6243071
Last active December 21, 2015 03:29

THX38

Theme Experience.

What problem(s) are you trying to solve?

  • Significantly improve and re-imagine the theme browsing screens for a better user experience.
  • More beautiful, visually focused, fast, and up to date with the current times of mobile ubiquitousness, flexible resolutions and retina devices.
  • Make it easier and enjoyable for people to find the best and most suitable themes for their needs and tastes.
@mtias
mtias / Calypso
Last active August 29, 2015 14:01
App.js
Modules
Manage
controller.js (initializes Manage.*)
manage.js
// sub-modules use views/templates/collections/models from app/*
sites.js (Manage.Sites)
/*
* Authorization module.
*
* @Routes /authorize
* /login
* /logout
*/
var auth = require( 'auth' );
/client
/auth
/boot
/layout
/manage
/posts
/sites
/pages
index.js
sidebar.js

Directory

client
|— components
|— stores
   |— app.js
   |— {subject}
      |— index.js (reducers)
 |— actions.js
@mtias
mtias / WP Post Doc
Created December 21, 2016 14:52
An example post
## Grammar
<!-- wp:x y:z -->
Content
<!-- /wp -->
### Text
<!-- wp:text -->
The quick brown fox jumps over the lazy dog.
<!-- /wp -->
@mtias
mtias / block.js
Created June 23, 2017 18:11
Creating a Gutenberg block from the console.
var el = wp.element.createElement;
wp.blocks.registerBlockType( 'mytheme/block', {
title: 'Red Block',
icon: 'universal-access-alt',
category: 'layout',
edit: function() {
return el( 'div', { style: { backgroundColor: '#900', color: '#fff', padding: '20px' } }, 'I am a red block.' );
},
save: function() {
<?php
$parser = new Gutenberg_PEG_Parser;
$blocks = $parser->parse( get_post( $post_id )->post_content );
// ordered array of blocks in the post
// each block has the following keys
//
// 0 => string 'blockName'
// 1 => string 'attrs'
@mtias
mtias / template.php
Last active January 19, 2018 16:39
Template
<body>
<?php
do_blocks( array(
// Theme header
array( 'theme/header' ),
array( 'core/image' ),
array( 'core/heading', array(
'placeholder' => 'Add Author...',
'className' => 'my-custom-class',

¡Hola! 🐻

If you like to write markdown, you should know that Gutenberg allows you to paste markdown text directly and it will be converted to native blocks instantly.

  • Including 🍎
  • Lists 🍇
  • Like this one 🍑

It is able to recognize quotes as well.