Skip to content

Instantly share code, notes, and snippets.

View kmgalanakis's full-sized avatar

Konstantinos Galanakis kmgalanakis

View GitHub Profile
@pento
pento / php-block.js
Last active March 20, 2025 14:59
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@grappler
grappler / disable-classic-editor.php
Created May 9, 2018 08:47
Remove all traces of the classic editor in Gutenberg
<?php
/**
* Removes the classic editor actions links.
*/
add_action( 'admin_init', function() {
// For hierarchical post types.
add_filter( 'page_row_actions', 'gutenberg_remove_classic_editor_links', 10, 2 );
// For non-hierarchical post types.
add_filter( 'post_row_actions', 'gutenberg_remove_classic_editor_links', 10, 2 );
(function (m) {
/*
* PHP => moment.js
* Will take a php date format and convert it into a JS format for moment
* http://www.php.net/manual/en/function.date.php
* http://momentjs.com/docs/#/displaying/format/
*/
var formatMap = {
d: 'DD',
D: 'ddd',