Skip to content

Instantly share code, notes, and snippets.


Mark Wilkinson wpmark

View GitHub Profile
pento / php-block.js
Last active Jul 10, 2021
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.
View php-block.js
// 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.
GaryJones /
Last active Dec 18, 2019
Add PHPCS + WPCS to Sublime Text 3

Install PHP_CodeSniffer (PHPCS) via git

You can use the .phar for PHPCS, but it's easier to pull the repo down from git to then choose what version to use.

cd ~
mkdir -p code
cd code
git clone phpcs
johnbillion /
Last active Oct 9, 2021
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here:

View gist:4fa3c4228a8bb53cc71d
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
isarmstrong /
Last active Aug 29, 2015
A class file that outputs social sharing buttons for WordPress, instantiated by array
* Class social_share
* @author : Ian Armstrong (@imperativeideas)
* A class file that outputs social sharing buttons for WordPress, instantiated by array
/* Sample Usage:
stompweb / gist:11321145
Last active Aug 29, 2015
Change menu classes
View gist:11321145
function register_my_page() {
global $my_page;
$my_page = add_menu_page( 'My Page', 'My Page', 'edit_pages', 'my_page.php', 'my_page_hook', 'dashicons-groups', 4 );
add_action('admin_menu', 'register_my_page');
function highlight_different_menu($parent_file){
richardW8k / RWNotificationExtras.php
Last active Sep 30, 2021
Adds a new settings to Gravity Forms notifications allowing uploaded files to be attached to the notification and the notification format to be changed to text.
View RWNotificationExtras.php
* Plugin Name: Gravity Forms - Notification Extras
* Author: Richard Wawrzyniak
* Description: Adds new settings to Gravity Forms Notifications enabling file uploads to be attached to notifications and the notification format to be changed to text.
* Version: 1.0
* Last Modified: 17/10/2014
* Updated attach_file() to allow for possibility that uploads folder was changed
* Added suppot for post_image fields
Latz / disablexmlrpc
Created Sep 28, 2012
Sample plugin for diabling XMLRPC server for WordPress >= v3.5
View disablexmlrpc
* Plugin Name: Disable XMLRPC
* Version: 0.1
* Plugin URI:
* Description: Disable XMLRPC server for WP >= v3.5
* Author: Lutz Schröer
* Author URI: