Skip to content

Instantly share code, notes, and snippets.

View mrpritchett's full-sized avatar

Matt Pritchett mrpritchett

View GitHub Profile
@mrpritchett
mrpritchett / wp-gutenberg-reusable-block-interface.php
Last active August 14, 2019 17:16
Gutenberg Reusable Block Editor Interface
function custom_add_interface_to_wp_block( $args, $post_type ) {
if ( 'wp_block' === $post_type ) {
$args['supports'] = array( 'title, 'editor' );
$args['show_in_rest'] = true;
$args['show_in_menu'] = true;
if ( strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post.php' ) ) {
$args['rest_controller_class'] = 'WP_REST_Posts_Controller';
} else {
$args['rest_controller_class'] = 'WP_REST_Blocks_Controller';
@mrpritchett
mrpritchett / class-widgets-command.php
Last active October 9, 2018 15:15
Find all Widgets in All Sidebars Across A Multisite Network
<?php
/**
* Commands to handle WordPress Widgets more in depth.
*
* Based on code from Chris Wiegman. Thanks, buddy.
*
* @author Matt Pritchett
*/
/**
@mrpritchett
mrpritchett / Contract Killer 3.md
Created December 29, 2018 18:42
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post